Пример #1
0
 public StartupViewModel(IWindowManager windowmanager, IEventAggregator eventAggregator, IResolutionRoot resolutionRoot, FileSystem fileSystem)
 {
     this.windowmanager   = windowmanager;
     this.eventAggregator = eventAggregator;
     this.resolutionRoot  = resolutionRoot;
     this.fileSystem      = fileSystem;
 }
Пример #2
0
        public Switch_ViewModel(IEventAggregator eventAggregator, SwitchAppearanceViewModel Appearance,
                                SwitchBehaviorViewModel Behavior,
                                LayoutPropertyViewModel Layout)
        {
            this.Layout     = Layout;
            this.Behavior   = Behavior;
            this.Appearance = Appearance;

            this.Appearance.Behavior = Behavior;

            this.eventAggregator = eventAggregator;

#if DEBUG
            System.Diagnostics.Debug.WriteLine($"entree {this} {Layout.NameUC}");
            var types = new System.Type[] { typeof(LayoutPropertyViewModel), Appearance.GetType(), Behavior.GetType() };
            DataContractSerializer dcs = new DataContractSerializer(GetType(), types);
            string buffer;
            using (var memStream = new MemoryStream())
            {
                dcs.WriteObject(memStream, this);
                buffer = Encoding.ASCII.GetString(memStream.GetBuffer()).TrimEnd('\0');
            }
            XmlDocument docxml = new XmlDocument();
            docxml.LoadXml(buffer);
            using (XmlTextWriter writer = new XmlTextWriter($@"j:\{this}.xml", null))
            {
                writer.Formatting = Formatting.Indented;
                docxml.Save(writer);
            }
#endif
        }
        public MainShellViewModel(IResultFactory resultFactory,
                                  IEventAggregator eventAggregator,
                                  IPersistanceManager persistanceManager,
                                  ISettingsManager settingsManager,
                                  MainMenuViewModel mainMenuViewModel,
                                  MainToolBarViewModel mainToolBarViewModel,
                                  IEnumerable <PanelViewModel> panels,
                                  IFileSystem fileSystem,
                                  ProfileDialogStrategy profileDialogStrategy,
                                  IPaths paths,
                                  IParser parser,
                                  IPortable portable
                                  )
            : base(resultFactory)
        {
            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);
            this.persistanceManager    = persistanceManager;
            this.settingsManager       = settingsManager;
            this.fileSystem            = fileSystem;
            this.profileDialogStrategy = profileDialogStrategy;
            this.paths  = paths;
            this.parser = parser;

            Profiles = new BindableCollection <MonitorViewModel>();
            Tools    = new BindableCollection <PanelViewModel>(panels);

            Menu       = mainMenuViewModel;
            Menu.Views = Tools;
            ToolBar    = mainToolBarViewModel;

            DisplayName = "CockpitBuilder";
        }
        public LayoutPropertyViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            NameUC = (string)settings[2];

            UCLeft = ((int[])settings[3])[0];
            UCTop  = ((int[])settings[3])[1];

            var width  = (double)((int[])settings[3])[2];
            var height = (double)((int[])settings[3])[3];

            SelectedSwitchRotation = (LayoutRotation)((int[])settings[3])[4];

            Factor = height / width;

            Width  = width;
            Height = height;

            this.eventAggregator = eventAggregator;

            bool IsModeEditor = (bool)settings[0];

            if (IsModeEditor)
            {
                eventAggregator.Subscribe(this);
            }

            Name = "Layout";
        }
        public A10Alt_ViewModel(IEventAggregator eventAggregator, A10AltAppearanceViewModel Appearance, LayoutPropertyViewModel Layout)
        {
            this.Layout = Layout;

            this.Appearance = Appearance;

            this.eventAggregator = eventAggregator;
        }
        public PropertiesViewModel(IEventAggregator eventAggregator, IResolutionRoot resolutionRoot)
        {
            this.eventAggregator = eventAggregator;
            this.resolutionRoot  = resolutionRoot;
            this.eventAggregator.Subscribe(this);

            ViewModels = new Dictionary <string, IPluginProperty>();

            Title    = "Property";
            IconName = "console-16.png";
        }
Пример #7
0
 public MonitorViewModel(IEventAggregator eventAggregator, IResolutionRoot resolutionRoot, FileSystem fileSystem)
 {
     this.eventAggregator = eventAggregator;
     this.resolutionRoot  = resolutionRoot;
     LayoutMonitor        = new MonitorPropertyViewModel(eventAggregator);
     MyPluginsContainer   = new BindableCollection <IPluginModel>();
     pluginTypes          = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())
                            .Where(t => (typeof(IPluginModel).IsAssignableFrom(t) || typeof(IPluginProperty).IsAssignableFrom(t)) && t.IsClass && !t.IsAbstract)
                            .GroupBy(x => x.Assembly).ToDictionary(d => d.Key, d => d.ToList());
     LoadFileContent(this);
 }
        public PushButton_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            Layout     = new LayoutPropertyViewModel(eventAggregator, settings);
            Appearance = new PushButtonAppearanceViewModel(settings);
            Behavior   = new PushButtonBehaviorViewModel(settings);

            NameUC = (string)settings[2];

            this.eventAggregator = eventAggregator;
            System.Diagnostics.Debug.WriteLine($"entree push {NameUC} {this}");
        }
Пример #9
0
 public TrayIconViewModel(IResultFactory resultFactory,
                          IEventAggregator eventAggregator,
                          MainShellViewModel shellViewModel,
                          ISettingsManager settingsManager
                          )
 {
     this.resultFactory   = resultFactory;
     this.shellViewModel  = shellViewModel;
     this.settingsManager = settingsManager;
     this.eventAggregator = eventAggregator;
     this.eventAggregator.Subscribe(this);
 }
        public ToolBoxViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;

            Title    = "ToolBox";
            IconName = "console-16.png";

            LoadThumb(@"J:\heliosDevices\Images");


            //MyPluginsContainer = new BindableCollection<PluginModel>();
        }
        public HSwitch_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            Layout     = new LayoutPropertyViewModel(eventAggregator, settings);
            Behavior   = new SwitchBehaviorViewModel(eventAggregator, settings);
            Appearance = new SwitchAppearanceViewModel(eventAggregator, Behavior, settings);

            NameUC = (string)settings[2];

            ////ScaleX = (double)settings[10];
            //ScaleX = 1;

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);
        }
 public MainToolBarViewModel(IEventAggregator eventAggregator)
 {
     AlignTop                   = new RelayCommand(o => cmdAlign(2), o => true);
     AlignBottom                = new RelayCommand(o => cmdAlign(3), o => true);
     AlignLeft                  = new RelayCommand(o => cmdAlign(4), o => true);
     AlignRight                 = new RelayCommand(o => cmdAlign(5), o => true);
     AlignHorizontalCenter      = new RelayCommand(o => cmdAlign(6), o => true);
     AlignVerticalCenter        = new RelayCommand(o => cmdAlign(7), o => true);
     DistributeHorizontalCenter = new RelayCommand(o => cmdAlign(8), o => true);
     DistributeVerticalCenter   = new RelayCommand(o => cmdAlign(9), o => true);
     SpaceHorizontal            = new RelayCommand(o => cmdAlign(10), o => true);
     SpaceVertical              = new RelayCommand(o => cmdAlign(11), o => true);
     EnableToolbar              = false;
     eventAggregator.Subscribe(this);
 }
        public A10Flaps_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            //Layout = new LayoutPropertyViewModel(eventAggregator: eventAggregator, settings: settings);
            //Appearance = new A10FlapsAppearanceViewModel(settings);
            //Behavior = new A10FlapsBehaviorViewModel(settings);

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            //ImageLight = settings.Image[1];
            //ImageFrame = settings.Image[0];
            //UCLeft = settings.Left;
            //UCTop = settings.Top;
            //ScaleX = settings.ScaleX;
        }
Пример #14
0
        //        public LayoutPropertyViewModel(IEventAggregator eventAggregator, object[] settings)
        //        {
        //            //  string NameUC = "", int UCLeft = 0, int UCTop = 0, int Width = 0, int Height = 0, int Angle = 0,
        //            //  double ParentScaleX = 1, double ParentScaleY = 1,
        //            //  double RealUCLeft = 0, double RealUCTop = 0, double RealWidth = 0, double RealHeight = 0,
        //            //  double WidthOriginal = 0, double HeightOriginal = 0, double ScaleX = 1, double ScaleY = 1,
        //            //  string[] Images = null, int StartImageIndex = 0

        //            NameUC = (string)settings[0];
        //            UCLeft = (int)settings[1];
        //            UCTop = (int)settings[2];
        //            Width = (int)settings[3];
        //            Height = (int)settings[4];
        //            IndexAngle = Array.FindIndex((int[])Enum.GetValues(typeof(LayoutRotation)), w => w == (int)settings[5]);

        //            ParentScaleX = (double)settings[6];
        //            ParentScaleY = (double)settings[7];
        ////--------------------------------------------------------------
        //            WidthOriginal = (int)Width;
        //            HeightOriginal = (int)Height;

        //            RealWidth = Width;
        //            RealHeight = Height;


        //            ScaleX = 1;
        //            ScaleY = 1;

        //            Factor = RealHeight / RealWidth;
        //            ScaleFactor = 1;

        //            RealUCLeft = UCLeft * ParentScaleX;
        //            RealUCTop = UCTop * ParentScaleY;

        //        }
        public LayoutPropertyViewModel(IEventAggregator eventAggregator, bool IsModeEditor = false, bool IsPanel = false, bool IsPluginDropped = false,
                                       string NameUC        = "", double UCLeft        = 0d, double UCTop = 0d, double Width = 0d, double Height = 0d,
                                       double ParentScaleX  = 1, double ParentScaleY   = 1, double AngleRotation = 0d,
                                       double RealUCLeft    = 0, double RealUCTop      = 0, double RealWidth     = 0, double RealHeight = 0,
                                       double WidthOriginal = 0, double HeightOriginal = 0, double ScaleX        = 1, double ScaleY     = 1)
        {
            this.NameUC = NameUC;

            Linked = true;
            PxPct  = true;

            this.UCLeft         = UCLeft;
            this.UCTop          = UCTop;
            this.Width          = Width;
            this.Height         = Height;
            this.WidthOriginal  = WidthOriginal;
            this.HeightOriginal = HeightOriginal;

            this.RealUCLeft = RealUCLeft;
            this.RealUCTop  = RealUCTop;
            this.RealWidth  = RealWidth;
            this.RealHeight = RealHeight;

            this.ParentScaleX = ParentScaleX;
            this.ParentScaleY = ParentScaleY;
            this.ScaleX       = ScaleX;
            this.ScaleY       = ScaleY;

            Factor      = RealHeight / RealWidth;
            ScaleFactor = ScaleY / ScaleX;

            this.ParentScaleX = ParentScaleX;
            this.ParentScaleY = ParentScaleY;

            this.RealUCLeft = UCLeft * ParentScaleX;
            this.RealUCTop  = UCTop * ParentScaleY;

            this.IndexAngle = Array.IndexOf(Enum.GetValues(typeof(LayoutRotation)), (LayoutRotation)AngleRotation);

            Name = "Layout";

            this.eventAggregator = eventAggregator;

            if (IsModeEditor)
            {
                eventAggregator.Subscribe(this);
            }
        }
        public PanelAppearanceViewModel(IEventAggregator eventAggregator, string[] BackgroundImages = null, string BackgroundColor = null, bool FillBackground = false,
                                        PanelSideApparition SelectedApparition = PanelSideApparition.FromLeft)
        {
            Apparitions             = Enum.GetValues(typeof(PanelSideApparition)).Cast <PanelSideApparition>().ToList();
            this.SelectedApparition = SelectedApparition;

            this.BackgroundImage = BackgroundImages[0];
            this.ColorBackground = BackgroundColor == null ? Colors.Gray : (Color)ColorConverter.ConvertFromString(BackgroundColor);
            this.FillBackground  = FillBackground;


            eventAggregator.Subscribe(this);

            Name = "Appearance";
            System.Diagnostics.Debug.WriteLine($"entree {this}");
        }
Пример #16
0
        public Panel_ViewModel(IEventAggregator eventAggregator, MonitorViewModel OriginPlugin,
                               PanelAppearanceViewModel Appearance, LayoutPropertyViewModel Layout, bool IsVisible = true)
        {
            this.OriginPlugin = OriginPlugin;

            this.IsVisible  = IsVisible;
            this.Layout     = Layout;
            this.Appearance = Appearance;

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            MyPluginsContainer = new BindableCollection <IPluginModel>();

            System.Diagnostics.Debug.WriteLine($"entree {this} {Layout.NameUC}");
        }
Пример #17
0
        public RotaryEncoderAppearanceViewModel(IEventAggregator eventAggregator, RotaryEncoder_ViewModel pm, params object[] settings)
        {
            //Behavior = behavior;
            RotarySwitchViewModel = pm;
            bool IsModeEditor = (bool)settings[0];

            if (IsModeEditor)
            {
            }
            NameUC = (string)settings[2];

            var index = 5;

            Image = (string)settings[index++];

            var nbrpoints = (int)settings[index++];

            var fontFamily = (string)settings[index++];
            var fontStyle  = (string)settings[index++];
            var fontWeight = (string)settings[index++];
            var fontSize   = (double)settings[index++];

            TextFormat = new TextFormat(fontFamily: fontFamily,
                                        fontStyle: fontStyle,                 //Normal, Oblique or Italic  see FontStyles
                                        fontWeight: fontWeight,               //Thin.... see FontWeight
                                        fontSize: fontSize,
                                        padding: (double[])settings[index++], //Padding L,T,R,B
                                        Alignment: (int[])settings[index++]   //Left, Center, Right and Top, center, Bottom
                                        );

            //LabelColor = (Color)settings[index++];
            LabelColor    = (Color)settings[index++];
            LabelDistance = (double)settings[index++];
            LineThickness = (double)settings[index++];
            LineColor     = (Color)settings[index++];
            LineLength    = (double)settings[index++];



            //var text = (string)settings[index++];
            //var textpushoffset = (string)settings[index++];

            this.eventAggregator = eventAggregator;
            eventAggregator.Subscribe(this);

            Name = "Appareance";
        }
Пример #18
0
        //public RotarySwitchBehaviorViewModel Behavior { get; }
        //public ObservableCollection<RotarySwitchPosition> RotarySwitchPositions { get; private set; }

        public RotaryEncoder_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            //RotarySwitchPositions = new ObservableCollection<RotarySwitchPosition>();

            //Layout = new LayoutPropertyViewModel(eventAggregator: eventAggregator, settings: settings);
            Appearance = new RotaryEncoderAppearanceViewModel(eventAggregator, this, settings);
            //Behavior = new RotarySwitchBehaviorViewModel(eventAggregator, this, settings);


            var s = Appearance.TextFormat.MeasureString("ABC", Appearance.LabelColor);


            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            ToolTip = "Superbe";
        }
Пример #19
0
        public MainMenuViewModel(IResultFactory resultFactory,
                                 IEventAggregator eventAggregator,
                                 Func <MonitorViewModel> profileEditorFactory,
                                 IFileSystem fileSystem,
                                 ProfileDialogStrategy profileDialogStrategy,
                                 ISettingsManager settings)
        {
            eventAggregator.Subscribe(this);

            this.resultFactory         = resultFactory;
            this.eventAggregator       = eventAggregator;
            this.profileEditorFactory  = profileEditorFactory;
            this.fileSystem            = fileSystem;
            this.profileDialogStrategy = profileDialogStrategy;
            this.settingsManager       = settings;

            RecentScripts = new BindableCollection <RecentFileViewModel>(ListRecentFiles());
        }
Пример #20
0
        public PreviewViewModel(IEventAggregator eventAggregator, DisplayManager DisplayManager)
        {
            this.DisplayManager = DisplayManager;
            MonitorCollection mc = DisplayManager.Displays;

            Monitor = mc[0];


            ZoomCalibration = new CalibrationPointCollectionDouble(-10d, 0.1d, 2d, 2d);
            ZoomCalibration.Add(new CalibrationPointDouble(0d, 1d));

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            Title     = "Preview";
            IconName  = "console-16.png";
            IsVisible = false;

            //ZoomPanelVisibility = Visibility.Collapsed;
        }
Пример #21
0
        public LayersViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            RootPluginItems = new BindableCollection <Item>();
            //RootPluginItems = new BindableCollection<object>()
            //{
            //    new PluginItem(){ NameUC = "p0", Type= "monitor"},
            //    new PluginItem(){ NameUC = "p00", Type= "monitor"},
            //    new ContainerItem()
            //    {
            //        NameUC = "container0",
            //        Type ="Container",
            //        Items = new BindableCollection<Item>()
            //        {
            //            new PluginItem(){ NameUC = "p0-0", Type= "monitor"},
            //            new PluginItem(){ NameUC = "p00-0", Type= "monitor"},
            //            new ContainerItem()
            //            {
            //                NameUC = "container0-0",
            //                Type ="Container",
            //                Items = new BindableCollection<Item>()
            //                {
            //                    new PluginItem(){ NameUC = "toto00", Type= "monitor"},
            //                    new PluginItem(){ NameUC = "titi00", Type= "monitor"},
            //                }
            //            }
            //        },
            //    },
            //    new PluginItem(){ NameUC = "a0", Type= "monitor"},
            //    new PluginItem(){ NameUC = "a00", Type= "monitor"},
            //};

            //var itemProvider = new ItemProvider();
            //DirItems = itemProvider.DirItems;

            Title    = "Layers";
            IconName = "console-16.png";
        }
        public MonitorPropertyViewModel(IEventAggregator eventAggregator)
        {
            AlignmentTypes = Enum.GetValues(typeof(ImageAlignment)).Cast <ImageAlignment>().ToList();

            //var view = ViewLocator.LocateForModel(this, null, null);
            //ViewModelBinder.Bind(this, view, null);

            this.eventAggregator = eventAggregator;
            eventAggregator.Subscribe(this);



            FillBackground        = false;
            ColorBackground       = Colors.Gray;
            BackgroundColor1      = color1;
            BackgroundColor2      = color2;
            BackgroundImage       = "";
            SelectedAlignmentType = ImageAlignment.Stretched;

            Name = "Monitor1";
            System.Diagnostics.Debug.WriteLine($"entree {this}");
        }
        public RotarySwitch_ViewModel(IEventAggregator eventAggregator, RotarySwitchAppearanceViewModel Appearance,
                                      RotarySwitchBehaviorViewModel Behavior,
                                      LayoutPropertyViewModel Layout)
        {
            RotarySwitchPositions = new ObservableCollection <RotarySwitchPosition>();

            this.Layout     = Layout;
            this.Behavior   = Behavior;
            this.Appearance = Appearance;


            var s = Appearance.TextFormat.MeasureString("ABC", Appearance.LabelColor);


            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);

            ToolTip = "Superbe";

#if DEBUG
            System.Diagnostics.Debug.WriteLine($"entree {this} {Layout.NameUC}");
            var types = new System.Type[] { typeof(LayoutPropertyViewModel), typeof(PushButtonAppearanceViewModel), typeof(PushButtonBehaviorViewModel) };
            DataContractSerializer dcs = new DataContractSerializer(typeof(PushButton_ViewModel), types);
            string buffer;
            using (var memStream = new MemoryStream())
            {
                dcs.WriteObject(memStream, this);
                buffer = Encoding.ASCII.GetString(memStream.GetBuffer()).TrimEnd('\0');
            }
            XmlDocument docxml = new XmlDocument();
            docxml.LoadXml(buffer);
            using (XmlTextWriter writer = new XmlTextWriter($@"j:\{this}.xml", null))
            {
                writer.Formatting = Formatting.Indented;
                docxml.Save(writer);
            }
#endif
        }
        public RotarySwitchBehaviorViewModel(IEventAggregator eventAggregator, RotarySwitch_ViewModel pm, params object[] settings)
        {
            var  index        = 0;
            bool IsModeEditor = (bool)settings[index++];

            if (IsModeEditor)
            {
                //var view = ViewLocator.LocateForModel(this, null, null);
                //ViewModelBinder.Bind(this, view, null);
            }
            Idx = 0;

            this.eventAggregator = eventAggregator;

            eventAggregator.Subscribe(this);

            Name                  = "Behavior";
            LineAngles            = "";
            RotarySwitchViewModel = pm;

            AddPosition("pos0", 0);
            AddPosition("pos1", 90);
            RotarySwitchPositionIndex = 1;
        }
Пример #25
0
 public ToolBoxGroup(IEventAggregator eventAggregator)
 {
     this.eventAggregator = eventAggregator;
     Translation          = new Point(0, 0);
     AnchorMouse          = new Point(0.5, 0.5);
 }
Пример #26
0
        public A10FuelQty_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            //Layout = new LayoutPropertyViewModel(eventAggregator: eventAggregator, settings: settings);

            this.eventAggregator = eventAggregator;
        }