示例#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);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// The display game over.
        /// </summary>
        /// <param name="gameResult">
        /// The game result.
        /// </param>
        public void DisplayGameOver(bool gameResult)
        {
            this.isGridInitialized = false;

            if (gameResult == false)
            {
                MessageBox.Show("Game Over!", "Minesweeper", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                var unprotectedButtons = this.buttons.Where(b => (string)b.Content == string.Empty);
                foreach (var upb in unprotectedButtons)
                {
                    upb.Background = this.images[1];
                }

                var protectedButtons = this.buttons.Where(b => b.Background.Equals(this.images[1]));
                foreach (var pb in protectedButtons)
                {
                    pb.IsHitTestVisible = false;
                }

                var inputBox = new InputBox(this.PlayerAdd);
                inputBox.Show();
            }
        }
        private void New_Click(object sender, RoutedEventArgs e)
        {
            Save.IsEnabled = true;
            inputBox = new InputBox();
            inputBox.Show();
            level.blocks = new List<GObject>();
            level.gums = new List<GObject>();
            level.bonus = new List<GObject>();
            canvas1.Children.Clear();

            scrollBar1.Maximum = level.lenghtLevel;
            scrollBar1.Value = 0;
        }