Example #1
0
        internal static void CreateNewFile(NodejsProjectNode projectNode, uint containerId)
        {
            using (var dialog = new NewFileNameForm(""))
            {
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var itemName = dialog.TextBox.Text;
                    if (string.IsNullOrWhiteSpace(itemName))
                    {
                        return;
                    }
                    itemName = itemName.Trim();

                    var pResult = new VSADDRESULT[1];
                    projectNode.AddItem(
                        containerId,                                 // Identifier of the container folder.
                        VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,    // Indicate that we want to create this new file by cloning a template file.
                        itemName,
                        1,                                           // Number of templates in the next parameter. Must be 1 if using VSADDITEMOP_CLONEFILE.
                        new string[] { Path.GetTempFileName() },     // Array contains the template file path.
                        IntPtr.Zero,                                 // Handle to the Add Item dialog box. Must be Zero if using VSADDITEMOP_CLONEFILE.
                        pResult);
                }
            }
        }
Example #2
0
        private static void CreateNewFile(NodejsProjectNode projectNode, uint containerId, string fileType)
        {
            using (var dialog = new NewFileNameForm(GetInitialName(fileType))) {
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string itemName = dialog.TextBox.Text;

                    VSADDRESULT[] pResult = new VSADDRESULT[1];
                    projectNode.AddItem(
                        containerId,                                 // Identifier of the container folder.
                        VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,    // Indicate that we want to create this new file by cloning a template file.
                        itemName,
                        1,                                           // Number of templates in the next parameter. Must be 1 if using VSADDITEMOP_CLONEFILE.
                        new string[] { Path.GetTempFileName() },     // Array contains the template file path.
                        IntPtr.Zero,                                 // Handle to the Add Item dialog box. Must be Zero if using VSADDITEMOP_CLONEFILE.
                        pResult);
                }
            }
        }
Example #3
0
        private static void CreateNewFile(NodejsProjectNode projectNode, uint containerId, string fileType) {
            using (var dialog = new NewFileNameForm(GetInitialName(fileType))) {
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                    string itemName = dialog.TextBox.Text;

                    VSADDRESULT[] pResult = new VSADDRESULT[1];
                    projectNode.AddItem(
                        containerId,                                 // Identifier of the container folder. 
                        VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,    // Indicate that we want to create this new file by cloning a template file.
                        itemName,
                        1,                                           // Number of templates in the next parameter. Must be 1 if using VSADDITEMOP_CLONEFILE.
                        new string[] { GetTemplateFile(fileType) },  // Array contains the template file path.
                        IntPtr.Zero,                                 // Handle to the Add Item dialog box. Must be Zero if using VSADDITEMOP_CLONEFILE.
                        pResult
                    );

                    // TODO: Do we need to check if result[0] = VSADDRESULT.ADDRESULT_Success here?
                }
            }
        }
        internal static void CreateNewFile(NodejsProjectNode projectNode, uint containerId) {
            using (var dialog = new NewFileNameForm("")) {
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                    string itemName = dialog.TextBox.Text;
                    if (string.IsNullOrWhiteSpace(itemName)) {
                        return;
                    }
                    itemName = itemName.Trim();

                    VSADDRESULT[] pResult = new VSADDRESULT[1];
                    projectNode.AddItem(
                        containerId,                                 // Identifier of the container folder. 
                        VSADDITEMOPERATION.VSADDITEMOP_CLONEFILE,    // Indicate that we want to create this new file by cloning a template file.
                        itemName,
                        1,                                           // Number of templates in the next parameter. Must be 1 if using VSADDITEMOP_CLONEFILE.
                        new string[] { Path.GetTempFileName() },     // Array contains the template file path.
                        IntPtr.Zero,                                 // Handle to the Add Item dialog box. Must be Zero if using VSADDITEMOP_CLONEFILE.
                        pResult);
                }
            }
        }
Example #5
0
 private void Rename_Click(object sender, System.EventArgs e)
 {
     try {
         NewFileNameForm f = new NewFileNameForm();
         f.ShowDialog();
         Object tag =listViewRemote.SelectedItems[0].Tag;
         IFtpItem item = (IFtpItem)tag;
         item.Name = f.FileName;
         FillListView();
     }catch(FtpException fe) {
         MessageBox.Show(fe.Message + " " + fe.ResponseMessage);
     }
 }
Example #6
0
 private void CreateRemoteFile_Click(object sender, System.EventArgs e)
 {
     try {
         NewFileNameForm f = new NewFileNameForm();
         f.ShowDialog();
         ftpSession.CurrentDirectory.CreateFile(f.FileName);
         ftpSession.CurrentDirectory.Refresh();
         FillListView();
     }catch(FtpException fe) {
         MessageBox.Show(fe.Message + " " + fe.ResponseMessage);
     }
 }