private void button_EditPreset_Click(object sender, RoutedEventArgs e) { if (SelectedPreset != null) { AddPreset_Form editPresetForm = new AddPreset_Form(SelectedPreset, EFormInitializeType.Edit); var resault = editPresetForm.ShowDialog(); if (resault == true) { NotifyThatSavingsNeed(); } } }
//Events #region Buttons Events private void button_AddNewPreset_Click(object sender, RoutedEventArgs e) { DtoPreset presetToAdd = new DtoPreset("New Preset"); AddPreset_Form createPresetForm = new AddPreset_Form(presetToAdd); var resault = createPresetForm.ShowDialog(); if (resault.HasValue && resault == true) { var presetAdded = AddPreset(presetToAdd); if (presetAdded == true) { NotifyThatSavingsNeed(); } } }
//Events #region Eizo Config Events private void PluginConfig_EizoActionCalled(object sender, MVW_UserActionEventArgument <DtoMainConfiguration, EMVWActions> e) { #region SmartWall calls if (e.ActionType == EMVWActions.EditSmartWall && (e.ObjectCaller.GetType() == typeof(DtoSmartWall))) //Edit SmartWall { var tmpSmartWall = e.ObjectCaller as DtoSmartWall; if (tmpSmartWall != null) { var resault = EditSmartWall(tmpSmartWall); if (resault == true) { NotifyThatSavingsNeed(); } } } else if (e.ActionType == EMVWActions.RemoveSmartWall && (e.ObjectCaller.GetType() == typeof(DtoSmartWall))) //Remove SmartWall { var tmpSmartWall = e.ObjectCaller as DtoSmartWall; if (tmpSmartWall != null) { var resault = MessageBox.Show($"Are you sure want delete {tmpSmartWall.Name}", "Delete SmartWall", MessageBoxButton.YesNo, MessageBoxImage.Question); if (resault == MessageBoxResult.Yes) { var removedSmartWall = RemoveSmartWall(tmpSmartWall); if (removedSmartWall == true) { NotifyThatSavingsNeed(); } } } } else if (e.ActionType == EMVWActions.EditSmartWallLayout && (e.ObjectCaller.GetType() == typeof(DtoSmartWall))) //Remove SmartWall { var tmpSmartWall = e.ObjectCaller as DtoSmartWall; if (tmpSmartWall != null) { //SetActiveEditLayoutSmartWall(tmpSmartWall); } } #endregion #region Monitor calls else if (e.ActionType == EMVWActions.AddMonitor && (e.ObjectCaller.GetType() == typeof(DtoSmartWall))) //ADD Monitor { var tmpSmartWall = e.ObjectCaller as DtoSmartWall; if (tmpSmartWall != null) { DtoMonitor monitorToAdd = new DtoMonitor("New Monitor"); AddMonitor_Form createMonitorForm = new AddMonitor_Form(monitorToAdd); var resault = createMonitorForm.ShowDialog(); if (resault.HasValue && resault == true) { var monitorAdded = AddMonitor(monitorToAdd, tmpSmartWall); if (monitorAdded == true) { NotifyThatSavingsNeed(); } } } } else if (e.ActionType == EMVWActions.EditMonitor && (e.ObjectCaller.GetType() == typeof(DtoMonitor))) //EDIT Monitor { var tmpMonitor = e.ObjectCaller as DtoMonitor; if (tmpMonitor != null) { var resault = EditMonitor(tmpMonitor); if (resault == true) { NotifyThatSavingsNeed(); } } } else if (e.ActionType == EMVWActions.RemoveMonitor && (e.ObjectCaller.GetType() == typeof(DtoMonitor))) //REMOVE Monitor { var tmpMonitor = e.ObjectCaller as DtoMonitor; if (tmpMonitor != null) { var resault = MessageBox.Show($"Are you sure want delete {tmpMonitor.Name}", "Delete Monitor", MessageBoxButton.YesNo, MessageBoxImage.Question); if (resault == MessageBoxResult.Yes) { var removedMonitor = RemoveMonitor(tmpMonitor); if (removedMonitor == true) { NotifyThatSavingsNeed(); } } } } #endregion #region Preset calls else if (e.ActionType == EMVWActions.AddPreset && (e.ObjectCaller.GetType() == typeof(DtoSmartWall))) //Add Preset { var tmpSmartWall = e.ObjectCaller as DtoSmartWall; if (tmpSmartWall != null) { DtoPreset presetToAdd = new DtoPreset("New Preset"); AddPreset_Form createPresetForm = new AddPreset_Form(presetToAdd); var resault = createPresetForm.ShowDialog(); if (resault.HasValue && resault == true) { var monitorAdded = AddPreset(presetToAdd, tmpSmartWall); if (monitorAdded == true) { NotifyThatSavingsNeed(); } } } } else if (e.ActionType == EMVWActions.EditPreset && (e.ObjectCaller.GetType() == typeof(DtoPreset))) //Edit Preset { var tmpPreset = e.ObjectCaller as DtoPreset; if (tmpPreset != null) { var resault = EditPreset(tmpPreset); if (resault == true) { NotifyThatSavingsNeed(); } } } else if (e.ActionType == EMVWActions.RemovePreset && (e.ObjectCaller.GetType() == typeof(DtoPreset))) //Remove Preset { var tmpPreset = e.ObjectCaller as DtoPreset; if (tmpPreset != null) { var resault = MessageBox.Show($"Are you sure want delete {tmpPreset.Name}", "Delete Preset", MessageBoxButton.YesNo, MessageBoxImage.Question); if (resault == MessageBoxResult.Yes) { var removedMonitor = RemovePreset(tmpPreset); if (removedMonitor == true) { NotifyThatSavingsNeed(); } } } } #endregion else if (e.ActionType == EMVWActions.EditPresetSettings && (e.ObjectCaller.GetType() == typeof(DtoPresetSettings))) //Add Preset { } }