private async void btn_Clear_FooterMenuEmbedMessage_Click(object sender, RoutedEventArgs e) { Init_Page(); Process.GetData.Picker.Clear(); Process.GetData.Reset_Data("Embed", "All"); await PopupDialog.Show(Status.Success, Detail.Embed_Message, Complete.Clear_All, Icon.Smile); }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// #region Function Controlling private async void Exec(string type) { switch (type) { case "File": if (F_picker_status_cover.Text != "No Image" && F_btn_save_passwd.IsEnabled == false && F_picker_status_file.Text != "No Image") { if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Embed_File, Confirm.isExecute, Icon.Flat) == true) { Process.Embed.Starting(type); } } else { await PopupDialog.Show(Status.Err, Detail.Embed_File, Err.Input_isNull, Icon.Sad); } break; case "Message": if (MSG_picker_status_cover.Text != "No Image" && MSG_btn_save_passwd.IsEnabled == false && MSG_btn_save_message.IsEnabled == false) { if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Embed_Message, Confirm.isExecute, Icon.Flat) == true) { Process.Embed.Starting(type); } } else { await PopupDialog.Show(Status.Err, Detail.Embed_Message, Err.Input_isNull, Icon.Sad); } break; } }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// #region Function Controlling private async void Exec(string type) { switch (type) { case "STEG": if (STEG_picker_status_stego.Text != "No Image" && STEG_btn_save_passwd.IsEnabled == false) { if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Extract_FileMessage, Confirm.isExecute, Icon.Flat) == true) { Process.Extract.Starting(type, STEG_textbox_passwd.Password); } } else { await PopupDialog.Show(Status.Err, Detail.Extract_FileMessage, Err.Input_isNull, Icon.Sad); } break; case "CHK": if (CHK_picker_status_stego.Text != "No Image") { if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Extract_Check, Confirm.isExecute, Icon.Flat) == true) { Process.Extract.Starting(type, String.Empty); } } else { await PopupDialog.Show(Status.Err, Detail.Extract_Check, Err.Input_isNull, Icon.Sad); } break; } }
private async void btn_Clear_Password_msg_Click(object sender, RoutedEventArgs e) { if (MSG_textbox_passwd.Text != String.Empty) { Init_MSG_Passwd(); Process.GetData.Reset_Data("Embed", "Passwd"); await PopupDialog.Show(Status.Success, Detail.Insert_Password, Complete.Clear_Input_Passwd, Icon.Smile); } }
private async void STEG_btn_clear_passwd_Click(object sender, RoutedEventArgs e) { if (STEG_textbox_passwd.Password != String.Empty) { Init_STEG_Passwd(); Process.GetData.Reset_Data("Extract", "Passwd"); await PopupDialog.Show(Status.Success, Detail.Insert_Password, Complete.Clear_Input_Passwd, Icon.Smile); } }
private async void btn_Clear_Message_Click(object sender, RoutedEventArgs e) { string result; MSG_richeditbox_message.Document.GetText(TextGetOptions.UseCrlf, out result); if (result.Length > 0) { Process.GetData.Picker.Clear(); Process.GetData.Reset_Data("Embed", "File"); Init_MSG_Message(); await PopupDialog.Show(Status.Success, Detail.Insert_Message, Complete.Clear_Input_Message, Icon.Smile); } }
public void Push(PopupDialog dialog) { if (dialog == currentDialog) { return; } currentDialog?.Hide(); currentDialog = dialog; dialogContainer.Add(currentDialog); currentDialog.Show(); currentDialog.StateChanged += onDialogOnStateChanged; State = Visibility.Visible; }
public void Push(PopupDialog dialog) { if (dialog == currentDialog) { return; } currentDialog?.Hide(); currentDialog = dialog; dialogContainer.Add(currentDialog); currentDialog.Show(); currentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); Show(); }
private async void MSG_btn_input_message_CLICK(object sender, RoutedEventArgs e) { if (MSG_btn_save_message.IsEnabled == true) { MSG_richeditbox_message.IsReadOnly = false; if (await Process.Picker.Execute(Data.File_Extensions.Txt, "Message") == true) { Init_PickerSecret_NEW("MESSAGE"); } else { Init_MSG_Message(); } } else { await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.Replace_Message, Icon.Sad); } }
private async void STEG_btn_save_passwd_Click(object sender, RoutedEventArgs e) { if (STEG_textbox_passwd.Password != String.Empty) { if (Process.Validate.Input(STEG_textbox_passwd.Password) == false) { await PopupDialog.Show(Status.Err, Detail.Insert_Password, Err.Input_Invalid_Passwd, Icon.Sad); } else { STEG_textbox_passwd.IsEnabled = false; STEG_btn_save_passwd.IsEnabled = false; } } else { await PopupDialog.Show(Status.Err, Detail.Insert_Password, Err.Input_Empty_Passwd, Icon.Sad); } }
private async void btn_Save_Password_msg_Click(object sender, RoutedEventArgs e) { if (MSG_textbox_passwd.Text != String.Empty) { if (Process.Validate.Input(MSG_textbox_passwd.Text) == false) { await PopupDialog.Show(Status.Err, Detail.Insert_Password, Err.Input_Invalid_Passwd, Icon.Sad); } else { await Process.Bifid_Cipher.Execute("Embed", MSG_textbox_passwd.Text, "Passwd"); Init_Text_NEW("PASSWD", "MESSAGE"); } } else { await PopupDialog.Show(Status.Err, Detail.Insert_Password, Err.Input_Empty_Passwd, Icon.Sad); } }
private async void btn_Save_Message_Click(object sender, RoutedEventArgs e) { string text; MSG_richeditbox_message.Document.GetText(TextGetOptions.UseCrlf, out text); if (!(text.Length <= 0)) { if (Process.Validate.Input(text) == false) { await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.Input_Invalid_Message, Icon.Sad); } else { await Process.Bifid_Cipher.Execute("Embed", text, "Message"); Init_Text_NEW("MESSAGE", String.Empty); } } else { await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.Input_Empty_Message, Icon.Sad); } }
private void DeleteModel(NodeView nodeView) { var message = string.Format("Delete Model {0} ?", nodeView.Name); var popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s, e) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteModelCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { var ds = eventArgs.Result; if (!ds.HasErrors) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(ds.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteModelCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteModelCompleted += deleteCompleted; cmsWebServiceClient.DeleteModelAsync(nodeView.Id); } }; }
private void Save() { List<RolePrivilege> rolePrivileges = new List<RolePrivilege>(); //Add only privileges that have access foreach (var mRolePrivilegeViewModel in mRolePrivilegesViewModel) { if (mRolePrivilegeViewModel.HasAccess) { mRolePrivilegeViewModel.RolePrivilege.Privilege = null; mRolePrivilegeViewModel.RolePrivilege.Role = null; mRolePrivilegeViewModel.RolePrivilege.SecurityObject = null; rolePrivileges.Add(mRolePrivilegeViewModel.RolePrivilege); } } mRole.RolePrivileges.Clear(); mRole.RolePrivileges = rolePrivileges; //Update Role privileges for this role CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.SaveRolePrivilegesCompleted += (s1, e1) => { if (e1.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e1.Result.ServerErrorMessages)); errorDialog.Show(); return; } mRole = e1.Result.EntityResult; if (CMS.User.RoleId == mRole.Id) { //Update the role if the user has the same role assigned CMS.User.Role = mRole; } var existingRole = (from x in CMS.Cache.Roles where x.Id == mRole.Id select x).FirstOrDefault(); if (existingRole != null) { //Update role CommonUtils.CloneObject(existingRole, mRole, "Id"); } else { //Add new role to the Cache CMS.Cache.Roles.Add(mRole); } Utils.SetEffectivePrivileges(); //Close the dialog DialogResult = true; }; cmsWebServiceClient.SaveRolePrivilegesAsync(CMS.User.Id, mRole); }
private void AddCalibrationComponentType(NodeView nodeView) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); AddEditCalibrationComponentTypeDialog dialog = new AddEditCalibrationComponentTypeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddCalibrationComponentTypeCompletedEventArgs> addCompleted = null; addCompleted = (s2, e2) => { if (e2.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e2.Result.ServerErrorMessages)); errorDialog.Show(); } else { CalibrationComponentType calibrationComponentType = e2.Result.EntityResult; if (calibrationComponentType != null) { NodeView child = new NodeView(nodeView) { Id = calibrationComponentType.Id, Name = dialog.ComponentType.Name, Description = dialog.ComponentType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.CalibrationComponentType, HasChildren = true, SortField = dialog.ComponentType.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddCalibrationComponentTypeCompleted -= addCompleted; } }; cmsWebServiceClient.AddCalibrationComponentTypeCompleted += addCompleted; cmsWebServiceClient.AddCalibrationComponentTypeAsync(dialog.ComponentType); } }; }
private void OkButtonHandler(object parameter) { if (CanExecuteAddButtonHandler(parameter)) { if (AreAllValid() && PurchaseOrders.All(x => !x.HasErrors) && OtherAccruals.All(x => !x.HasErrors)) { var undeliveredPortionHigherThanAccrue = PurchaseOrders.Where(x => x.UndeliveredPortion.HasValue && x.AmountAccruedDecimal > x.UndeliveredPortion.Value).ToList(); if (undeliveredPortionHigherThanAccrue.Any()) { StringBuilder errorMessage = new StringBuilder(); foreach (var purchaseOrderAccureModel in undeliveredPortionHigherThanAccrue) { errorMessage.Append(String.Format("Accrue {0:c} is more than Undelivered Proportion {1:c}.{2}", purchaseOrderAccureModel.AmountAccruedDecimal, purchaseOrderAccureModel.UndeliveredPortion.Value, Environment.NewLine)); } errorMessage.Append(Environment.NewLine); errorMessage.Append("Click OK to accept or Cancel to modify."); PopupDialog popupDialog = new PopupDialog(PopupDialogType.SaveComfirm, errorMessage.ToString(), "Warning", 700, 250); popupDialog.Show(); popupDialog.Closed += (sender, args) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Ok) { Save(); } else { foreach (var purchaseOrderAccureModel in undeliveredPortionHigherThanAccrue) { purchaseOrderAccureModel.AddValidationError("Accrue", "Accrue is more than the Undelivered amount"); } } }; } else { Save(); } } else { var validationErrors = GetErrors(); if (validationErrors.Any()) { View.ValidationPopup.Show(validationErrors); } } } }
private void ProccessTransferFiles(int fileNumber, FileInfo dialogFile, List<FileInfo> dialogFiles) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); try { Stream stream = dialogFile.OpenRead(); View.RadProgressBar1.Maximum = stream.Length; View.RadProgressBar1.Minimum = 0; View.RadProgressBar1.Visibility = Visibility.Visible; View.RadProgressBar1.Value = 0; if (stream.Length > int.MaxValue) { var errorDialog = new PopupDialog(PopupDialogType.Warning, string.Format("File [{0}] can not be bigger than 2GB.", dialogFile.Name), "Warning: File is to large"); errorDialog.Show(); return; } int transferChunkSize = Utils.GetTransferChunkSize(stream); var file = new CommonUploadFile {Name = dialogFile.Name, Size = stream.Length, Path = Guid.NewGuid().ToString()}; var newAttachment = new IssueFile { DateUploaded = DateTime.Now, Filename = file.Name, IssueId = mIssue.Id, Issue = mIssue, Path = file.Path, UploadedById = CMS.User.Id, User = CMS.User, AttachmentType = new AttachmentType {Id = (int) CommonUtils.AttachmentType.Unknown}, AttachmentTypeId = (int) CommonUtils.AttachmentType.Unknown, AttachmentTypes = mAttachmentTypes, RestrictedContent = false, SelectedAttachmentType = new AttachmentType {Id = (int) CommonUtils.AttachmentType.Unknown} }; file.Attachment = newAttachment; if (stream.Position > -1 && stream.Position < stream.Length) { int chunkSize = Utils.GetCurrentChunkSize(stream, transferChunkSize); var fileBytes = new byte[chunkSize]; stream.Read(fileBytes, 0, chunkSize); EventHandler<UploadAttachmentCompletedEventArgs> uploadFileChunkCompleted = null; uploadFileChunkCompleted = (s1, e1) => { if (stream.Position > -1 && stream.Position < stream.Length) { chunkSize = Utils.GetCurrentChunkSize(stream, transferChunkSize); double percentage = (stream.Position/file.Size); string fileName = file.Attachment.Filename.Remove(0, file.Attachment.Filename.IndexOf(']') + 1).Trim(); file.Attachment.Filename = String.Format("[{0:#.##%}] {1}", percentage, fileName); fileBytes = new byte[chunkSize]; stream.Read(fileBytes, 0, chunkSize); View.RadProgressBar1.Value = View.RadProgressBar1.Value + chunkSize; cmsWebServiceClient.UploadAttachmentAsync(file.Name, fileBytes, file.Path, true); } else { file.Attachment.Filename = file.Name; cmsWebServiceClient.UploadAttachmentCompleted -= uploadFileChunkCompleted; Attachments.Add(newAttachment); //Close the stream when all files are uploaded stream.Close(); UploadInProgress = false; if (dialogFiles.Count > fileNumber + 1) { fileNumber++; ProccessTransferFiles(fileNumber, dialogFiles[fileNumber], dialogFiles); } mIssue.IssueFiles.Add(newAttachment); RaisePropertyChanged("SelectedAttachmentType"); RaisePropertyChanged("Attachments"); OnCollectionChanged(); //UPLOAD IS COMPLETE - Save Model cmsWebServiceClient.SaveIssueFilesCompleted += ((sender, args) => { EventAggregator.GetEvent<PrismEvents.RefreshIssueRevisionHistoryPrismEvent>().Publish(null); }); cmsWebServiceClient.SaveIssueFilesAsync(new List<IssueFile> {newAttachment}); View.RadProgressBar1.Visibility = Visibility.Collapsed; OnUploadComplete(); } }; cmsWebServiceClient.UploadAttachmentCompleted += uploadFileChunkCompleted; cmsWebServiceClient.UploadAttachmentAsync(file.Name, fileBytes, file.Path, false); } } catch (IOException) { OnErrorOccurred(string.Format("Cannot upload the file '{0}' because it is currently open. Please close the file and try again", dialogFile.Name)); } catch (SecurityException) { OnErrorOccurred(string.Format("Cannot upload the file '{0}' because it is currently open. Please close the file and try again", dialogFile.Name)); } catch (Exception ex) { OnErrorOccurred(ex.Message); } }
private void AddExistingControlSystemComponentTypeAlarmProperty(NodeView nodeView) { var controlSystemEquipmentComponentTypeId = nodeView.Parent.Id; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetControlSystemComponentTypeCompleted += (s, e) => { var dialog = new AddEditExistingControlSystemComponentAlarmPropertyDialog(e.Result); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<SaveControlSystemComponentTypeAlarmPropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { var entityResult = eventArgs.Result.EntityResult; if (eventArgs.Result.HasErrors) { var popup = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages)); popup.Show(); return; } if (entityResult != null) { var child = new NodeView(nodeView) { Id = entityResult.Id, Name = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Name, Description = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemComponentTypeAlarmProperty, HasChildren = false, SortField = entityResult.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted -= addCompleted; }; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted += addCompleted; var systemComponentTypeTuningProperty = new ControlSystemComponentTypeAlarmProperty { ComponentTypeId = controlSystemEquipmentComponentTypeId, AlarmPropertyId = dialog.ControlSystemComponentTypeAlarmProperty.AlarmPropertyId, Ordinal = dialog.ControlSystemComponentTypeAlarmProperty.Ordinal }; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyAsync(systemComponentTypeTuningProperty); } }; }; cmsWebServiceClient.GetControlSystemComponentTypeAsync(controlSystemEquipmentComponentTypeId); }
private void RemoveControlSystemComponentTypeAlarmProperty(NodeView nodeView) { var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name)); confirmDialog.Show(); confirmDialog.Closed += (s, e) => { if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteControlSystemComponentTypeAlarmPropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { if (!eventArgs.Result.HasErrors) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted += deleteCompleted; cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyAsync(nodeView.Id); } }; }
private void Save(TimesheetDialog view) { if (!HasErrors()) { mTimesheet.LastModifiedByUserId = CMS.User.Id; mTimesheet.LastModifiedDate = DateTime.Now; mSavingTimesheet = true; OkButtonCommand.RaiseCanExecuteChanged(); SubmitButtonCommand.RaiseCanExecuteChanged(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.SaveTimesheetCompleted += (s, e) => { if (e.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e.Result.ServerErrorMessages)); errorDialog.Show(); mSavingTimesheet = false; OkButtonCommand.RaiseCanExecuteChanged(); SubmitButtonCommand.RaiseCanExecuteChanged(); } else { view.Timesheet = mTimesheet; view.DialogResult = true; } }; cee.SaveTimesheetAsync(mTimesheet); } }
private void Reinstate(QuickDocument quickDocument) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.UnDeleteDocumentCompleted += (s, e) => { if (e.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e.Result.ServerErrorMessages)); errorDialog.Show(); return; } }; cmsWebServiceClient.UnDeleteDocumentAsync(quickDocument.Id); }
private void CheckForTooManyFavourites() { //if we try and save too many at once silverlight throws an "too large" exception. set the max using the const. 150 should be enough. if (mFilteredQuickDocuments.Count > MaxFav) { var errors = new List<string> { string.Format("Added the first {0} items of {1} to Favourites. This is the maximum that can be saved at once.", MaxFav, mFilteredQuickDocuments.Count) }; var errorDialog = new PopupDialog(PopupDialogType.Information, Utils.DisplayErrorMessages(errors)); errorDialog.Show(); } }
private void DeleteInstrumentComponentType(NodeView nodeView) { string message = String.Format("Delete Component Type {0} ?", nodeView.Name); PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s, e) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteInstrumentComponentTypeCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, e2) => { DbOperationResult ds = e2.Result; if (!ds.HasErrors) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(ds.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteInstrumentComponentTypeCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteInstrumentComponentTypeCompleted += deleteCompleted; cmsWebServiceClient.DeleteInstrumentComponentTypeAsync(nodeView.Id); } }; }
private void DeleteCalibrationProperty(NodeView nodeView) { var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, String.Format("Delete property '{0}'?", nodeView.Name)); confirmDialog.Show(); confirmDialog.Closed += (s, e) => { if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteCalibrationPropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { DbOperationResult result = eventArgs.Result; if (!result.HasErrors) { nodeView.Parent.Children.Remove(nodeView); } else { var dialog = new PopupDialog(PopupDialogType.Error, result.ServerErrorMessages[0]); dialog.Show(); } cmsWebServiceClient.DeleteCalibrationPropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteCalibrationPropertyCompleted += deleteCompleted; cmsWebServiceClient.DeleteCalibrationPropertyAsync(nodeView.Id); } }; }
private void DeleteCalibrationEngineeringUnit(NodeView nodeView) { string message = String.Format("Delete Engineering Unit {0} ?", nodeView.Name); PopupDialog popupDialog = new PopupDialog(PopupDialogType.RemoveLinkConfirm, message); popupDialog.Show(); popupDialog.Closed += (s4, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteCalibrationEngineeringUnitCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s3, eventArgs) => { DbOperationResult result = eventArgs.Result; if (!result.ServerErrorMessages.Any()) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(result.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteCalibrationEngineeringUnitCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteCalibrationEngineeringUnitCompleted += deleteCompleted; cmsWebServiceClient.DeleteCalibrationEngineeringUnitAsync(nodeView.Id); } }; }
private void DeleteReport(NodeView nodeView) { var message = string.Format("Delete Report {0} ?", nodeView.Name); var popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s, e) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<DeleteReportLinkCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { var ds = eventArgs.Result; if (!ds.HasErrors) { nodeView.Parent.Children.Remove(nodeView); var existing = (from x in CMS.Cache.ReportLinks where x.Id == nodeView.Id select x).FirstOrDefault(); CMS.Cache.ReportLinks.Remove(existing); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(ds.ServerErrorMessages)); errorDialog.Show(); } cmsWebServiceClient.DeleteReportLinkCompleted -= deleteCompleted; }; cmsWebServiceClient.DeleteReportLinkCompleted += deleteCompleted; cmsWebServiceClient.DeleteReportLinkAsync(nodeView.Id); } }; }
private void EditControlSystemComponentTypeAlarmProperty(NodeView nodeView) { var dialog = new AddEditExistingControlSystemComponentAlarmPropertyDialog(nodeView.Id) { Title = "Edit ControlSystem Component Alarm Property" }; dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<SaveControlSystemComponentTypeAlarmPropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { if (eventArgs.Result.HasErrors) { var popup = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages)); popup.Show(); return; } var componentTypeAlarmProperty = eventArgs.Result.EntityResult; if (componentTypeAlarmProperty != null) { nodeView.Name = componentTypeAlarmProperty.ControlSystemAlarmProperty.Name; nodeView.Description = componentTypeAlarmProperty.ControlSystemAlarmProperty.Description; nodeView.SortField = componentTypeAlarmProperty.Ordinal.ToString(); } cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted -= addCompleted; nodeView.Parent.Sort(); }; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted += addCompleted; cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyAsync(dialog.ControlSystemComponentTypeAlarmProperty); } }; dialog.Show(); }
private void RemoveIssue(QuickIssue quickIssue) { if (!CMS.EffectivePrivileges.IssueTab.CanDelete || !CMS.EffectivePrivileges.AdminTab.CanModify || !quickIssue.IsActive) { return; } string message = String.Format("Delete Issue {0} - '{1}' Issue?", quickIssue.Id, quickIssue.Name); var popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { //DELETE var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.DeleteIssueCompleted += (s1, e1) => { EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(quickIssue); }; cmsWebServiceClient.DeleteIssueAsync(quickIssue.Id, CMS.User.Id); } }; }
private void RemoveInterlockTypeProperty(NodeView nodeView) { var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name)); confirmDialog.Show(); confirmDialog.Closed += (s, e) => { if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<RemoveInterlockTypePropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { var error = eventArgs.Result; if (string.IsNullOrEmpty(error)) { nodeView.Parent.Children.Remove(nodeView); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, error); errorDialog.Show(); } cmsWebServiceClient.RemoveInterlockTypePropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.RemoveInterlockTypePropertyCompleted += deleteCompleted; cmsWebServiceClient.RemoveInterlockTypePropertyAsync(nodeView.Id); } }; }
private void DeleteButtonHandler(object parameter) { if (SelectedComponent != null) { string message = string.Format("Remove selected Calibration? ({0})", SelectedComponent.Name); PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { mInstrument.CalibrationComponents.Remove(SelectedComponent); View.ComponentPropertiesControl.Content = null; RaisePropertyChanged("Components"); RaisePropertyChanged("SelectedComponent"); mSelectedComponent = null; RaiseChangeEvent(); OnCollectionChanged(); } }; } }
public void DeleteButtonHandler(object parameter) { List<IssueFile> selected = (from x in Attachments where x.Checked select x).ToList(); if (selected.Count == 0) { return; } string message = string.Format("Delete selected Files? ({0})", selected.Count); var popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { var todelete = new List<IssueFile>(); var cantDelete = new List<IssueFile>(); foreach (IssueFile attachment in selected) { IssueFile foo = (from x in mIssue.IssueFiles where x.Path == attachment.Path && x.Id == attachment.Id select x).FirstOrDefault(); if (CMS.EffectivePrivileges.AdminTab.CanDelete || CMS.EffectivePrivileges.IssueTab.CanDelete || attachment.UploadedById == CMS.User.Id) { todelete.Add(foo); } else { cantDelete.Add(attachment); } } if (cantDelete.Any()) { string deleteMessage = String.Format("You dont have permission to delete following items:{0}{1}", Environment.NewLine, string.Join(Environment.NewLine, cantDelete.Select(x => x.Filename).ToArray())); var dialog = new PopupDialog(PopupDialogType.Warning, deleteMessage, "Can not remove"); dialog.Show(); } //DELETE IS COMPLETE - Save Model var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); //Update Modified By so the Revision history user is correct. mIssue.ModifiedById = CMS.User.Id; cmsWebServiceClient.DeleteIssueFilesCompleted += ((sender, args) => { todelete.ForEach(x => mIssue.IssueFiles.Remove(x)); OnCollectionChanged(); EventAggregator.GetEvent<PrismEvents.RefreshIssueRevisionHistoryPrismEvent>().Publish(null); RaisePropertyChanged("Attachments"); }); cmsWebServiceClient.DeleteIssueFilesAsync(todelete); } }; }
private void UnMarkIssueAsRestrictedContent(QuickIssue quickIssue) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.UnMarkIssueAsRestrictedCompleted += (s, e) => { if (e.Result) { quickIssue.RestrictedContent = false; } else { var dialog = new PopupDialog(PopupDialogType.Error, "Access is restricted due to issue content – please contact the System Administrator.", "Restricted Content Issue"); dialog.Show(); } }; cmsWebServiceClient.UnMarkIssueAsRestrictedAsync(quickIssue.Id, CMS.User.Id); }
private void OkButtonHander(object parameter) { if (AreAllValid()) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.AddIssueTypeSubTypeCompleted += (s, e) => { if (e.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e.Result.ServerErrorMessages)); errorDialog.Show(); } else { View.IssueSubType = SelectedIssueSubType; View.DialogResult = true; } }; cmsWebServiceClient.AddIssueTypeSubTypeAsync(mIssueType,SelectedIssueSubType); } }
private void WarnAlarmLostOnComponentTypeChange() { if (SelectedType == null) return; var getAlarmPropertyValuesRequiredForComponentTypeTask = DatabaseLoader.GetAlarmPropertyValuesRequiredForComponentType(SelectedType.Id); var tasks = new List<Task> { getAlarmPropertyValuesRequiredForComponentTypeTask }; Task.Factory.ContinueWhenAll(tasks.ToArray(), xx => { CMS.UiFactory.StartNew(() => { List<int> newIds = (from g in getAlarmPropertyValuesRequiredForComponentTypeTask.Result select g.ControlSystemAlarmPropertyId).ToList(); List<int> oldIds = (from g in mClone.ControlSystemAlarmPropertyValues select g.ControlSystemAlarmPropertyId).ToList(); var dicarding = oldIds.Except(newIds).ToArray(); List<ControlSystemAlarmPropertyValue> discarding = (from x in mClone.ControlSystemAlarmPropertyValues where dicarding.Contains(x.ControlSystemAlarmPropertyId) select x).ToList(); if (discarding.Any()) { StringBuilder sb = new StringBuilder(); sb.AppendLine("The following Alarms will be discarded."); sb.AppendLine(""); foreach (ControlSystemAlarmPropertyValue pv in discarding) { sb.AppendLine(pv.ControlSystemAlarmProperty.FormattedName); } PopupDialog dlg = new PopupDialog(PopupDialogType.ConfirmMessage, sb.ToString(), "Confirm to Discard Alarms due to the Type Change", 500, 250); dlg.Show(); dlg.Closed += (s2, e2) => { if (dlg.DialogResult.HasValue && dlg.DialogResult.Value) { mControlSystemComponent.ControlSystemAlarmPropertyValues.Clear(); foreach (var propertyValue in getAlarmPropertyValuesRequiredForComponentTypeTask.Result) { var match = (from x in mClone.ControlSystemAlarmPropertyValues where x.ControlSystemAlarmPropertyId == propertyValue.ControlSystemAlarmPropertyId select x).FirstOrDefault(); if (match==null) { mControlSystemComponent.ControlSystemAlarmPropertyValues.Add(propertyValue); } else { mControlSystemComponent.ControlSystemAlarmPropertyValues.Add(match); } } } else { mControlSystemComponent.ControlSystemComponentType = mClone.ControlSystemComponentType; mControlSystemComponent.ControlSystemComponentTypeId = mClone.ControlSystemComponentTypeId; } RaisePropertyChanged("SelectedType"); }; } }); }); }
private void MarkIssueAsRestrictedContent(QuickIssue quickIssue) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.MarkIssueAsRestrictedCompleted += (s, e) => { if (e.Result) { quickIssue.RestrictedContent = true; } else { var dialog = new PopupDialog(PopupDialogType.Error, "Only administrator or users in the distribution list can mark this issue as restricted.", "Restricted Content Issue"); dialog.Show(); } }; cmsWebServiceClient.MarkIssueAsRestrictedAsync(quickIssue.Id, CMS.User.Id); }
private void EditInstrumentComponentType(NodeView nodeView) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetInstrumentComponentTypeCompletedEventArgs> getInstrumentComponentCompleted = null; getInstrumentComponentCompleted = (s, eventArgs) => { InstrumentComponentType componentType = eventArgs.Result; AddEditInstrumentComponentTypeDialog dialog = new AddEditInstrumentComponentTypeDialog(componentType); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddInstrumentComponentTypeCompletedEventArgs> addCompleted = null; addCompleted = (s2, e2) => { if (e2.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e2.Result.ServerErrorMessages)); errorDialog.Show(); } else { InstrumentComponentType instrumentEquipmentComponentType = e2.Result.EntityResult; nodeView.Name = instrumentEquipmentComponentType.Name; nodeView.Description = instrumentEquipmentComponentType.Description; nodeView.SortField = instrumentEquipmentComponentType.Ordinal.ToString(); cmsWebServiceClient.AddInstrumentComponentTypeCompleted -= addCompleted; nodeView.Parent.Sort(); } }; cmsWebServiceClient.AddInstrumentComponentTypeCompleted += addCompleted; cmsWebServiceClient.AddInstrumentComponentTypeAsync(dialog.ComponentType); } }; cmsWebServiceClient.GetInstrumentComponentTypeCompleted -= getInstrumentComponentCompleted; }; cmsWebServiceClient.GetInstrumentComponentTypeCompleted += getInstrumentComponentCompleted; cmsWebServiceClient.GetInstrumentComponentTypeAsync(nodeView.Id); }
private void OpenIssueTab(QuickIssue issue) { if (issue == null || !issue.IsActive) { return; } if (issue.RestrictedContent) { //Only allowed users can open restricted Issue var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.CanUserOpenRestrictedIssueCompleted += (s, e) => { if (e.Result) { OpenTab(issue); } else { var dialog = new PopupDialog(PopupDialogType.Error, "Access is restricted due to issue content – please contact the System Administrator.", "Restricted Content Issue"); dialog.Show(); } }; cmsWebServiceClient.CanUserOpenRestrictedIssueAsync(issue.Id, CMS.User.Id); } else { OpenTab(issue); } }
private void OkButtonHander(object parameter) { if (CanExecuteOkButtonHandler(parameter)) { if (AreAllValid()) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.SaveIssueSubTypeCompleted += (s1, e1) => { if (e1.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e1.Result.ServerErrorMessages)); errorDialog.Show(); return; } View.IssueSubType = e1.Result.EntityResult; View.DialogResult = true; }; cmsWebServiceClient.SaveIssueSubTypeAsync(mIssueSubType); } } }
private void OkButtonHandler(object parameter) { if (CanModify(parameter)) { if (AreAllValid()) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.SaveControlSystemAlarmConsequenceCompleted += (s1, e1) => { if (e1.Result.HasErrors) { var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e1.Result.ServerErrorMessages)); errorDialog.Show(); return; } View.AlarmConsequence = e1.Result.EntityResult; View.DialogResult = true; }; cmsWebServiceClient.SaveControlSystemAlarmConsequenceAsync(AlarmConsequence); } } }
private void DeleteButtonHandler(object parameter) { var selected = (from x in DocumentLocations where x.Checked select x).ToList(); if (selected.Count == 0) { return; } string message = string.Format("Remove selected Locations? ({0})", selected.Count); PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { List<DocumentAssignedLocation> keep = new List<DocumentAssignedLocation>((from x in DocumentLocations where !x.Checked select x).ToList()); mDocument.DocumentAssignedLocations = keep; RaisePropertyChanged("DocumentLocations"); OnCollectionChanged(); Utils.OnCollectionChanged(EventAggregator, mDocument, "DocumentLocationsViewModel", true); } }; }
private void DeleteInstrumentEquipmentButtonHandler(object parameter) { var selected = (from x in mIssue.IssueRelatedInstruments where x.Checked select x).ToList(); if (selected.Count==0) { return; } string message = string.Format("Remove link to selected Instruments? ({0})", selected.Count); PopupDialog popupDialog = new PopupDialog(PopupDialogType.RemoveLinkConfirm, message); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { selected.ForEach(x => mIssue.IssueRelatedInstruments.Remove(x)); RaiseChangeEvent(); RaisePropertyChanged("IssueRelatedInstruments"); OnCollectionChanged(); } }; }
private void RemoveMobilePlantComponentTypeProperty(NodeView nodeView) { string message = String.Format("Delete Component Type Property {0} ?", nodeView.Name); PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message); popupDialog.Show(); popupDialog.Closed += (s, e) => { if (popupDialog.PopupDialogResult == PopupDialogResult.Yes) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<RemoveMobilePlantComponentTypePropertyCompletedEventArgs> deleteCompleted = null; deleteCompleted = (s2, eventArgs) => { string error = eventArgs.Result; if (string.IsNullOrEmpty(error)) { nodeView.Parent.Children.Remove(nodeView); Utils.HideSpinner(nodeView); nodeView.Parent.Sort(); } else { var errorDialog = new PopupDialog(PopupDialogType.Error, error); errorDialog.Show(); } cmsWebServiceClient.RemoveMobilePlantComponentTypePropertyCompleted -= deleteCompleted; }; cmsWebServiceClient.RemoveMobilePlantComponentTypePropertyCompleted += deleteCompleted; cmsWebServiceClient.RemoveMobilePlantComponentTypePropertyAsync(nodeView.Id); } }; }