/// <summary> /// The method opens the modify window. /// </summary> private void ModifyMethod() { if (selectedCustomer != null) { ModifyWindow modify = new ModifyWindow(); Messenger.Default.Send(selectedCustomer); modify.Show(); } else { MessageBox.Show("No Customer is selected", "Error"); } }
private void ModifyButton_Click(object sender, RoutedEventArgs e) { if (AccountDataGrid.SelectedItem != null) { Account accountToChange = (Account)AccountDataGrid.SelectedItem; string enc = Encryption.AESGCM.SimpleEncryptWithPassword(accountToChange.AccountName, MasterPass); Console.WriteLine(enc); string dec = Encryption.AESGCM.SimpleDecryptWithPassword(enc, MasterPass); Console.WriteLine(dec); ModifyWindow window = new ModifyWindow(accountToChange); window.ShowDialog(); AccountDataGrid.Items.Refresh(); } }
public void DrawInspector() { Spline spline = path.spline; if (spline == null) { return; } path.Transform(); EditorGUILayout.BeginVertical(); bool bezier = path.spline.type == Spline.Type.Bezier; bezier = EditorGUILayout.Toggle("Bezier", bezier); path.spline.type = bezier ? Spline.Type.Bezier : Spline.Type.Linear; path.seamlessEnds = EditorGUILayout.Toggle("Seamless Ends", path.seamlessEnds); path.spline.sampleRate = EditorGUILayout.IntField("Precision", path.spline.sampleRate); string[] options = new string[spline.points.Length + 1]; for (int i = 0; i < options.Length - 1; i++) { options[i + 1] = "Point " + (i + 1); } options[0] = "- None -"; EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); selectedPoint = EditorGUILayout.Popup("Select Point", selectedPoint + 1, options) - 1; if (selectedPoint > 0 && spline.points.Length > 2 && modifyWindow == null) { if (GUILayout.Button("X", GUILayout.Width(20))) { ArrayUtility.Remove(ref spline.points, spline.points[selectedPoint]); selectedPoint--; } } EditorGUILayout.EndHorizontal(); if (selectedPoint >= 0 && selectedPoint < spline.points.Length) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (tool == PathTool.Move) { GUI.backgroundColor = ForeverPrefs.highlightColor; } else { GUI.backgroundColor = Color.white; } if (GUILayout.Button("Move", EditorStyles.miniButtonLeft)) { tool = PathTool.Move; } if (tool == PathTool.Surface) { GUI.backgroundColor = ForeverPrefs.highlightColor; } else { GUI.backgroundColor = Color.white; } if (GUILayout.Button("Surface", EditorStyles.miniButtonMid)) { tool = PathTool.Surface; } if (tool == PathTool.Normal) { GUI.backgroundColor = ForeverPrefs.highlightColor; } else { GUI.backgroundColor = Color.white; } if (GUILayout.Button("Normals", EditorStyles.miniButtonRight)) { tool = PathTool.Normal; } EditorGUILayout.EndHorizontal(); GUI.backgroundColor = Color.white; if (tool == PathTool.Surface) { surfaceLayermask = DreamteckEditorGUI.LayermaskField("Layer Mask", surfaceLayermask); } EditorGUILayout.Space(); SplinePoint avgPoint = spline.points[selectedPoint]; avgPoint.SetPosition(EditorGUILayout.Vector3Field("Position", avgPoint.position)); if (spline.type == Spline.Type.Bezier) { EditorGUILayout.Space(); avgPoint.type = (SplinePoint.Type)EditorGUILayout.EnumPopup("Tangents Type", avgPoint.type); avgPoint.SetTangent2Position(EditorGUILayout.Vector3Field("Front Tangent", avgPoint.tangent2)); avgPoint.SetTangentPosition(EditorGUILayout.Vector3Field("Back Tangent", avgPoint.tangent)); EditorGUILayout.Space(); } else { avgPoint.tangent = avgPoint.position; avgPoint.tangent2 = avgPoint.position; } avgPoint.normal = EditorGUILayout.Vector3Field("Normal", avgPoint.normal); avgPoint.normal.Normalize(); EditorGUIUtility.labelWidth = 0f; avgPoint.size = EditorGUILayout.FloatField("Size", avgPoint.size); avgPoint.color = EditorGUILayout.ColorField("Color", avgPoint.color); Undo.RecordObject(segment, "Edit Path " + path.name); spline.points[selectedPoint] = avgPoint; if (GUI.changed) { path.InverseTransform(); } } if (modifyWindow == null) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Insert Point", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("At Start")) { SplineSample result = spline.Evaluate(DMath.Lerp(0.0, 1.0 / (spline.points.Length - 1), 0.5)); float tangentLength = Mathf.Lerp(Vector3.Distance(spline.points[0].position, spline.points[0].tangent), Vector3.Distance(spline.points[1].position, spline.points[1].tangent), 0.5f); ArrayUtility.Insert(ref spline.points, 1, new SplinePoint(result.position, result.position - result.forward * tangentLength, result.up, result.size, result.color)); path.InverseTransform(); selectedPoint = 1; } if (GUILayout.Button("At End")) { SplineSample result = spline.Evaluate(DMath.Lerp((double)(spline.points.Length - 2) / (spline.points.Length - 1), 1.0, 0.5)); float tangentLength = Mathf.Lerp(Vector3.Distance(spline.points[spline.points.Length - 2].position, spline.points[spline.points.Length - 2].tangent), Vector3.Distance(spline.points[spline.points.Length - 1].position, spline.points[spline.points.Length - 1].tangent), 0.5f); ArrayUtility.Insert(ref spline.points, spline.points.Length - 2, new SplinePoint(result.position, result.position - result.forward * tangentLength, result.up, result.size, result.color)); path.InverseTransform(); selectedPoint = spline.points.Length - 2; } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Modify Path")) { modifyWindow = EditorWindow.GetWindow <ModifyWindow>(true); modifyWindow.Init(this); } } EditorGUILayout.EndVertical(); }