コード例 #1
0
ファイル: PromptWindow.cs プロジェクト: PotroChen/CLToolKit
    static void Create(string tipText)
    {
        PromptWindow window = (PromptWindow)EditorWindow.GetWindow(typeof(PromptWindow));

        window.tipText = tipText;
        window.Show();
    }
コード例 #2
0
        private void OnCreateFolderButtonClick(object sender, RoutedEventArgs e)
        {
            var prompt = new PromptWindow();

            prompt.SetTitle("请输入文件夹名称");
            prompt.OnOk += OnInputFolderNameOk;
            prompt.Show();
        }
コード例 #3
0
        private void Wizzard()
        {
            var result = MessageBox.Show("Hi. You must give me paths to your builder and EGW project. Can I run wizzard to create start link?",
                                         MyApp.AppSettings.ApplicationNameWithVersion,
                                         MessageBoxButton.OKCancel,
                                         MessageBoxImage.Question,
                                         MessageBoxResult.OK
                                         );

            if (result != MessageBoxResult.OK)
            {
                Env.Exit(1);
            }

            string builderFolder = null;

            using (var folderDialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                MyApp.ShowMessage("Step 1: Give me EGW builder folder.");
                folderDialog.ShowNewFolderButton = false;
                var folderResult = folderDialog.ShowDialog();
                if (folderResult != System.Windows.Forms.DialogResult.OK)
                {
                    Env.Exit(2);
                }
                builderFolder = folderDialog.SelectedPath;
            }
            string egwFolder = null;

            using (var folderDialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                MyApp.ShowMessage("Step 2: Give me folder with EGW subApps.");
                folderDialog.ShowNewFolderButton = false;
                var folderResult = folderDialog.ShowDialog();
                if (folderResult != System.Windows.Forms.DialogResult.OK)
                {
                    Env.Exit(2);
                }
                egwFolder = folderDialog.SelectedPath;
            }

            var fileName = PromptWindow.Show("Step 3: Name of lnk file", "EGW builder", "Enter filename without extension");

            var          shell           = new WshShell();
            string       shortcutAddress = Path.Combine(egwFolder, fileName) + ".lnk";
            IWshShortcut shortcut        = (IWshShortcut)shell.CreateShortcut(shortcutAddress);

            shortcut.TargetPath       = System.Reflection.Assembly.GetExecutingAssembly().Location;
            shortcut.WorkingDirectory = MyApp.ExeDir;
            shortcut.IconLocation     = System.Reflection.Assembly.GetExecutingAssembly().Location + ",0";
            shortcut.Arguments        = $"\"{builderFolder}\" \"{egwFolder}\"";
            shortcut.Save();

            MyApp.ShowMessage("Link created. I am going to open target folder and you can use it. Bye.");
            Process.Start(egwFolder);
            Env.Exit(0);
        }
コード例 #4
0
 private void ButtonBirefDescription_Click(object sender, RoutedEventArgs e)
 {
     if (!Global.IsOpenPrompt)
     {
         Global.IsOpenPrompt = true;
         PromptWindow window = new PromptWindow()
         {
             _HintStr = _item.HintStr
         };
         window.Show();
     }
 }
コード例 #5
0
        private void OnRenameContextMenuClick(object sender, RoutedEventArgs e)
        {
            var fse = mouseElement.DataContext as FileSystemEntity;

            if (fse == null)
            {
                return;
            }
            var dlg = new PromptWindow();

            dlg.SetTitle("请输入新的文件夹名称");
            dlg.OnOk += (oo, ee) =>
            {
                string strName = dlg.InputText;
                if (string.IsNullOrEmpty(strName) || strName.Equals(fse.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    return;
                }
                var source = FileBrowseListBox.ItemsSource as List <FileSystemEntity>;
                if (source != null && source.Any(o => o.Type == FileSystemEntityType.Folder &&
                                                 o.Name.Equals(strName, StringComparison.CurrentCultureIgnoreCase) &&
                                                 o.FolderId != fse.FolderId))
                {
                    CustomMessageBox.Alert("新的文件夹名称与其他文件夹名重复!");
                    return;
                }
                BusyIndicator1.IsBusy      = true;
                BusyIndicator1.BusyContent = "正在执行...";
                docContext.RenameFolder(fse.FolderId, strName, obj =>
                {
                    BusyIndicator1.IsBusy = false;
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        if (obj.Value > 0)
                        {
                            fse.Name = strName;
                        }
                        else
                        {
                            CustomMessageBox.Show("重命名失败!错误码:" + obj.Value);
                        }
                    }
                }, null);
            };
            dlg.Show();
        }
コード例 #6
0
        public Task <PromptButton> Show(Window ownerWindow = null)
        {
            _completionSource?.TrySetResult(null);

            Close();

            _completionSource = new TaskCompletionSource <PromptButton>();
            _promptWindow     = new PromptWindow
            {
                DataContext = this,
                Owner       = ownerWindow
            };

            _promptWindow.Show();

            return(_completionSource.Task);
        }
コード例 #7
0
        private void ButtonBirefDescription_Click(object sender, RoutedEventArgs e)
        {
            string path = string.Format(@"{0}\KnowledgeBbase\检测项目操作说明\{1}.rtf", Environment.CurrentDirectory, _item.Name.Replace("*", ""));

            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                Global.IsOpenPrompt = true;
                PromptWindow window = new PromptWindow()
                {
                    _HintStr = _item.HintStr
                };
                window.Show();
            }
            else
            {
                TechnologeDocument window = new TechnologeDocument();
                window.path          = path;
                window.ShowInTaskbar = false;
                window.Topmost       = true;
                window.Owner         = this;
                window.Show();
            }
        }
コード例 #8
0
 /// <summary>
 /// Shows the prompt window used to get roster info from user.
 /// </summary>
 private void LaunchPromptWindow()
 {
     PromptWindow.Show();
 }