Show() public static méthode

public static Show ( string title, string message, bool onDarkBackground = false ) : bool
title string
message string
onDarkBackground bool
Résultat bool
Exemple #1
0
        private void SavePlusButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                if (this.currentTabIndex >= 0)
                {
                    try
                    {
                        SaveFileDialog dlg = new SaveFileDialog();
                        if (this.currentTabIndex >= 0 && this.tab[this.currentTabIndex].FullFileName != null)
                        {
                            string initialDirectory = System.IO.Path.GetDirectoryName(this.tab[this.currentTabIndex].FullFileName);
                            if (initialDirectory != null && initialDirectory.Length != 0)
                            {
                                dlg.InitialDirectory = initialDirectory;
                            }
                        }

                        FileExtensions flex = new FileExtensions();
                        dlg.Filter = flex.GetFilterString();
                        if (dlg.ShowDialog(this) ?? false)
                        {
                            this.tab[this.currentTabIndex].SaveFile(dlg.FileName);
                        }
                    }
                    catch (Exception exception)
                    {
                        StyledMessageBox.Show("ERROR", "Error Saving File" + exception.ToString());
                    }
                }
            }
            e.Handled = true;
        }
Exemple #2
0
        internal void fileChangedWatcher_ChangedInUIThread(System.IO.FileSystemEventArgs e)
        {
            double originalOpacity = this.Title.Opacity;

            this.Title.Opacity = 0.2;
            if (StyledMessageBox.Show("FILE MODIFIED", e.FullPath + "\n\nwas modified outside this application, do you want to reload ?"))
            {
                this.OpenFile(this.fullFileName);
                System.Threading.Interlocked.Exchange(ref this.lastFileChangeTime, System.DateTime.Now.AddSeconds(2).Ticks);
            }
            this.Title.Opacity = originalOpacity;
            showFileModifiedDialog.Release();
        }
Exemple #3
0
        private void CommandSave(object sender, ExecutedRoutedEventArgs e)
        {
            if (this.currentTabIndex >= 0)
            {
                try
                {
                    bool fileSaved = false;
                    if (this.tab[this.currentTabIndex].FullFileName != null)
                    {
                        this.tab[this.currentTabIndex].SaveFile(this.tab[this.currentTabIndex].FullFileName);
                        fileSaved = true;
                    }
                    else
                    {
                        SaveFileDialog dlg  = new SaveFileDialog();
                        FileExtensions flex = new FileExtensions();
                        dlg.Filter = flex.GetFilterString();
                        if (this.currentTabIndex >= 0 && this.tab[this.currentTabIndex].FullFileName != null)
                        {
                            string initialDirectory = System.IO.Path.GetDirectoryName(this.tab[this.currentTabIndex].FullFileName);
                            if (initialDirectory != null && initialDirectory.Length != 0)
                            {
                                dlg.InitialDirectory = initialDirectory;
                            }
                        }

                        if (dlg.ShowDialog(this) ?? false)
                        {
                            this.tab[this.currentTabIndex].SaveFile(dlg.FileName);
                            fileSaved = true;
                        }
                    }
                    if (fileSaved)
                    {
                        this.SetStatusText("FILE SAVED");
                        System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
                        dispatcherTimer.Tick    += new EventHandler(SaveDispatcherTimer_Tick);
                        dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                        dispatcherTimer.Start();
                    }
                }
                catch (Exception exception)
                {
                    StyledMessageBox.Show("ERROR", "Error Saving File" + exception.ToString());
                }
            }
        }
Exemple #4
0
        private void HTMLTidyProcessFile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                String  tidyHTML   = "";
                TidyNet objTidyNet = new TidyNet();

                // Set up options
                objTidyNet.Option.Clean(true);
                objTidyNet.Option.NewInlineTags("tidy");
                objTidyNet.Option.OutputType(EfTidyNet.EfTidyOpt.EOutputType.XhtmlOut);
                objTidyNet.Option.DoctypeMode(EfTidyNet.EfTidyOpt.EDoctypeModes.DoctypeAuto);
                objTidyNet.Option.Indent(EfTidyNet.EfTidyOpt.EIndentScheme.AUTOINDENT);
                objTidyNet.Option.TabSize(4);
                objTidyNet.Option.IndentSpace(4);

                objTidyNet.TidyMemToMem(CurrentTab().TextEditor.Text, ref tidyHTML);

                int totalWarnings = 0;
                int totalErrors   = 0;
                objTidyNet.TotalWarnings(ref totalWarnings);
                objTidyNet.TotalErrors(ref totalErrors);
                string error = objTidyNet.ErrorWarning();

                if (StyledMessageBox.Show("HTML TIDY FINISHED WITH " + totalErrors.ToString() + " ERRORS AND " + totalWarnings.ToString() + " WARNINGS",
                                          error,
                                          true))
                {
                    CurrentTab().TextEditor.ReplaceText(0, CurrentTab().TextEditor.Text.Length, tidyHTML);
                }
                this.CancelSettingsUI();
            }
            catch
            {
            }
        }
Exemple #5
0
        private void CheckForUpdates_Click(object sender, RoutedEventArgs e)
        {
            UpdateCheckInfo info = null;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                try
                {
                    info = ad.CheckForDetailedUpdate();
                }
                catch (DeploymentDownloadException dde)
                {
                    StyledMessageBox.Show("UPDATE", "The new version of the application cannot be downloaded at this time.\nPlease check your network connection, or try again later. Error: " + dde.Message, true);
                    return;
                }
                catch (InvalidDeploymentException ide)
                {
                    StyledMessageBox.Show("UPDATE", "Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message, true);
                    return;
                }
                catch (InvalidOperationException ioe)
                {
                    StyledMessageBox.Show("UPDATE", "This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message, true);
                    return;
                }

                if (info.UpdateAvailable)
                {
                    Boolean doUpdate = true;

                    if (!info.IsUpdateRequired)
                    {
                        if (!StyledMessageBox.Show("UPDATE", "An update is available. Choose OK to start update.", true))
                        {
                            doUpdate = false;
                        }
                    }
                    else
                    {
                        // Display a message that the app MUST reboot. Display the minimum required version.
                        StyledMessageBox.Show("UPDATE", "This application has detected a mandatory update from your current " +
                                              "version to version " + info.MinimumRequiredVersion.ToString() + ". The application will now install the update.", true);
                    }

                    if (doUpdate)
                    {
                        try
                        {
                            ad.Update();
                            StyledMessageBox.Show("UPDATE", "The application has been upgraded, please save your work and restart application.", true);
                        }
                        catch (DeploymentDownloadException dde)
                        {
                            StyledMessageBox.Show("UPDATE", "Cannot install the latest version of the application.\nPlease check your network connection, or try again later. Error: " + dde, true);
                            return;
                        }
                    }
                }
                else
                {
                    StyledMessageBox.Show("UPDATE", "You already have the latest version of this application.", true);
                }
            }
        }