public void InitializeCommand(PSMAttributeContainer attributeContainer, IEnumerable <PSMAttribute> attributes) { MoveAttributesFromAttributeContainerBackToClassCommand command = (MoveAttributesFromAttributeContainerBackToClassCommand)MoveAttributesFromAttributeContainerBackToClassCommandFactory.Factory().Create(Controller); command.AttributeContainer = attributeContainer; command.Attributes.AddRange(attributes); Commands.Add(command); if (attributeContainer.PSMAttributes.All(attribute => attributes.Contains(attribute))) { OkCancelDialog dialog = new OkCancelDialog(); dialog.PrimaryContent = "Attribute container is empty."; dialog.Title = "Attribute container is empty"; dialog.SecondaryContent = "Attribute container is now empty. Do you wish to remove the container now? "; dialog.OkButtonContent = "Delete"; dialog.CancelButtonContent = "Leave"; if (dialog.ShowDialog() == true) { DeleteFromPSMDiagramCommand leavecommand = (DeleteFromPSMDiagramCommand)DeleteFromPSMDiagramCommandFactory.Factory().Create(Controller); leavecommand.DeletedElements = new[] { attributeContainer }; Commands.Add(leavecommand); } } }
private void lCheckForUpdates_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Updater.Updater updater = new Updater.Updater(); IEnumerable <string> files = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll").Concat(Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.exe")); Dictionary <string, Version> clientVersions = new Dictionary <string, Version>(); foreach (string file in files) { Version clientVersion = AssemblyName.GetAssemblyName(file).Version; clientVersions[Path.GetFileName(file)] = clientVersion; } Dictionary <string, Version> newAvailableVersions; if (updater.AreNewVersionsAvailable(clientVersions, out newAvailableVersions) && XCaseYesNoBox.ShowYesNoCancel("New version available", "New version is available. \r\nDo you wish to update?") == MessageBoxResult.Yes) { System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("Updater.exe"); info.UseShellExecute = true; this.Close(); (Application.Current.MainWindow as MainWindow).Close(); System.Diagnostics.Process.Start(info); } else { OkCancelDialog d = new OkCancelDialog(); d.CancelButtonVisibility = Visibility.Collapsed; d.Title = "XCase Update"; d.PrimaryContent = "Check for updates: "; d.SecondaryContent = "This is the latest version."; d.ShowDialog(); } }
private void ConnectToSocket(IPEndPoint ip) { try { _socket.Connect(ip); _serverEndPoint = _socket.RemoteEndPoint; } catch (Exception e) { var dialog = new OkCancelDialog(); dialog.Message.Text = e.Message + "\nDo you want to reconnect?"; dialog.CancelButton.Content = "No"; dialog.OkButton.Content = "Yes"; dialog.ShowDialog(); if (dialog.DialogResult.Value && dialog.DialogResult.Value) { App.setupSocketConnection(); } else { MainWindow.CloseAppS(); } } Properties.Settings.Default.IPAddress = ip.Address.ToString(); Properties.Settings.Default.Save(); _ipendpoint = ip; }
/// <summary> /// Selection of the Camera /// </summary> /// <param name="owner"></param> /// <returns></returns> public override object Select(System.Windows.Forms.IWin32Window owner) { OkCancelDialog dlg = new OkCancelDialog(); dlg.Text = Name; DSCameraSelectionControl view = new DSCameraSelectionControl(); if (dlg.ShowDialog(view, owner) == System.Windows.Forms.DialogResult.OK) { return(view.Proxy); } return(null); }
public static void OnFatalError(Exception e) { OkCancelDialog dlg = new OkCancelDialog(); dlg.Text = "Fatal Error, Restart ?"; CrashReport view = new CrashReport(); view.SetException(e); if (dlg.ShowDialog(view, null) == System.Windows.Forms.DialogResult.OK) { Application.Restart(); } else { System.Environment.Exit(0); } }
public void Set(Property deletedAttribute) { if (deletedAttribute.DerivedPSMAttributes.Count > 0) { OkCancelDialog d = new OkCancelDialog(); d.PrimaryContent = "Delete dependent PSM attributes"; d.Title = "Delete dependent PSM attributes"; string attr = "Attribute \"{0}\" has PSM dependecies. Those will be deleted as well:" + Environment.NewLine + Environment.NewLine; foreach (PSMAttribute A in deletedAttribute.DerivedPSMAttributes) { attr += A.Class.Diagram.Caption + ": " + A.Class.Name + "." + A.Name + Environment.NewLine; } attr = attr.Remove(attr.Length - 1); d.SecondaryContent = string.Format(attr, deletedAttribute.Name); if (d.ShowDialog() == false) { return; } else { foreach (PSMAttribute A in deletedAttribute.DerivedPSMAttributes) { RemovePSMAttributeCommand cPSM = RemovePSMAttributeCommandFactory.Factory().Create(Controller) as RemovePSMAttributeCommand; if (A.AttributeContainer != null) { cPSM.AttributeContainer = A.AttributeContainer; } cPSM.DeletedAttribute = A; Commands.Add(cPSM); } } } RemoveAttributeCommand c = RemoveAttributeCommandFactory.Factory().Create(Controller) as RemoveAttributeCommand; c.DeletedAttribute = deletedAttribute; Commands.Add(c); }
public override object Select(System.Windows.Forms.IWin32Window owner) { /* * if (autoselect && File.Exists(ConfigPath)) * { * try * { * using(StreamReader sw = File.OpenText(ConfigPath)) * { * string hardwareId = sw.ReadToEnd(); * SardauscanHardwareProxy proxy = SardauscanHardwareProxy.FromHardwareId(hardwareId); * return proxy; * } * } * catch { } * } */ OkCancelDialog dlg = new OkCancelDialog(); dlg.Text = Name; SardauscanSelectionControl view = new SardauscanSelectionControl(); if (dlg.ShowDialog(view, owner) == System.Windows.Forms.DialogResult.OK) { try { if (view.SardauscanHardwareProxy as SardauscanHardwareProxy != null) { using (StreamWriter sw = File.CreateText(ConfigPath)) sw.Write(((SardauscanHardwareProxy)view.SardauscanHardwareProxy).HardwareId); } } catch { } return(view.SardauscanHardwareProxy); } return(null); }
private void MainForm_AboutClick(object sender, EventArgs e) { OkCancelDialog dlg = new OkCancelDialog(); dlg.ShowDialog(new AboutControl(), this); }