コード例 #1
0
ファイル: PlansViewModel.cs プロジェクト: saeednazari/Rubezh
		public PlansViewModel()
		{
			ServiceFactory.Events.GetEvent<NavigateToPlanElementEvent>().Subscribe(OnNavigate);
			ServiceFactory.Events.GetEvent<ShowElementEvent>().Subscribe(OnShowElement);
			ServiceFactory.Events.GetEvent<FindElementEvent>().Subscribe(OnFindElementEvent);
			ServiceFactory.Events.GetEvent<RegisterPlanPresenterEvent<Plan>>().Subscribe(OnRegisterPlanPresenter);
			ServiceFactory.Events.GetEvent<SelectPlanEvent>().Subscribe(OnSelectPlan);
			_initialized = false;
			PlanPresenters = new List<IPlanPresenter<Plan>>();
			PlanTreeViewModel = new PlanTreeViewModel(this);
			PlanDesignerViewModel = new PlanDesignerViewModel(this);
			PlanTreeViewModel.SelectedPlanChanged += SelectedPlanChanged;

			var isNotFirstTime = RegistrySettingsHelper.GetBool("Monitor.Plans.IsNotFirstTime");
			var planNavigationWidth = RegistrySettingsHelper.GetDouble("Monitor.Plans.SplitterDistance");
			if (!isNotFirstTime && planNavigationWidth == 0)
			{
				planNavigationWidth = 100;
			}
			PlanNavigationWidth = new GridLength(planNavigationWidth, GridUnitType.Pixel);
			ApplicationService.ShuttingDown += () =>
			{
				RegistrySettingsHelper.SetDouble("Monitor.Plans.SplitterDistance", PlanNavigationWidth.Value);
				RegistrySettingsHelper.SetBool("Monitor.Plans.IsNotFirstTime", true);
			};
		}
コード例 #2
0
ファイル: PlansViewModel.cs プロジェクト: xbadcode/Rubezh
		public PlansViewModel(List<IPlanPresenter<Plan, XStateClass>> planPresenters, LayoutPartPlansProperties properties)
		{
			_properties = properties ?? new LayoutPartPlansProperties { Type = LayoutPartPlansType.All };
			PlanPresenters = planPresenters;
			ServiceFactory.Events.GetEvent<NavigateToPlanElementEvent>().Subscribe(OnNavigate);
			ServiceFactory.Events.GetEvent<ShowElementEvent>().Subscribe(OnShowElement);
			ServiceFactory.Events.GetEvent<FindElementEvent>().Subscribe(OnFindElementEvent);
			ServiceFactory.Events.GetEvent<SelectPlanEvent>().Subscribe(OnSelectPlan);
			ServiceFactory.Events.GetEvent<ChangePlanPropertiesEvent>().Unsubscribe(OnChangePlanProperties);
			ServiceFactory.Events.GetEvent<ChangePlanPropertiesEvent>().Subscribe(OnChangePlanProperties);
			ServiceFactory.Events.GetEvent<ControlPlanEvent>().Unsubscribe(OnControlPlan);
			ServiceFactory.Events.GetEvent<ControlPlanEvent>().Subscribe(OnControlPlan);

			_initialized = false;
			if (_properties.Type != LayoutPartPlansType.Single)
			{
				PlanTreeViewModel = new PlanTreeViewModel(this, _properties.Type == LayoutPartPlansType.Selected ? _properties.Plans : null, _properties.Type == LayoutPartPlansType.All);
				PlanTreeViewModel.SelectedPlanChanged += SelectedPlanChanged;
				var planNavigationWidth = RegistrySettingsHelper.GetDouble("Monitor.Plans.SplitterDistance");
				if (planNavigationWidth == 0)
					planNavigationWidth = 100;
				PlanNavigationWidth = new GridLength(planNavigationWidth, GridUnitType.Pixel);
				ApplicationService.ShuttingDown += () =>
				{
					RegistrySettingsHelper.SetDouble("Monitor.Plans.SplitterDistance", PlanNavigationWidth.Value);
				};
			}
			else
				PlanNavigationWidth = GridLength.Auto;
			PlanDesignerViewModel = new PlanDesignerViewModel(this, properties);
		}
コード例 #3
0
ファイル: DesignerCanvas.cs プロジェクト: xbadcode/Rubezh
		public DesignerCanvas(PlanDesignerViewModel planDesignerViewModel)
			: base(planDesignerViewModel)
		{
			var editItem = DesignerCanvasHelper.BuildMenuItem(
				"Редактировать",
				"BEdit",
				planDesignerViewModel.PlansViewModel.EditCommand
			);
			ContextMenu.Items.Add(editItem);
		}
コード例 #4
0
ファイル: DesignerCanvas.cs プロジェクト: saeednazari/Rubezh
		public DesignerCanvas(PlanDesignerViewModel planDesignerViewModel)
			: base(planDesignerViewModel)
		{
			var editItem = DesignerCanvasHelper.BuildMenuItem(
				"Редактировать", 
				"pack://application:,,,/Controls;component/Images/BEdit.png", 
				planDesignerViewModel.PlansViewModel.EditCommand
			);
			ContextMenu.Items.Add(editItem);
		}
コード例 #5
0
ファイル: PlansViewModel.cs プロジェクト: hjlfmy/Rubezh
        public PlansViewModel()
        {
            ServiceFactory.Events.GetEvent<ShowElementEvent>().Subscribe(OnShowElement);
            ServiceFactory.Events.GetEvent<FindElementEvent>().Subscribe(OnShowElementDevice);

            AddCommand = new RelayCommand(OnAdd);
            AddSubPlanCommand = new RelayCommand(OnAddSubPlan, CanAddEditRemove);
            RemoveCommand = new RelayCommand(OnRemove, CanAddEditRemove);
            EditCommand = new RelayCommand(OnEdit, CanAddEditRemove);
            AddSubPlanCommand = new RelayCommand(OnAddSubPlan, CanAddEditRemove);

            DesignerCanvas = new DesignerCanvas();
            DesignerCanvas.Toolbox = new ToolboxViewModel(this);
            PlanDesignerViewModel = new PlanDesignerViewModel();
            PlanDesignerViewModel.DesignerCanvas = DesignerCanvas;

            InitializeCopyPaste();
            InitializeHistory();
            ElementsViewModel = new ElementsViewModel(DesignerCanvas);
            PlansTreeViewModel = new PlansTreeViewModel(this);
            CreatePages();
            _planExtensions = new List<Infrustructure.Plans.IPlanExtension<Plan>>();
            Menu = new PlansMenuViewModel(this);
        }