コード例 #1
0
 private void openMenu_Click(object sender, EventArgs e)
 {
     if (base.SelectedNode is FileNode)
     {
         FileNode i = (FileNode)base.SelectedNode;
         TextEditor te = new TextEditor();
         te.Load(i.GetFile(), this.tabs);
     }
     else if (base.SelectedNode is RemoteFileNode)
     {
         RemoteFileNode i = (RemoteFileNode)base.SelectedNode;
         TextEditor te = new TextEditor();
         te.Load(i, this.tabs);
     }
     else if (base.SelectedNode is ConsoleNode)
     {
         ConsoleNode node = (ConsoleNode)base.SelectedNode;
         Console console = new Console();
         console.Load(node.Parent.GetServerData(), this.tabs);
     }
     else if (base.SelectedNode is RemoteConsoleNode)
     {
         RemoteConsoleNode node = (RemoteConsoleNode)base.SelectedNode;
         RemoteConsole console = new RemoteConsole();
         console.Load(node.Parent.data, node.Parent.GetServerData().name, this.tabs);
     } else if (base.SelectedNode is PropertiesNode)
     {
         PropertiesNode node = (PropertiesNode)base.SelectedNode;
         PropertiesEditor editor = new PropertiesEditor();
         editor.Load(this.tabs);
     }
 }
コード例 #2
0
 private void newFileMenu_Click(object sender, System.EventArgs e)
 {
     if (base.SelectedNode is DirectoryNode)
     {
         DirectoryNode i = (DirectoryNode)base.SelectedNode;
         string newName = Dialogs.TextInput.ShowDialog("Nowy plik", "Podaj nazwę nowego pliku:", "", "Utwórz plik", "Anuluj");
         if (newName != "")
         {
             string path = i.GetDirectory().FullName + Path.DirectorySeparatorChar + newName;
             if (System.IO.File.Exists(path))
             {
                 MessageBox.Show("Plik o podanej nazwie już istnieje!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             try
             {
                 File.Create(path).Close();
                 TextEditor te = new TextEditor();
                 te.Load(new FileInfo(path), this.tabs);
                 new FakeChildNode(i);
             }
             catch (System.ArgumentException)
             {
                 MessageBox.Show("Podana nazwa pliku jest nieprawidłowa!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else if (base.SelectedNode is RemoteDirectoryNode)
     {
         RemoteDirectoryNode i = (RemoteDirectoryNode)base.SelectedNode;
         string newName = Dialogs.TextInput.ShowDialog("Nowy plik", "Podaj nazwę nowego pliku:", "", "Utwórz plik", "Anuluj");
         if (newName != "")
         {
             File.Create(Utils.Main.TempDirectory + newName).Close();
             Utils.Ftp.upload(i.data, i.directory + newName, Utils.Main.TempDirectory + newName);
             i.Refresh();
         }
     }
 }