示例#1
0
 public static string Show(string question, string defaultAnswer)
 {
     var w = new InputBox();
     w.QuestionLabel.Content = question;
     w.AnswerTextBox.Text = defaultAnswer;
     if (w.ShowDialog() == true)
         return w.AnswerTextBox.Text ?? "";
     else
         return null;
 }
示例#2
0
        private static void LooseMass(Materials material)
        {
            var result = false;
            var mass = 0.0;

            while (!result)
            {
                var dialog = new InputBox
                {
                    Caption = string.Format("Введите массу {0} в килограммах:", material.ToGenitive()),
                    ShowInTaskbar = false,
                    Topmost = true
                };

                var showDialog = dialog.ShowDialog();
                if (!showDialog.HasValue || !showDialog.Value) return;

                result = double.TryParse(dialog.ResponseText, NumberStyles.Number, CultureInfo.InstalledUICulture, out mass);
            }

            var substance = Tube.FindSubstance<Навеска>(material);
            substance.G = mass / 1000.0;
        }
 public void OnRename()
 {
     if (window.FileTreeView.TreeContent.SelectedItem !=null)
     {
         InputBox inputbox = new InputBox("Rename", "Please Input New Name", CurrentSelectFile.Name);
         if (inputbox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             using (var client = Client(CurrentServer.EndPoint as EndpointAddress))
             {
                 if (client != null)
                 {
                     var tmp = client.Rename(CurrentSelectFile.Path,inputbox.Result, CurrentSelectFile.IsFile);
                     if (tmp.IsSuccess)
                     {
                         OnRefresh(client);
                     }
                     else
                         MessageBox.Show(tmp.Message);
                 }
             }
         }
     }
 }
        public void OnCreate()
        {
            if (window.FileTreeView.TreeContent.SelectedItem !=null)
            {

                if (!CurrentSelectFile.IsFile)
                {
                    InputBox inputbox = new InputBox("Folder Create", "Please Input Folder Name");
                    if (inputbox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        using (var client = Client(CurrentServer.EndPoint as EndpointAddress))
                        {
                            if (client != null)
                            {
                                var tmp = client.FolderAction(CurrentSelectFile.Path + "\\" + inputbox.Result, false);
                                if (tmp.IsSuccess)
                                {
                                    OnRefresh(client);
                                }
                                else
                                    MessageBox.Show(tmp.Message);
                            }
                        }
                    }
                }
            }
        }