void OnCreateFileClicked(object sender, EventArgs a) { string fileName = ""; string content = ""; NewFileDialog nfd = new NewFileDialog(); int result = nfd.Run(); if (result == (int)ResponseType.Ok) { fileName = nfd.FileName; content = nfd.Content; } nfd.Destroy(); if (String.IsNullOrEmpty(fileName)) { return; } string newFile = System.IO.Path.Combine(parent.FullName, fileName); try { FileUtility.CreateFile(newFile, content); } catch { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error); md.ShowDialog(); } FillStore(false); }
protected override void OnActivated() { Console.WriteLine("newfile - activate"); base.OnActivated(); NewFileDialog nfd = new NewFileDialog(); int result = nfd.Run(); if (result == (int)ResponseType.Ok) { string fileName = nfd.FileName; string content = nfd.Content; MainClass.MainWindow.CreateFile(fileName,content); } nfd.Destroy(); MainClass.MainWindow.SaveWorkspace(); }
void OnAddFileClicked(object sender, EventArgs a) { TreeIter tiDirectory = new TreeIter(); string pathDir = GetDirectory(ref tiDirectory); if(String.IsNullOrEmpty(pathDir)){ return; } string fileName = ""; string content =""; NewFileDialog nfd = new NewFileDialog(); int result = nfd.Run(); if (result == (int)ResponseType.Ok) { fileName = nfd.FileName; content = nfd.Content; } nfd.Destroy(); if (String.IsNullOrEmpty(fileName) ) return; string newFile = System.IO.Path.Combine(pathDir, fileName); try { FileUtility.CreateFile(newFile,content); } catch { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error); md.ShowDialog(); } RefreshDir(pathDir, tiDirectory); /*if(MainClass.Workspace != null && !String.IsNullOrEmpty(MainClass.Workspace.FilePath)){ LoadLibs(MainClass.Workspace.RootDirectory); };*/ }
void OnCreateFileClicked(object sender, EventArgs a) { string fileName = ""; string content =""; NewFileDialog nfd = new NewFileDialog(); int result = nfd.Run(); if (result == (int)ResponseType.Ok) { fileName = nfd.FileName; content = nfd.Content; } nfd.Destroy(); if (String.IsNullOrEmpty(fileName) ) return; string newFile = System.IO.Path.Combine(parent.FullName, fileName); try { FileUtility.CreateFile(newFile,content); } catch { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error); md.ShowDialog(); } FillStore (false); }