MVVM rebuild complete
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Controlling.UsrActivity;
|
||||
using StgSharp.MVVM.View;
|
||||
using StgSharp.Controlling.UsrActivity;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,19 +8,25 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Control : ViewResponder<ViewMain>
|
||||
{
|
||||
public partial class ViewMain
|
||||
{
|
||||
|
||||
|
||||
public override void CustomizedInitialize(Func<ITrigger, string, Action> keyRegister)
|
||||
protected class Control : ViewResponder<ViewMain>
|
||||
{
|
||||
public Control(ViewMain view):base(view)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public override void CustomizedInitialize(Func<ITrigger, string, Action> keyRegister)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Controlling.UsrActivity;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,21 +8,45 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StgSharp.Controls;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using StgSharp.Geometries;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal class Design : ViewDesigner<ViewMain>
|
||||
public partial class ViewMain
|
||||
{
|
||||
DemoButtonGroup group;
|
||||
internal DemoButtonGroup Group { get; set; }
|
||||
internal TriggerButton OnlyButton { get; set; }
|
||||
|
||||
public override sealed void CustomizedInitialize()
|
||||
internal class Design : ViewDesigner<ViewMain>
|
||||
{
|
||||
group = new DemoButtonGroup();
|
||||
}
|
||||
public Design(ViewMain view):base(view)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return true;
|
||||
public override sealed void CustomizedInitialize()
|
||||
{
|
||||
Binding.Group = CreateKeyboardButtonGroup<DemoButtonGroup>(
|
||||
new KeyTrigger(KeyboardKey.LEFT,KeyStatus.PRESS),
|
||||
new KeyTrigger(KeyboardKey.RIGHT, KeyStatus.PRESS),
|
||||
new KeyTrigger(KeyboardKey.UP, KeyStatus.PRESS),
|
||||
new KeyTrigger(KeyboardKey.DOWN, KeyStatus.PRESS),
|
||||
new KeyTrigger(KeyboardKey.ENTER, KeyStatus.PRESS)
|
||||
);
|
||||
Binding.OnlyButton = CreateKeyboardButton(
|
||||
Binding.Stream.ButtonBounding,
|
||||
Binding.Stream.ButtonTextureProvider,
|
||||
true
|
||||
);
|
||||
Binding.OnlyButton.RenderButtonTexture += Binding.Stream.RenderButton;
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +56,5 @@ namespace StgSharp
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class ViewMain
|
||||
{
|
||||
public ParticleRenderStream Stream { get; set; }
|
||||
|
||||
|
||||
private class NewRender : ViewRender<ViewMain>
|
||||
{
|
||||
public NewRender(ViewMain view):base(view)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void CustomizedInitialize()
|
||||
{
|
||||
Binding.Stream = CreateRenderStream<ParticleRenderStream>((1,1,1));
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return Binding.Stream != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Logic;
|
||||
|
||||
using StgSharpDebug.Logic;
|
||||
using StgSharp.MVVM;
|
||||
using StgSharp.MVVM.View;
|
||||
using StgSharp.MVVM.ViewModel;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,30 +12,51 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class ViewMain : View
|
||||
public partial class ViewMain : ViewBase
|
||||
{
|
||||
public DemoButtonGroup DemoGroup
|
||||
public ViewMain()
|
||||
{
|
||||
get; set;
|
||||
_databindingIndexMap = new Dictionary<string, DataBindingEntry>();
|
||||
}
|
||||
|
||||
Dictionary<string, DataBindingEntry> _databindingIndexMap;
|
||||
|
||||
public override void CustomizedInitialize(ViewModelBase viewModelBinding)
|
||||
{
|
||||
Designer = new Design();
|
||||
Responder = new Control();
|
||||
Render = new Render();
|
||||
Designer = new Design(this);
|
||||
Responder = new Control(this);
|
||||
Render = new NewRender(this);
|
||||
|
||||
DemoGroup = new DemoButtonGroup();
|
||||
Render.Initialize();
|
||||
Designer.Initialize();
|
||||
Responder.Initialize(viewModelBinding.MethodLookup);
|
||||
}
|
||||
|
||||
public override bool TryGetObjectReference(string name, out DataBindingEntry entry)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (_databindingIndexMap.TryGetValue(name,out entry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
try
|
||||
{
|
||||
entry = name switch
|
||||
{
|
||||
_ => default(DataBindingEntry),
|
||||
};
|
||||
return !entry.ExactEqual(default(DataBindingEntry));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
entry = default(DataBindingEntry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal protected override void Show()
|
||||
protected internal override void Show()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Stream.Draw();
|
||||
Stream.AnotherMain(OnlyButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user