Show() public static method

Displays a message box that has a message and that returns a result.
public static Show ( Window owner, string messageText ) : MessageBoxResult
owner System.Windows.Window A System.Windows.Window that represents the owner of the MessageBox
messageText string A System.String that specifies the text to display.
return MessageBoxResult
示例#1
0
        private void OpenMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var openDialog = new FolderBrowserDialog
            {
                BrowseFiles  = false,
                BrowseShares = true,
                Title        = "Select an ECMA XML documentation directory:"
            };

            if (openDialog.ShowDialog(this) == true)
            {
                var docsDir = Path.Combine(openDialog.SelectedPath, "en");
                if (Directory.Exists(docsDir) && File.Exists(Path.Combine(docsDir, "index.xml")))
                {
                    // save the last opened docs
                    Settings.Default.LastUsedPath = docsDir;
                    Settings.Default.Save();

                    OpenDirectory(docsDir);
                }
                else
                {
                    MessageBox.Show(
                        "The selected directory is not the toplevel directory for ECMA XML documentation. Those should contain a subdirectory 'en' and a file 'en\\index.xml'",
                        "Not an ECMA XML Documentation Directory",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                }
            }
        }
 private void tbEancode_LostFocus(object sender, RoutedEventArgs e)
 {
     if ((tbEancode.Text.Length > 13 || tbEancode.Text.Length < 13) && tbEancode.Text != "")
     {
         MessageBox.Show("Eancode moet altijd uit 13 characters bestaan");
         tbEancode.Text = "";
     }
 }
示例#3
0
        private void btnHistory_Click(object sender, RoutedEventArgs e)
        {
            string email = tbEmail.Text;

            if (string.IsNullOrEmpty(email))
            {
                MSB.Show("Nieustawiony email.", "Historia zamówień", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var dr = MSB.Show("Zostanie wysłany email na wskazany adres z tokenem, który należy uzupełnić?", "Historia zamówień", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (dr != MessageBoxResult.Yes)
            {
                return;
            }

            bool historyLock = true;

            try
            {
                Random r     = new Random();
                string token = r.Next(99999).ToString().PadLeft(5, '0');

                new Resender().SendToken(email, token);
                MSB.Show("Email wysłany.", "Historia zamówień", MessageBoxButton.OK, MessageBoxImage.Information);

                while (true)
                {
                    InputWindow input       = new InputWindow("Wprowadź token");
                    var         inputResult = input.ShowDialog();
                    if (inputResult == false)
                    {
                        historyLock = true;
                        break;
                    }
                    if (input.Value == token)
                    {
                        historyLock = false;
                        break;
                    }
                    else
                    {
                        MSB.Show("Błędny token. Spróbuj jeszcze raz.", "Historia zamówień", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MSB.Show(ex.Message, "Historia zamówień", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (!historyLock)
            {
                OrdersHistory history = new OrdersHistory(email);
                history.Show();
            }
        }
        private void generateReportButton_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            if (firefighters.calcTimeSpent(true) &&
                getGlobalData(ref data))
            {
                var pdfGen = new SalaryReport(data, this.firefighters);
                pdfGen.openCreated();
            }
            else
            {
                MessageBox.Show("Nie wszystkie dane są poprawnie uzupełnione.");
            }
        }
    //public Texture2D GetTextureFromFileIndex(int index)
    //{
    //    if (fileInfos == null || index >= fileInfos.Length)
    //        return null;

    //    return GetTextureFromFileInfo(fileInfos[index]);
    //}

    public BitmapImage GetBitmapFromFileInfo(FileInfo fileInfo)
    {
        BitmapImage bi = new BitmapImage();

        bi.BeginInit();
        bi.UriSource = new Uri(fileInfo.FullName);
        bi.EndInit();

        if (bi == null)
        {
            MessageBox.Show("Something is wrong with the processed Texture named " + fileInfo.Name, "", MessageBoxButton.OK, MessageBoxImage.Error);
            return(null);
        }

        return(bi);
    }
示例#6
0
        private void CanvasPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (IsMultiSelecting)
            {
                var geometry       = new RectangleGeometry(new Rect(SelectionSquareTopLeft, e.GetPosition(CanvasPanel)));
                var visualInRegion = CanvasPanel.GetVisuals(geometry);

                MessageBox.Show($"选中数量:{visualInRegion.Count}");
                IsMultiSelecting = false;
                CanvasPanel.RemoveVisual(SelectionSquare);
                CanvasPanel.ReleaseMouseCapture();
            }
            else
            {
                IsDragging = false;
            }
        }
        private void ApplyButton_Click(object sender, RoutedEventArgs e)
        {
            // save the configuration
            commonSet.SaveConfiguration();

            // apply the autostart setting
            commonSet.ApplyAutoStartSetting(AutoStartCheckBox.IsChecked.Value);

            // save the time of next printing
            commonSet.ComputeNextTime();
            commonSet.SaveNextTime();

            MessageBox.Show("Configuration saved");

            // update scheduled time
            commonSet.LoadNextTime();
            ScheduledTimeTextBlock.Text = commonSet.loadedNextPrintingTime.ToString();
        }
示例#8
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (order.OrderItems.Count == 0)
            {
                MSB.Show("Brak produktów.", "Składanie zamówienia", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (string.IsNullOrEmpty(tbEmail.Text))
            {
                MSB.Show("Nieustawiony email.", "Składanie zamówienia", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var dr = MSB.Show("Złożyć zamówienie?", "Składanie zamówienia", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (dr != MessageBoxResult.Yes)
            {
                return;
            }

            order.Date     = DateTime.Now;
            order.Email    = tbEmail.Text;
            order.Comments = tbComments.Text;

            try
            {
                service.AddOrder(order);
                MSB.Show("Zamównie przyjęte.", "Składanie zamówienia", MessageBoxButton.OK, MessageBoxImage.Information);

                new Resender().SendOrderMessage(order);
                MSB.Show("Email wysłany.", "Składanie zamówienia", MessageBoxButton.OK, MessageBoxImage.Information);
                order.EmailSent = true;
                service.SaveChanges();

                this.Close();
            }
            catch (Exception ex)
            {
                MSB.Show(ex.Message, "Składanie zamówienia", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void btnBestandLaden_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Json Files(*.json)|*json";
            openFileDialog.InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
            openFileDialog.ShowDialog();
            string bestand = openFileDialog.FileName;

            if (bestand != "")
            {
                JObject jObject = JObject.Parse(File.ReadAllText(bestand));
                dynamic dynO    = jObject;

                Product ingeladenProduct = new Product();
                ingeladenProduct.EanCode       = dynO.EanCode;
                ingeladenProduct.Naam          = dynO.Naam;
                ingeladenProduct.Inkoopprijs   = dynO.Inkoopprijs;
                ingeladenProduct.Eenheid       = dynO.Eenheid;
                ingeladenProduct.BTW           = dynO.BTW;
                ingeladenProduct.LeverancierID = dynO.LeverancierID;

                if (ctx.Product.Where(p => p.EanCode == ingeladenProduct.EanCode).Count() != 0)
                {
                    var result = MessageBox.Show($"Er is reeds een product met Eannummer {ingeladenProduct.EanCode}. Wil je dit product aanpassen?", "", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.No)
                    {
                        this.Close();
                    }
                }

                tbEancode.Text     = ingeladenProduct.EanCode;
                tbNaam.Text        = ingeladenProduct.Naam;
                tbInkoopprijs.Text = ingeladenProduct.Inkoopprijs.ToString();
                tbEenheid.Text     = ingeladenProduct.Eenheid;
                cbBTW.SelectedItem = (short)ingeladenProduct.BTW;
                Leverancier geselecteerdeLeverancier = ctx.Leverancier.Where(l => l.LeverancierID == ingeladenProduct.LeverancierID).FirstOrDefault();
                lbLeverancier.SelectedItem = geselecteerdeLeverancier;
            }
        }
        private void tbEancode_TextChanged(object sender, TextChangedEventArgs e)
        {
            string eancode = tbEancode.Text;

            if (ctx.Product.Where(p => p.EanCode == eancode).Count() != 0 && isNieuwProduct)
            {
                var result = MessageBox.Show($"Er is reeds een product met Eannummer {eancode}. Wil je dit product aanpassen?", "", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.No)
                {
                    tbEancode.Text = string.Empty;
                }
                else
                {
                    Product            product = ctx.Product.Where(p => p.EanCode == eancode).FirstOrDefault();
                    NieuwProductWindow window  = new NieuwProductWindow(product);
                    if ((bool)window.ShowDialog())
                    {
                        DialogResult = true;
                    }
                }
            }
        }
示例#11
0
        public ImportModules()
        {
//            TODO: WORK PATH BELOW
            rootPath = @"D:\OOP\OOP\Lab1\PictureDraw\Modules";
            modules  = new List <Assembly>();
            var directory = new DirectoryInfo(rootPath);

            foreach (var file in directory.GetFiles("*.dll"))
            {
                try
                {
                    if (RSACrypt.VerifySignedHash(File.ReadAllBytes(file.FullName), File.ReadAllText(@"G:\public.xml")))
                    {
                        modules.Add(Assembly.LoadFrom(file.FullName));
                    }
                }
                catch
                {
                    MessageBox.Show($@"Sorry, but {rootPath}\{file} was damaged. Please, fix or remove it.", "Load error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
示例#12
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            _proxy.NativeFeedReceived += ProxyOnNativeFeedReceived;
            _proxy.Start();

            MainGrid.DataContext = _vm;

            IEnumerable <DualShockProfile> list = null;

            try
            {
                list = _proxy.GetProfiles();
            }
            catch (Exception err)
            {
                MessageBox.Show($"Can't load profiles. Error {err.Message}");
            }
            if (list == null)
            {
                list = new List <DualShockProfile>();
            }

            _vm.Profiles = list.ToList();
        }
        private void btnOpslaan_Click(object sender, RoutedEventArgs e)
        {
            if (tbNaam.Text == "")
            {
                geldigeIngave = false;
            }
            if (tbEancode.Text == "")
            {
                geldigeIngave = false;
            }
            if (tbInkoopprijs.Value == null)
            {
                geldigeIngave = false;
            }
            if (tbEenheid.Text == "")
            {
                geldigeIngave = false;
            }
            if (cbBTW.SelectedIndex == -1)
            {
                geldigeIngave = false;
            }
            if (tbMarge.Value == null)
            {
                geldigeIngave = false;
            }
            if (cbCategorie.SelectedIndex == -1)
            {
                geldigeIngave = false;
            }
            if (lbLeverancier.SelectedIndex == -1)
            {
                geldigeIngave = false;
            }



            if (geldigeIngave)
            {
                geselecteerdProduct.Naam        = tbNaam.Text;
                geselecteerdProduct.EanCode     = tbEancode.Text;
                geselecteerdProduct.Inkoopprijs = tbInkoopprijs.Value;
                geselecteerdProduct.Eenheid     = tbEenheid.Text;
                geselecteerdProduct.BTW         = Convert.ToInt32((short)cbBTW.SelectedItem);
                geselecteerdProduct.Marge       = tbMarge.Value;
                categorie   = (Categorie)cbCategorie.SelectedItem;
                leverancier = (Leverancier)lbLeverancier.SelectedItem;
                geselecteerdProduct.CategorieID   = (int)categorie.CategorieID;
                geselecteerdProduct.LeverancierID = (int)leverancier.LeverancierID;

                var result = MessageBox.Show("Productgegevens opslaan?", "Gegevens opslaan?", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    if (isNieuwProduct)
                    {
                        ctx.Product.Add(geselecteerdProduct);
                    }
                    ctx.SaveChanges();
                    DialogResult = true;
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Gelieve alle velden correct in te vullen");
                geldigeIngave = true;
            }
        }