private void EditMethod(object sender, RoutedEventArgs e) { Method selectedMethod = (Method)MethodList.SelectedItem; //TODO Method creation window instead of string splitting (with disabled buttons if empty fields) InputWindow input = new InputWindow(); input.Input.Text = selectedMethod.Type + " " + selectedMethod.Signature; if (input.ShowDialog() == true) { string[] methodInfo = input.Input.Text.Split(null); // Space separation if (methodInfo.Length > 2) { selectedMethod.Type = methodInfo[0]; selectedMethod.Signature = methodInfo[1] + " " + methodInfo[2]; foreach (var m in methodInfo.Skip(3)) { selectedMethod.Signature += " " + m; } } else { //TODO Show invalid input error } } }
private void RenameFileFolderProject(object sender, RoutedEventArgs e) { //TODO Add current name to input window InputWindow input = new InputWindow(); if (input.ShowDialog() == true) { string newName = input.Input.Text; //TODO: Check if folder of same name already exists if (newName != "") { //TODO Cleanup if (ProjStruct.ProjectTree.SelectedItem.GetType() == typeof(FileItem)) { FileItem selectedItem = (FileItem)ProjStruct.ProjectTree.SelectedItem; selectedItem.Name = newName; } else if (ProjStruct.ProjectTree.SelectedItem.GetType() == typeof(FolderItem)) { FolderItem selectedItem = (FolderItem)ProjStruct.ProjectTree.SelectedItem; selectedItem.Name = newName; } else { Project selectedProject = (Project)ProjStruct.ProjectTree.SelectedItem; selectedProject.Name = newName; } } else { //TODO Show invalid name message } } }
private void EditItem(object sender, RoutedEventArgs e) { string listStr = (string)((Button)sender).Tag; ListView list = (ListView)FindName(listStr); ListViewItem item = (ListViewItem)list.SelectedItem; InputWindow language = new InputWindow(); language.Input.Text = (string)item.Content; if (language.ShowDialog() == true) { item.Content = language.Input.Text; } }
private void AddItem(object sender, RoutedEventArgs e) { string listStr = (string)((Button)sender).Tag; ListView list = (ListView)FindName(listStr); InputWindow language = new InputWindow(); if (language.ShowDialog() == true) { string text = language.Input.Text; if (list == TypesList) { // Add type string selectedLangauge = (string)((ListViewItem)LanguagesList.SelectedItem).Content; var types = new List <string>(); if (LanguageTypes.TryGetValue(selectedLangauge, out types)) { if (!types.Contains(text)) { //TODO Don't save types list on Cancel types.Add(text); LanguageTypes[selectedLangauge] = types; ListTypes(); } else { //TODO Notify type already exists } } } else { // Add language AddItem(list, text); } } }
private void CreateMethod(object sender, RoutedEventArgs e) { //TODO Method creation window instead of string splitting (with disabled buttons if empty fields) InputWindow input = new InputWindow(); if (input.ShowDialog() == true) { string[] methodInfo = input.Input.Text.Split(null); // Space separation if (methodInfo.Length > 2) { FileItem selectedFile = (FileItem)SelectedProjectItem; string signature = methodInfo[1] + " " + methodInfo[2]; foreach (var m in methodInfo.Skip(3)) { signature += " " + m; } AddMethod(methodInfo[0], signature, selectedFile.Info); } else { //TODO Show invalid input error } } }
private void CreateFileFolder(object sender, RoutedEventArgs e) { InputWindow input = new InputWindow(); if (input.ShowDialog() == true) { string fileName = input.Input.Text; if (fileName == "") { fileName = "Untitled.txt"; // Default name } Button button = (Button)sender; bool wantedFolder = (string)button.Tag == "Folder"; //TODO Cleanup //TODO Handle cannot create exceptions (in Project and FolderItem classes) if (ProjStruct.ProjectTree.SelectedItem.GetType() == typeof(FileItem)) { FileItem selectedItem = (FileItem)ProjStruct.ProjectTree.SelectedItem; if (selectedItem.ContainingFolder != null) { if (wantedFolder) { selectedItem.ContainingFolder.AddFolder(fileName); } else { selectedItem.ContainingFolder.AddFile(fileName); } } else { if (wantedFolder) { selectedItem.ContainingProject.AddFolder(fileName); } else { selectedItem.ContainingProject.AddFile(fileName); } } } else if (ProjStruct.ProjectTree.SelectedItem.GetType() == typeof(FolderItem)) { FolderItem selectedItem = (FolderItem)ProjStruct.ProjectTree.SelectedItem; if (wantedFolder) { selectedItem.AddFolder(fileName); } else { selectedItem.AddFile(fileName); } } else { Project selectedItem = (Project)ProjStruct.ProjectTree.SelectedItem; if (wantedFolder) { selectedItem.AddFolder(fileName); } else { selectedItem.AddFile(fileName); } } } }