コード例 #1
0
ファイル: InputDialog.cs プロジェクト: ipriel/nocs2
        public string InputBox(string prompt, string title, string defaultInput)
        {
            // we'll create a new instance of the class and set the given arguments as properties
            var ib = new InputDialog
            {
                FormPrompt   = prompt,
                FormCaption  = title,
                DefaultValue = defaultInput
            };

            // show the actual dialog
            ib.ShowDialog();

            // retrieve the response string, close the dialog and return the string
            var response = ib.InputResponse;

            ib.Close();
            return(response);
        }
コード例 #2
0
        private void MenuCreateFolderClick(object sender, EventArgs e)
        {
            // let's get a name for the new folder
            var inputDialog = new InputDialog();
            var folderName  = inputDialog.InputBox("Enter a name for a new folder:", "Create folder", string.Empty);

            if (!string.IsNullOrEmpty(folderName))
            {
                // let's run the backgroundworker for renaming an item
                boxWorking.Visible  = true;
                lblError.Visible    = false;
                lstItems.Enabled    = false;
                treeFolders.Enabled = false;

                DisableActions();

                // let's create a new folder with the given name
                var arguments = new object[] { folderName };
                BgWorkerCreateFolder.RunWorkerAsync(arguments);
            }
        }
コード例 #3
0
        private void RenameEntry(Document docEntry)
        {
            // let's get a new name
            var inputDialog = new InputDialog();
            var newTitle    = inputDialog.InputBox("Enter a new name for '" + docEntry.Title + "':", "Rename", docEntry.Title);

            if (!string.IsNullOrEmpty(newTitle))
            {
                // let's run the backgroundworker for renaming an item
                boxWorking.Visible  = true;
                lblError.Visible    = false;
                lstItems.Enabled    = false;
                treeFolders.Enabled = false;

                DisableActions();

                // let's get the documentId and rename the document
                var arguments = new object[] { docEntry.ResourceId, newTitle, docEntry.Type };
                BgWorkerRenameEntry.RunWorkerAsync(arguments);
            }
        }