Beispiel #1
0
        public LayoutPropertyEditorViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            bool IsModeEditor = (bool)settings[0];

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

            NameUC = (string)settings[1];

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

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

            SelectedSwitchRotation = (SwitchRotation)((int[])settings[2])[4];

            Factor = height / width;

            Width  = width;
            Height = height;



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

            Name = "Layout";
        }
        public MainShellViewModel(IResultFactory resultFactory,
                                  IEventAggregator eventAggregator,
                                  MainMenuViewModel mainMenuViewModel,
                                  MainToolBarTrayViewModel mainToolBarViewModel,
                                  IEnumerable <PanelViewModel> panels,
                                  ISettingsManager settingsManager,
                                  IFileSystem fileSystem,
                                  IPersistanceManager persistanceManager,
                                  IPaths paths,
                                  IPortable portable
                                  )
            : base(resultFactory)
        {
            this.eventAggregator = eventAggregator;
            eventAggregator.Subscribe(this);

            this.persistanceManager = persistanceManager;
            this.settingsManager    = settingsManager;
            this.fileSystem         = fileSystem;
            this.paths = paths;

            Menu        = mainMenuViewModel;
            ToolBarTray = mainToolBarViewModel;

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

            mainMenuViewModel.NewProfile();
        }
        public ToolBoxViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            eventAggregator.Subscribe(this);
            Title = "ToolBox - Select the DeviceType";

            //var t = GetNamespacesInAssembly(Assembly.GetExecutingAssembly());
            //Type[] typelist = GetTypesInNamespace(Assembly.GetExecutingAssembly(), "CockpitBuilder.Plugins.");
            //List<string> finallist = typelist.Select(x => x.ToString().Replace("CockpitBuilder.Plugins.", "").Replace("_ViewModel", "")).ToList();

            //DeviceTypes = new BindableCollection<string>(finallist  );
            //selectedDeviceType = DeviceTypes[0];

            //Type[] GetTypesInNamespace(Assembly assembly, string nameSpace)
            //{
            //    double f = 0;

            //    return
            //        assembly.GetTypes()
            //            .Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal) && t.FullName.EndsWith("_ViewModel"))
            //            .ToArray();
            //}

            LoadImage(@"J:\heliosDevices\Images");
        }
Beispiel #4
0
        public ThreeWayToggleSwitchAppearanceEditorViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            bool IsModeEditor = (bool)settings[0];

            if (IsModeEditor)
            {
                var view = ViewLocator.LocateForModel(this, null, null);
                ViewModelBinder.Bind(this, view, null);
            }
            NameUC = (string)settings[1];

            var index = 3;

            PositionImage0 = ((string[])settings[index])[0];
            PositionImage1 = ((string[])settings[index])[1];
            PositionImage2 = ((string[])settings[index])[2];

            PositionIndicatorImage0 = ((string[])settings[index])[3];
            PositionIndicatorImage1 = ((string[])settings[index])[4];
            PositionIndicatorImage2 = ((string[])settings[index++])[5];
            IndexImage = (int)settings[index++];

            Has3Images   = !string.IsNullOrEmpty(PositionImage2);
            hasIndicator = !string.IsNullOrEmpty(PositionIndicatorImage0);

            //Has3Images = true;
            //HasIndicator = false;
            this.eventAggregator = eventAggregator;
            eventAggregator.Subscribe(this);

            Name = "Appareance";
        }
Beispiel #5
0
 public MainMenuViewModel(IResultFactory resultFactory,
                          IEventAggregator eventAggregator,
                          IFileSystem fileSystem,
                          Func <MonitorViewModel> scriptEditorFactory,
                          ProfileDialogStrategy profileDialogStrategy,
                          ISettingsManager settings)
 {
     this.resultFactory         = resultFactory;
     this.eventAggregator       = eventAggregator;
     this.scriptEditorFactory   = scriptEditorFactory;
     this.fileSystem            = fileSystem;
     this.profileDialogStrategy = profileDialogStrategy;
 }
        public Switch1_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            Layout     = new LayoutPropertyEditorViewModel(eventAggregator, settings);
            Appearance = new ThreeWayToggleSwitchAppearanceEditorViewModel(eventAggregator, settings);
            Behavior   = new ThreeWayToggleSwitchBehaviorEditorViewModel(eventAggregator, settings);

            NameUC = (string)settings[1];

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

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);
        }
Beispiel #7
0
        public MonitorPropertyEditorViewModel(IEventAggregator eventAggregator)
        {
            var view = ViewLocator.LocateForModel(this, null, null);

            ViewModelBinder.Bind(this, view, null);

            this.eventAggregator = eventAggregator;
            Name             = "Monitor";
            FillBackground   = false;
            BackgroundColor  = Colors.Gray;
            BackgroundColor1 = color1;
            BackgroundColor2 = color2;

            eventAggregator.Subscribe(this);
        }
Beispiel #8
0
        public PushButton_ViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            Layout     = new LayoutPropertyEditorViewModel(eventAggregator, settings);
            Appearance = new PushButtonAppearanceEditorViewModel(eventAggregator, settings);
            Behavior   = new PushButtonBehaviorEditorViewModel(eventAggregator, settings);


            NameUC = (string)settings[1];


            //Frame = false;

            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);
        }
Beispiel #9
0
        public MainToolBarTrayViewModel(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);

            eventAggregator.Subscribe(this);
        }
        public PreviewTabViewModel(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";
        }
Beispiel #11
0
        public PushButtonAppearanceEditorViewModel(IEventAggregator eventAggregator, params object[] settings)
        {
            bool IsModeEditor = (bool)settings[0];

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

            NameUC = (string)settings[1];

            HAlignTypes = Enum.GetValues(typeof(HorizontalAlignment)).Cast <HorizontalAlignment>().Take(3).ToList();
            VAlignTypes = Enum.GetValues(typeof(VerticalAlignment)).Cast <VerticalAlignment>().Take(3).ToList();
            var index = 3;

            Image       = ((string[])settings[index])[0];
            PushedImage = ((string[])settings[index++])[1];
            IndexImage  = (int)settings[index++];

            GlyphThickness          = (double)settings[index++];
            GlyphScale              = (double)settings[index++];
            SelectedPushButtonGlyph = (PushButtonGlyph)(int)settings[index++];
            GlyphColor              = (Color)settings[index++];
            GlyphText      = (string)settings[index++];
            TextPushOffset = (string)settings[index++];



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

            TextColor = (Color)settings[++index];

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

            Name = "Appearance";
        }
        public ThreeWayToggleSwitchBehaviorEditorViewModel(IEventAggregator eventAggregator, 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);
            }

            this.eventAggregator = eventAggregator;

            SwitchOrientation = Enum.GetValues(typeof(SwitchOrientation)).Cast <SwitchOrientation>().ToList();

            eventAggregator.Subscribe(this);

            Name = "Behavior";
        }
Beispiel #13
0
        public MonitorViewModel(IEventAggregator eventAggregator, IResolutionRoot resolutionRoot, FileSystem fileSystem, DisplayManager displayManager)
        {
            this.eventAggregator = eventAggregator;
            this.resolutionRoot  = resolutionRoot;

            this.DisplayManager = displayManager;
            MonitorCollection mc = DisplayManager.Displays;

            Monitor = mc[0];

            LayoutMonitor = new MonitorPropertyEditorViewModel(eventAggregator);

            this.fileSystem = fileSystem;

            this.eventAggregator.Publish(new MonitorViewStartedEvent(this));
            eventAggregator.Publish(new DisplayPropertiesView1Event(new[] { LayoutMonitor }));
            this.eventAggregator.Subscribe(this);
            MyCockpitViewModels = new ObservableCollection <PluginModel>();

            NbrSelected = 0;
        }
 public MainToolBarTrayViewModel(IEventAggregator eventAggregator)
 {
     AlignBottom = new RelayCommand(o => cmdAlignBottom(), o => true);
 }
        public PropertiesTabViewModel(IEventAggregator eventAggregator, IResolutionRoot resolutionRoot)
        {
            this.eventAggregator = eventAggregator;
            this.resolutionRoot  = resolutionRoot;
            ViewModels           = new Dictionary <string, PropertyEditorModel>();
            Title = "Properties";



            //CreateNewInstancePropertyModel("CockpitBuilder.Common.PropertyEditors.MonitorPropertyEditorViewModel", true);
            //CreateNewInstancePropertyModel("CockpitBuilder.Common.PropertyEditors.LayoutPropertyEditorViewModel");

            //var typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.MonitorPropertyEditorViewModel");
            ////Ninject.Parameters.Parameter[] param = { new ConstructorArgument("tag", 0, true) };
            //var viewmodel = resolutionRoot.TryGet(typeClass);
            //var view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);



            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.LayoutPropertyEditorViewModel");
            ////Ninject.Parameters.Parameter[] param = { new ConstructorArgument("tag", 0, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);


            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.PushButtonAppearanceEditorViewModel");
            //Ninject.Parameters.Parameter[] param1 = { new ConstructorArgument("tag", 0, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param1);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);

            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.PushButtonBehaviorEditorViewModel");
            //Ninject.Parameters.Parameter[] param2 = { new ConstructorArgument("tag", 1, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param2);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);

            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.ThreeWayToggleSwitchAppearanceEditorViewModel");
            //Ninject.Parameters.Parameter[] param1 = { new ConstructorArgument("tag", 0, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param1);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);

            //typeClass = Type.GetType("CockpitBuilder.Views.Main.DockPanel.Panels.UserViewModel");
            //Ninject.Parameters.Parameter[] param1 = { new ConstructorArgument("tag", 0, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param1);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);

            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.ThreeWayToggleSwitchBehaviorEditorViewModel");
            //Ninject.Parameters.Parameter[] param2 = { new ConstructorArgument("tag", 1, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param2);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);

            //typeClass = Type.GetType("CockpitBuilder.Common.PropertyEditors.MonitorPropertyEditorViewModel");
            //Ninject.Parameters.Parameter[] param2 = { new ConstructorArgument("tag", 1, true) };
            //viewmodel = resolutionRoot.TryGet(typeClass, param2);
            //view = ViewLocator.LocateForModel(viewmodel, null, null);
            //ViewModelBinder.Bind(viewmodel, view, null);
            //PropertyViewModels.Add((PropertyEditorModel)viewmodel);
            //PropertyViewModels = new ObservableCollection<AboutViewModel> { "&é", "12", "azert" };

            this.eventAggregator.Subscribe(this);
        }