diff --git a/HLab/MonitorVcp/HLab.Windows.MonitorVcp.csproj b/HLab/MonitorVcp/HLab.Windows.MonitorVcp.csproj index 4374d462..3272ee84 100644 --- a/HLab/MonitorVcp/HLab.Windows.MonitorVcp.csproj +++ b/HLab/MonitorVcp/HLab.Windows.MonitorVcp.csproj @@ -128,6 +128,7 @@ + diff --git a/HLab/MonitorVcp/app.config b/HLab/MonitorVcp/app.config new file mode 100644 index 00000000..724d290a --- /dev/null +++ b/HLab/MonitorVcp/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/HLab/Mvvm/HLab.Mvvm.csproj b/HLab/Mvvm/HLab.Mvvm.csproj index 3570efdc..0f8a864e 100644 --- a/HLab/Mvvm/HLab.Mvvm.csproj +++ b/HLab/Mvvm/HLab.Mvvm.csproj @@ -72,8 +72,20 @@ + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.dll + + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.CollectionsV3.dll + + + ..\..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll + + + + @@ -139,15 +151,21 @@ + + Always + + + + \ No newline at end of file diff --git a/HLab/Mvvm/Icons/IconService.cs b/HLab/Mvvm/Icons/IconService.cs index 14e1d27b..8896687e 100644 --- a/HLab/Mvvm/Icons/IconService.cs +++ b/HLab/Mvvm/Icons/IconService.cs @@ -8,6 +8,7 @@ using System.Text; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Xml; @@ -54,6 +55,9 @@ public UIElement GetIcon(string assemblyName, string name) } public UIElement GetIcon(Assembly assembly, string name) { + + return GetIconXaml(assembly, name) ?? GetFromSvg(assembly, name); + var cache = _cache.GetValue(assembly, a => new IconCache(a)); return cache.Get(name,(a,n)=> GetIconXaml(a, n) ?? GetFromSvg(a, n)); @@ -74,13 +78,14 @@ public UIElement GetIconXaml(Assembly assembly, string name) } } - private XslCompiledTransform _transform; + private XslCompiledTransform _transformSvg; + private XslCompiledTransform _transformHtml; - private XslCompiledTransform Transform + private XslCompiledTransform TransformSvg { get { - if (_transform == null) + if (_transformSvg == null) { using (var xslStream = Assembly.GetAssembly(this.GetType()) .GetManifestResourceStream("HLab.Mvvm.Icons.svg2xaml.xsl")) @@ -89,14 +94,74 @@ private XslCompiledTransform Transform using (var stylesheet = XmlReader.Create(xslStream)) { var settings = new XsltSettings { EnableDocumentFunction = true }; - _transform = new XslCompiledTransform(); - _transform.Load(stylesheet, settings, new XmlUrlResolver()); + _transformSvg = new XslCompiledTransform(); + _transformSvg.Load(stylesheet, settings, new XmlUrlResolver()); } } } - return _transform; + return _transformSvg; } } + private XslCompiledTransform TransformHtml + { + get + { + if (_transformHtml == null) + { + using (var xslStream = Assembly.GetAssembly(this.GetType()) + .GetManifestResourceStream("HLab.Mvvm.Icons.html2xaml.xslt")) + { + if (xslStream == null) throw new IOException("xsl file not found"); + using (var stylesheet = XmlReader.Create(xslStream)) + { + var settings = new XsltSettings { EnableDocumentFunction = true }; + _transformHtml = new XslCompiledTransform(); + _transformHtml.Load(stylesheet, settings, new XmlUrlResolver()); + } + } + } + return _transformHtml; + } + } + + public TextBlock GetFromHtml(string html) + { + TextBlock textBlock = null; + Application.Current.Dispatcher.Invoke( + () => + { + using (var s = new MemoryStream()) + { + using (var stringReader = new StringReader(html)) + { + using (var htmlReader = XmlReader.Create(stringReader)) + { + using (var w = XmlWriter.Create(s)) + { + TransformHtml.Transform(htmlReader, w); + } + + try + { + s.Seek(0, SeekOrigin.Begin); + + var sz = Encoding.UTF8.GetString(s.ToArray()); + using (var reader = XmlReader.Create(s)) + { + textBlock = (TextBlock) System.Windows.Markup.XamlReader.Load(reader); + // Code to run on the GUI thread. + } + + } + catch (IOException) + { + } + } + } + } + }); + return textBlock; + } public UIElement GetFromSvg(Assembly assembly, string name) { @@ -112,15 +177,18 @@ public UIElement GetFromSvg(Assembly assembly, string name) { using (var w = XmlWriter.Create(s)) { - Transform.Transform(svgReader, w); + TransformSvg.Transform(svgReader, w); } try { s.Seek(0, SeekOrigin.Begin); - var sz = Encoding.UTF8.GetString(s.ToArray()); + //var sz = Encoding.UTF8.GetString(s.ToArray()); using (var reader = XmlReader.Create(s)) - return (UIElement) System.Windows.Markup.XamlReader.Load(reader); + { + var icon = (UIElement) System.Windows.Markup.XamlReader.Load(reader); + return icon; + } } catch (IOException) { diff --git a/HLab/Mvvm/Icons/html2xaml.xslt b/HLab/Mvvm/Icons/html2xaml.xslt new file mode 100644 index 00000000..e4fda2e9 --- /dev/null +++ b/HLab/Mvvm/Icons/html2xaml.xslt @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HLab/Mvvm/ViewLocator.cs b/HLab/Mvvm/ViewLocator.cs index 590e402e..430e9f79 100644 --- a/HLab/Mvvm/ViewLocator.cs +++ b/HLab/Mvvm/ViewLocator.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License using System.ComponentModel; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; namespace HLab.Mvvm { @@ -152,6 +153,14 @@ private static void OnViewModeContextChanged(DependencyObject dependencyObject, public ViewLocator() { this.DataContextChanged += ViewLocator_DataContextChanged; + + var b = new Binding + { + Source = this, + Path = new PropertyPath("DataContext"), + Mode = BindingMode.OneWay + }; + BindingOperations.SetBinding(this, ModelProperty, b); } private void ViewLocator_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) @@ -159,9 +168,15 @@ private void ViewLocator_DataContextChanged(object sender, DependencyPropertyCha //TODO : problème dans lbm mais insipensable dans erp //if (sender is ViewLocator vl && ReferenceEquals(vl.Model, e.OldValue)) //{ - // var oldModel = vl.Model; - // vl.Model = e.NewValue; - // vl.Update(oldModel, vl.ViewMode, vl.ViewClass); + // if(vl.Model != null) + // { } + + // if (GetBindingExpression(ModelProperty).Status == BindingStatus.Unattached) + // { + // var oldModel = vl.Model; + // vl.Model = e.NewValue; + // vl.Update(oldModel, vl.ViewMode, vl.ViewClass); + // } //} } diff --git a/HLab/Mvvm/ViewModel.cs b/HLab/Mvvm/ViewModel.cs index 6a67e060..2c68e502 100644 --- a/HLab/Mvvm/ViewModel.cs +++ b/HLab/Mvvm/ViewModel.cs @@ -25,12 +25,12 @@ You should have received a copy of the GNU General Public License namespace HLab.Mvvm { - public class ViewModel : INotifyPropertyChanged + public class ViewModel : NotifierObject, IViewModel { - public event PropertyChangedEventHandler PropertyChanged + protected ViewModel(bool init = true) : base(init) { - add => this.Add(value); - remove => this.Remove(value); } + + public T Model => this.Get(); } } diff --git a/HLab/Mvvm/app.config b/HLab/Mvvm/app.config new file mode 100644 index 00000000..724d290a --- /dev/null +++ b/HLab/Mvvm/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/HLab/Mvvm/packages.config b/HLab/Mvvm/packages.config new file mode 100644 index 00000000..62012005 --- /dev/null +++ b/HLab/Mvvm/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/HLab/Notify-4/Notifier.cs b/HLab/Notify-4/Notifier.cs index ee11e1c0..72c1635c 100644 --- a/HLab/Notify-4/Notifier.cs +++ b/HLab/Notify-4/Notifier.cs @@ -22,6 +22,7 @@ You should have received a copy of the GNU General Public License */ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; @@ -151,6 +152,17 @@ public bool Set(object target, T value, string propertyName, Action pos return Set(target, value, Class.GetProperty(propertyName), postUpdateAction); } + public bool SetOneToMany(TNotifier target, T value, Func> getCollection, string propertyName) + where TNotifier : INotifierObject + { + Debug.Assert(!string.IsNullOrWhiteSpace(propertyName), "propertyName cannot be null or empty"); + + return Set(target, value, Class.GetProperty(propertyName), (oldValue, newValue) => + { + if(oldValue!=null) getCollection(oldValue).Remove(target); + if(newValue!=null) getCollection(newValue).Add(target); + }); + } public bool Set(object target, T value, NotifierProperty property, Action postUpdateAction = null) { @@ -164,15 +176,9 @@ public bool Set(object target, T value, NotifierProperty property, Action(); + var old = isnew?default(T):entry.GetValue(); - if (entry.SetValue(value)) + if (isnew || entry.SetValue(value)) { postUpdateAction?.Invoke(old, value); OnPropertyChanged(new NotifierPropertyChangedEventArgs(property.Name, old, value)); @@ -201,8 +207,14 @@ public bool Update(NotifierProperty property) return false; } + + + private bool _subscribed = false; public void Subscribe(INotifyPropertyChanged n) { + if(_subscribed) throw new InvalidOperationException("Notifier subscribed twice"); + _subscribed = true; + foreach (var method in n.GetType().GetMethods()) { foreach (var triggedOn in method.GetCustomAttributes().OfType()) @@ -256,7 +268,5 @@ public void Subscribe(INotifyPropertyChanged n) } } } - - } } diff --git a/HLab/Notify-4/NotifierEntry.cs b/HLab/Notify-4/NotifierEntry.cs index f96975c7..337770b4 100644 --- a/HLab/Notify-4/NotifierEntry.cs +++ b/HLab/Notify-4/NotifierEntry.cs @@ -39,7 +39,7 @@ public NotifierEntry(Notifier notifier, NotifierProperty property, Func(T value) } } - Property.AddOneToMany(Value,value,Notifier.Target); + Property.AddOneToMany(Value,value, Notifier.Target); Value = value; return true; diff --git a/HLab/Notify-4/NotifierExt.cs b/HLab/Notify-4/NotifierExt.cs index a53104bc..e5f37621 100644 --- a/HLab/Notify-4/NotifierExt.cs +++ b/HLab/Notify-4/NotifierExt.cs @@ -252,12 +252,12 @@ void H(object sender, NotifyCollectionChangedEventArgs args) n.CollectionChanged += H; } - public static void SubscribeOneToMany( - this object target, - IList list, - string property) - { - NotifierService.D.GetNotifierClass(typeof(T)).GetProperty(property).RegisterOneToMany(target,(IList)list); - } + //public static void SubscribeOneToMany( + // this object target, + // IList list, + // string property) + //{ + // NotifierService.D.GetNotifierClass(typeof(T)).GetProperty(property).RegisterOneToMany(target,(IList)list); + //} } } \ No newline at end of file diff --git a/HLab/Notify-4/NotifierHandler.cs b/HLab/Notify-4/NotifierHandler.cs index c0a07bdd..037f80b2 100644 --- a/HLab/Notify-4/NotifierHandler.cs +++ b/HLab/Notify-4/NotifierHandler.cs @@ -23,6 +23,8 @@ You should have received a copy of the GNU General Public License using System; using System.ComponentModel; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using System.Windows.Threading; namespace HLab.Notify @@ -65,6 +67,10 @@ public void OnPropertyChanged(PropertyChangedEventArgs args) { d.Dispatcher.BeginInvoke(DispatcherPriority.DataBind, new Action(() => handler(_target, args))); + + //var uiContext = TaskScheduler.FromCurrentSynchronizationContext(); + //Task.Factory.StartNew(() => handler(_target, args), CancellationToken.None, TaskCreationOptions.None, uiContext); + } else { diff --git a/HLab/Notify-4/NotifierObject.cs b/HLab/Notify-4/NotifierObject.cs index d6a7655c..337c154f 100644 --- a/HLab/Notify-4/NotifierObject.cs +++ b/HLab/Notify-4/NotifierObject.cs @@ -22,12 +22,14 @@ public event PropertyChangedEventHandler PropertyChanged remove => this.Remove(value); } - protected NotifierObject() + protected NotifierObject(bool init = true) { - _notifier = new Lazy(()=>NotifierService.D.GetNotifier(this)) ; + //_notifier = new Lazy(()=>NotifierService.D.GetNotifier(this)) ; + Notifier = NotifierService.D.GetNotifier(this); + if(init) Notifier.Subscribe(this); } - private readonly Lazy _notifier; - public Notifier Notifier => _notifier.Value; + //private readonly Lazy _notifier; + public Notifier Notifier { get; }//=> _notifier.Value; } } diff --git a/HLab/Notify-4/NotifierObjectExt.cs b/HLab/Notify-4/NotifierObjectExt.cs index c81559c8..0b1c0494 100644 --- a/HLab/Notify-4/NotifierObjectExt.cs +++ b/HLab/Notify-4/NotifierObjectExt.cs @@ -35,6 +35,14 @@ public static bool Set(this INotifierObject n, [CallerMemberName] string propertyName = null) => n.Notifier.Set(n, value, propertyName, null); + public static bool SetOneToMany(this TNotifier n, + T value, + Func> getCollection, + [CallerMemberName] string propertyName = null) + where TNotifier : INotifierObject + + => n.Notifier.SetOneToMany(n, value, getCollection, propertyName); + //public static void Subscribe(this INotifierObject n) => n.Notifier.Subscribe(n); } } diff --git a/HLab/Notify-4/NotifierProperty.cs b/HLab/Notify-4/NotifierProperty.cs index 27925d07..a010aea3 100644 --- a/HLab/Notify-4/NotifierProperty.cs +++ b/HLab/Notify-4/NotifierProperty.cs @@ -32,7 +32,6 @@ public void RegisterOneToMany(object target, IList list) public void AddOneToMany(object oldValue, object newValue, object target) { - if (Name == "Group") { } if (oldValue!=null && _weakOneToMany.TryGetValue(oldValue, out var oldCollection)) { @@ -40,6 +39,8 @@ public void AddOneToMany(object oldValue, object newValue, object target) } if (newValue!=null && _weakOneToMany.TryGetValue(newValue, out var newCollection)) { + if(target.GetType().Name=="MatchersGroup") { } + if (Name == "Group") { } newCollection.Add(target); } } diff --git a/HLab/Notify-4/PersistentNotifier.cs b/HLab/Notify-4/PersistentNotifier.cs index 69ae9897..d5590c39 100644 --- a/HLab/Notify-4/PersistentNotifier.cs +++ b/HLab/Notify-4/PersistentNotifier.cs @@ -56,11 +56,30 @@ public class Persister protected readonly ConcurrentBag Dirty = new ConcurrentBag(); public bool IsDirty => Dirty.Count > 0; + public bool Loading { get; private set; } = false; private readonly object _source; public Persister(INotifyPropertyChanged obj) { _source = obj; + foreach (var property in _source.GetType().GetProperties()) + { + foreach (var unused in property.GetCustomAttributes().OfType()) + { + Dirty.Add(property); + //switch (attr.Persistency) + //{ + // case Persistency.OnChange: + // Save(property); + // break; + // case Persistency.OnSave: + // Dirty.Add(property); + // break; + // default: + // throw new ArgumentOutOfRangeException(); + //} + } + } obj.PropertyChanged += Obj_PropertyChanged; } @@ -98,6 +117,8 @@ public virtual void Save() public virtual void Load() { + Loading = true; + foreach (var property in _source.GetType().GetProperties()) { foreach (var unused in property.GetCustomAttributes().OfType()) @@ -106,6 +127,8 @@ public virtual void Load() } } while(Dirty.TryTake(out var unused2)); + + Loading = false; } protected void Load(PropertyInfo property) diff --git a/HLab/Plugin/HLab.Plugin.csproj b/HLab/Plugin/HLab.Plugin.csproj index 2a48bd1e..a819eed5 100644 --- a/HLab/Plugin/HLab.Plugin.csproj +++ b/HLab/Plugin/HLab.Plugin.csproj @@ -96,6 +96,7 @@ + diff --git a/HLab/Plugin/PluginService.cs b/HLab/Plugin/PluginService.cs index ea4a735c..af154663 100644 --- a/HLab/Plugin/PluginService.cs +++ b/HLab/Plugin/PluginService.cs @@ -25,11 +25,12 @@ You should have received a copy of the GNU General Public License using System.IO; using System.Linq; using System.Reflection; +using HLab.Base; using HLab.Mvvm; namespace HLab.Plugin { - public class PluginService : HLab.Base.Singleton + public class PluginService : Singleton { private readonly List _modules = new List(); public void Register() diff --git a/HLab/Plugin/app.config b/HLab/Plugin/app.config new file mode 100644 index 00000000..724d290a --- /dev/null +++ b/HLab/Plugin/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/HLab/Windows.Monitors/DisplayDevice.cs b/HLab/Windows.Monitors/DisplayDevice.cs index 9b96a7ca..cd6a57e5 100644 --- a/HLab/Windows.Monitors/DisplayDevice.cs +++ b/HLab/Windows.Monitors/DisplayDevice.cs @@ -35,7 +35,7 @@ namespace HLab.Windows.Monitors { public class DisplayDevice : NotifierObject { - public DisplayDevice(MonitorsService service) + public DisplayDevice(MonitorsService service) : base(false) { Service = service; this.SubscribeNotifier(); diff --git a/HLab/Windows.Monitors/HLab.Windows.Monitors.csproj b/HLab/Windows.Monitors/HLab.Windows.Monitors.csproj index 38430646..df8a2f82 100644 --- a/HLab/Windows.Monitors/HLab.Windows.Monitors.csproj +++ b/HLab/Windows.Monitors/HLab.Windows.Monitors.csproj @@ -73,7 +73,16 @@ + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.dll + + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.CollectionsV3.dll + + + ..\..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll + @@ -119,6 +128,7 @@ + diff --git a/HLab/Windows.Monitors/Monitor.cs b/HLab/Windows.Monitors/Monitor.cs index 44ca2f1f..8ec17cfb 100644 --- a/HLab/Windows.Monitors/Monitor.cs +++ b/HLab/Windows.Monitors/Monitor.cs @@ -194,10 +194,10 @@ internal set private NativeMethods.PHYSICAL_MONITOR[] _pPhysicalMonitorArray; - public Monitor(MonitorsService service) + public Monitor(MonitorsService service):base(false) { Service = service; - this.SubscribeNotifier(); + Notifier.Subscribe(this); } [TriggedOn(nameof(HMonitor))] diff --git a/HLab/Windows.Monitors/MonitorsService.cs b/HLab/Windows.Monitors/MonitorsService.cs index 58a75eae..ee5a7115 100644 --- a/HLab/Windows.Monitors/MonitorsService.cs +++ b/HLab/Windows.Monitors/MonitorsService.cs @@ -65,6 +65,7 @@ private MonitorsService() public ObservableCollection Devices => this.Get(() => new ObservableCollection()); + public ObservableCollection Monitors => this.Get(() => new ObservableCollection()); [TriggedOn(nameof(Monitors),"Item","AttachedToDesktop")] diff --git a/HLab/Windows.Monitors/PhysicalAdapter.cs b/HLab/Windows.Monitors/PhysicalAdapter.cs index b1424515..ddbc8205 100644 --- a/HLab/Windows.Monitors/PhysicalAdapter.cs +++ b/HLab/Windows.Monitors/PhysicalAdapter.cs @@ -10,7 +10,7 @@ namespace HLab.Windows.Monitors { public class PhysicalAdapter : NotifierObject { - public PhysicalAdapter(MonitorsService service) + public PhysicalAdapter(MonitorsService service) : base(false) { Service = service; this.SubscribeNotifier(); diff --git a/HLab/Windows.Monitors/app.config b/HLab/Windows.Monitors/app.config new file mode 100644 index 00000000..724d290a --- /dev/null +++ b/HLab/Windows.Monitors/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/HLab/Windows.Monitors/packages.config b/HLab/Windows.Monitors/packages.config index 83bba8a9..447d1af9 100644 --- a/HLab/Windows.Monitors/packages.config +++ b/HLab/Windows.Monitors/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/LittleBigMouse/Control.Core/LittleBigMouse.Control.Core.csproj b/LittleBigMouse/Control.Core/LittleBigMouse.Control.Core.csproj index ff0cb721..8995fad9 100644 --- a/LittleBigMouse/Control.Core/LittleBigMouse.Control.Core.csproj +++ b/LittleBigMouse/Control.Core/LittleBigMouse.Control.Core.csproj @@ -73,11 +73,26 @@ + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.dll + + + ..\..\packages\Swordfish.NET.CollectionsV3.3.0.0.1\lib\net45\Swordfish.NET.CollectionsV3.dll + + + ..\..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll + + + + + + + diff --git a/LittleBigMouse/Control.Core/MainViewModel.cs b/LittleBigMouse/Control.Core/MainViewModel.cs index 561035bb..a7ad4b74 100644 --- a/LittleBigMouse/Control.Core/MainViewModel.cs +++ b/LittleBigMouse/Control.Core/MainViewModel.cs @@ -42,11 +42,11 @@ You should have received a copy of the GNU General Public License namespace LittleBigMouse.Control.Core { - public class MainViewModel : ViewModel + public class MainViewModel : NotifierObject { - public MainViewModel() + public MainViewModel() : base() { - this.SubscribeNotifier(); + //this.SubscribeNotifier(); } public ScreenConfig Config diff --git a/LittleBigMouse/Control.Core/MultiScreensViewModel.cs b/LittleBigMouse/Control.Core/MultiScreensViewModel.cs index 12d91aab..20272041 100644 --- a/LittleBigMouse/Control.Core/MultiScreensViewModel.cs +++ b/LittleBigMouse/Control.Core/MultiScreensViewModel.cs @@ -29,9 +29,9 @@ You should have received a copy of the GNU General Public License namespace LittleBigMouse.Control.Core { - public class MultiScreensViewModel : ViewModel, IPresenterViewModel + public class MultiScreensViewModel : NotifierObject, IPresenterViewModel { - public MultiScreensViewModel() + public MultiScreensViewModel() : base(false) { this.SubscribeNotifier(); } diff --git a/LittleBigMouse/Control.Core/ScreenFrameView.xaml b/LittleBigMouse/Control.Core/ScreenFrameView.xaml index 6d38704b..b4348c66 100644 --- a/LittleBigMouse/Control.Core/ScreenFrameView.xaml +++ b/LittleBigMouse/Control.Core/ScreenFrameView.xaml @@ -124,7 +124,7 @@ Grid.Column="1" FontWeight="Black" Opacity="0.75" - Content="{Binding Path=Model.PnpDeviceName, FallbackValue=Unknown}"> + Content="{Binding Path=Model.ScreenModel.PnpDeviceName, FallbackValue=Unknown}"> + + + + \ No newline at end of file diff --git a/LittleBigMouse/Control.Core/packages.config b/LittleBigMouse/Control.Core/packages.config index d3a5e1c3..575a1c42 100644 --- a/LittleBigMouse/Control.Core/packages.config +++ b/LittleBigMouse/Control.Core/packages.config @@ -2,4 +2,6 @@ + + \ No newline at end of file diff --git a/LittleBigMouse/Control.Loader/App.config b/LittleBigMouse/Control.Loader/App.config index 71fd1198..76fb297a 100644 --- a/LittleBigMouse/Control.Loader/App.config +++ b/LittleBigMouse/Control.Loader/App.config @@ -16,11 +16,15 @@ Sample license text. + + + + - + diff --git a/LittleBigMouse/Control.Loader/App.xaml.cs b/LittleBigMouse/Control.Loader/App.xaml.cs index 909c1e6c..22e7376c 100644 --- a/LittleBigMouse/Control.Loader/App.xaml.cs +++ b/LittleBigMouse/Control.Loader/App.xaml.cs @@ -21,7 +21,6 @@ You should have received a copy of the GNU General Public License http://www.mgth.fr */ using System.Windows; -using HLab.Mvvm; using HLab.Plugin; namespace LittleBigMouse_Control @@ -34,7 +33,6 @@ public partial class App : Application protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); - PluginService.D.Register(); } } diff --git a/LittleBigMouse/Control.Loader/LittleBigMouse.Control.Loader.csproj b/LittleBigMouse/Control.Loader/LittleBigMouse.Control.Loader.csproj index e90c71e8..9d5c774f 100644 --- a/LittleBigMouse/Control.Loader/LittleBigMouse.Control.Loader.csproj +++ b/LittleBigMouse/Control.Loader/LittleBigMouse.Control.Loader.csproj @@ -101,12 +101,19 @@ true + + + + + 4.0 + + diff --git a/LittleBigMouse/Daemon/App.config b/LittleBigMouse/Daemon/App.config index bffe2395..bb66f80e 100644 --- a/LittleBigMouse/Daemon/App.config +++ b/LittleBigMouse/Daemon/App.config @@ -1,9 +1,17 @@ - + - + + + + + + + + + diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/LocationControlViewModel.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/LocationControlViewModel.cs index 8fcfcae4..3805f309 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/LocationControlViewModel.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/LocationControlViewModel.cs @@ -37,7 +37,7 @@ You should have received a copy of the GNU General Public License using LittleBigMouse.ScreenConfigs; using Newtonsoft.Json; using Formatting = System.Xml.Formatting; -using Tester = LittleBigMouse.LocationPlugin.Plugins.Location.Rulers.Tester; +using Tester = LittleBigMouse.Plugin.Location.Plugins.Location.Rulers.Tester; namespace LittleBigMouse.Plugin.Location.Plugins.Location { diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerPanelViewModel.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerPanelViewModel.cs index 0df7e85c..4ec8621c 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerPanelViewModel.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerPanelViewModel.cs @@ -23,13 +23,14 @@ You should have received a copy of the GNU General Public License using System.Windows; using HLab.Mvvm; using HLab.Notify; +using LittleBigMouse.Plugin.Location.Plugins.Location.Rulers; using LittleBigMouse.ScreenConfigs; namespace LittleBigMouse.LocationPlugin.Plugins.Location.Rulers { - public class RulerPanelViewModel : ViewModel + public class RulerPanelViewModel : NotifierObject { - public RulerPanelViewModel(Screen screen, Screen drawOn) + public RulerPanelViewModel(Screen screen, Screen drawOn) : base() { using (this.Suspend()) { diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerView.xaml.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerView.xaml.cs index a3d205c4..28ceebac 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerView.xaml.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerView.xaml.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License using System.Windows.Input; using System.Windows.Interop; using HLab.Windows.API; +using LittleBigMouse.Plugin.Location.Plugins.Location.Rulers; namespace LittleBigMouse.LocationPlugin.Plugins.Location.Rulers { diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewModel.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewModel.cs index 54e34afa..4ac21ea9 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewModel.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewModel.cs @@ -20,26 +20,27 @@ You should have received a copy of the GNU General Public License mailto:mathieu@mgth.fr http://www.mgth.fr */ + using System; using System.Windows; using System.Windows.Media; -using HLab.Mvvm; using HLab.Notify; using LittleBigMouse.ScreenConfigs; -namespace LittleBigMouse.LocationPlugin.Plugins.Location.Rulers +namespace LittleBigMouse.Plugin.Location.Plugins.Location.Rulers { - public class RulerViewModel : ViewModel + public class RulerViewModel : NotifierObject { - public RulerViewModel(Screen screen, Screen drawOn, RulerSide side) + public Screen Screen { get; } + public RulerSide Side { get; } + public Screen DrawOn { get; } + + public RulerViewModel(Screen screen, Screen drawOn, RulerSide side) : base(false) { + Side = side; + Screen = screen; + DrawOn = drawOn; this.SubscribeNotifier(); - using (this.Suspend()) - { - Side = side; - Screen = screen; - DrawOn = drawOn; - } } public enum RulerSide { @@ -48,25 +49,12 @@ public enum RulerSide Left, Right } - public RulerSide Side - { - get => this.Get(); set => this.Set(value); - } + public bool Enabled { get => this.Get(); set => this.Set(value); } - public Screen DrawOn - { - get => this.Get(); - set => this.Set(value); - } - public Screen Screen - { - get => this.Get(); - set => this.Set(value); - } [TriggedOn(nameof(RatioX))] [TriggedOn(nameof(DrawOn), "XMoving")] diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewTop.xaml.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewTop.xaml.cs index d332c65c..7f472953 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewTop.xaml.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/RulerViewTop.xaml.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License using System.Windows; using System.Windows.Controls; using System.Windows.Media; +using LittleBigMouse.Plugin.Location.Plugins.Location.Rulers; namespace LittleBigMouse.LocationPlugin.Plugins.Location.Rulers { diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/Tester.xaml b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/Tester.xaml index d8929b6d..a97254cd 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/Tester.xaml +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/Tester.xaml @@ -1,4 +1,4 @@ - /// Logique d'interaction pour Tester.xaml diff --git a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/TesterViewModel.cs b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/TesterViewModel.cs index 71943f82..f8f12e2a 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/TesterViewModel.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Location/Rulers/TesterViewModel.cs @@ -20,12 +20,12 @@ You should have received a copy of the GNU General Public License mailto:mathieu@mgth.fr http://www.mgth.fr */ -using HLab.Mvvm; + using HLab.Notify; -namespace LittleBigMouse.LocationPlugin.Plugins.Location.Rulers +namespace LittleBigMouse.Plugin.Location.Plugins.Location.Rulers { - public class TesterViewModel : ViewModel + public class TesterViewModel : NotifierObject { public double LeftInDip { diff --git a/LittleBigMouse/Plugin/Location/Plugins/Size/SizeScreenView.xaml b/LittleBigMouse/Plugin/Location/Plugins/Size/SizeScreenView.xaml index 622316fd..fe50b253 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Size/SizeScreenView.xaml +++ b/LittleBigMouse/Plugin/Location/Plugins/Size/SizeScreenView.xaml @@ -114,7 +114,7 @@ - + diff --git a/LittleBigMouse/Plugin/Location/Plugins/Size/SizeViewModel.cs b/LittleBigMouse/Plugin/Location/Plugins/Size/SizeViewModel.cs index 51cd8da5..10ea94f8 100644 --- a/LittleBigMouse/Plugin/Location/Plugins/Size/SizeViewModel.cs +++ b/LittleBigMouse/Plugin/Location/Plugins/Size/SizeViewModel.cs @@ -20,22 +20,22 @@ You should have received a copy of the GNU General Public License mailto:mathieu@mgth.fr http://www.mgth.fr */ + using System; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Effects; using HLab.Mvvm; using HLab.Notify; +using LittleBigMouse.LocationPlugin.Plugins.Size; using LittleBigMouse.ScreenConfigs; -namespace LittleBigMouse.LocationPlugin.Plugins.Size +namespace LittleBigMouse.Plugin.Location.Plugins.Size { - class ScreenSizeViewModel : ViewModel, IViewModel + class ScreenSizeViewModel : ViewModel //ScreenControlViewModel { - public Screen Model => this.GetModel(); - - public ScreenSizeViewModel() + public ScreenSizeViewModel() : base(false) { var canvas = new Canvas { Effect = _effect }; diff --git a/LittleBigMouse/Plugin/Location/app.config b/LittleBigMouse/Plugin/Location/app.config index 2bbe7715..d28e69cf 100644 --- a/LittleBigMouse/Plugin/Location/app.config +++ b/LittleBigMouse/Plugin/Location/app.config @@ -6,6 +6,10 @@ + + + + \ No newline at end of file diff --git a/LittleBigMouse/Plugin/Vcp/VcpControlViewModel.cs b/LittleBigMouse/Plugin/Vcp/VcpControlViewModel.cs index 4761b752..bf97f870 100644 --- a/LittleBigMouse/Plugin/Vcp/VcpControlViewModel.cs +++ b/LittleBigMouse/Plugin/Vcp/VcpControlViewModel.cs @@ -21,10 +21,11 @@ You should have received a copy of the GNU General Public License http://www.mgth.fr */ using HLab.Mvvm; +using HLab.Notify; namespace LittleBigMouse.Plugin.Vcp { - class VcpControlViewModel : ViewModel + class VcpControlViewModel : NotifierObject { } } diff --git a/LittleBigMouse/Plugin/Vcp/VcpPlugin.cs b/LittleBigMouse/Plugin/Vcp/VcpPlugin.cs index c62fd8f7..faf04458 100644 --- a/LittleBigMouse/Plugin/Vcp/VcpPlugin.cs +++ b/LittleBigMouse/Plugin/Vcp/VcpPlugin.cs @@ -33,11 +33,9 @@ class VcpPlugin : PluginModule { public override void Register() { -#if DEBUG MainService.D.MainViewModel.AddButton(IconService.D.GetIcon("IconVcp"),"Vcp control", () => MainService.D.MainViewModel.Presenter.ViewMode = typeof(ViewModeScreenVcp), () => MainService.D.MainViewModel.Presenter.ViewMode = typeof(ViewModeDefault)); -#endif } } } diff --git a/LittleBigMouse/Plugin/Vcp/VcpScreenView.xaml b/LittleBigMouse/Plugin/Vcp/VcpScreenView.xaml index fc947a05..5d3145fe 100644 --- a/LittleBigMouse/Plugin/Vcp/VcpScreenView.xaml +++ b/LittleBigMouse/Plugin/Vcp/VcpScreenView.xaml @@ -17,7 +17,7 @@ - + @@ -44,7 +44,7 @@ --> - +