当前位置: 首页>>代码示例>>C#>>正文


C# Error.ShowDialog方法代码示例

本文整理汇总了C#中Error.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# Error.ShowDialog方法的具体用法?C# Error.ShowDialog怎么用?C# Error.ShowDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: App

        public App()
        {
            AppDomain.CurrentDomain.UnhandledException += async (sender, args) =>
            {
                _ex = (Exception)args.ExceptionObject;
                await Current.Dispatcher.InvokeAsync(() =>
                {
                    Error error = new Error
                    {
                        ErrorTitle = _ex.GetType().Name,
                        ErrorContent =
                            string.Format(
                                "*** ERROR on {0} ***\n\n{1}\n\n*** ERROR ***\n\n*** INNER EXCEPTION ***\n\n{2}\n\n*** INNER EXCEPTION ***\n\n*** STACK TRACE ***\n\n{3}\n\n*** STACK TRACE ***\n\n",
                                DateTime.Now, _ex.Message, _ex.InnerException, _ex.StackTrace)
                    };
                    error.ShowDialog();
                });
            };

            Current.LoadCompleted += async (sender, e) =>
            {
                await Current.Dispatcher.InvokeAsync(async () =>
                {
                    await _adb.Prepare();
                    await _fastboot.Prepare();
                });
            };


        }
开发者ID:pzlatjava,项目名称:Android-ToolkitV2,代码行数:30,代码来源:App.xaml.cs

示例2: MyHandler

 private static void MyHandler(object sender, UnhandledExceptionEventArgs args)
 {
     Exception e = (Exception)args.ExceptionObject;
     Error errorWindow = new Error(e);
     errorWindow.ShowDialog();
     Environment.Exit(-1);
 }
开发者ID:Gordon-Beeming,项目名称:ControlledVocabulary,代码行数:7,代码来源:App.xaml.cs

示例3: CallErrorWindows

 public void CallErrorWindows(Exception ex, string exeptionLocate)
 {
     var errorMessage = String.Format("{2}: Application was crashad at {0} function with exeption: {1}",
         exeptionLocate, System.Environment.NewLine + ex.Message + " " + ex.InnerException, DateTime.Now);
     var dateTime = DateTime.Now.ToString("yyyyMMddHHmmss",CultureInfo.InvariantCulture);
     File.WriteAllText("launcherError_" + dateTime + ".log", errorMessage);
     var errorWindow = new Error(_mainindow, errorMessage);
     errorWindow.ShowDialog();
 }
开发者ID:ktoMOD,项目名称:ExMachinaConversionLauncher,代码行数:9,代码来源:ErrorHandler.cs

示例4: Error

        protected void Error(Exception ex)
        {
            try
            {
                var stackTrace = new StackTrace();
                var callFrame = stackTrace.GetFrame(stackTrace.FrameCount - 2);
                Debug.WriteLine(string.Format("Exception in {0}", callFrame.GetMethod()));
            }
            catch {}

            Debug.WriteLine(ex.ToString());

            var errorDialog = new Error(ex);
            if (this.InvokeRequired)
                this.Invoke(new Action(() => errorDialog.ShowDialog(this)));
            else
                errorDialog.ShowDialog(this);
        }
开发者ID:calvin-fisher,项目名称:LinkMaker,代码行数:18,代码来源:Main.cs

示例5: CurrentDomain_UnhandledException

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                Exception ex = (Exception)e.ExceptionObject;

                Error errorFrm = new Error(ex.Message + ex.StackTrace);
                errorFrm.ShowDialog();
            }
            finally
            {
                _initializer.ExitThread();
            }
        }
开发者ID:ColdVolcano,项目名称:StreamCompanion,代码行数:14,代码来源:Program.cs

示例6: button1_KeyDown

 private void button1_KeyDown(object sender, KeyEventArgs e)
 {
     Console.WriteLine(e.KeyCode.ToString());
     for (int i = 0; i < counter; i++) {
         if (AreaButton1[i].Name == e.KeyCode.ToString()) {
             try
             {
                 AreaPlayer = new System.Media.SoundPlayer(AreaFileText[i].Text.ToString());
                 AreaPlayer.Play();
             }
             catch (Exception x) {
                 err = new Error(x.Message);
                 err.ShowDialog();
             }
         }
     }
 }
开发者ID:TheRealNOIG,项目名称:SoundPlayer,代码行数:17,代码来源:Form1.cs

示例7: aboutButton_Click

        private void aboutButton_Click(object sender, EventArgs e)
        {
            try
            {
                new About().doAbout(Game);
            }
            catch(Exception ex)
            {
                Error er = new Error();

                er.doErrorMsg("There was an error showing the about dialog.", ex);
                if (er.ShowDialog() == DialogResult.Abort)
                {
                    Application.Exit();
                }
            }
        }
开发者ID:jansky,项目名称:XMLAdventureGame,代码行数:17,代码来源:AGWindow.cs

示例8: btnJoinNetwork_Click

        private void btnJoinNetwork_Click(object sender, EventArgs e)
        {
            this.Hide();
            if (lbAvailableTstats.Items.Count > 0)
            {
                Network netw = (Network)lbAvailableTstats.SelectedItem;
                pair.ThermostatSSID = netw.NetworkSSID;
                Debug.WriteLine("You asked to join {0}", pair.ThermostatSSID);

                CurrentNetwork cn = new CurrentNetwork(pair);
                cn.ShowDialog();
            }
            else
            {
                Error err = new Error();
                err.ShowDialog();
            }
        }
开发者ID:seanhelvey,项目名称:EnergyHub,代码行数:18,代码来源:FindAvailableNetworks.cs

示例9: _backgroundWorker_RunWorkerCompleted_GetCustomers

        void _backgroundWorker_RunWorkerCompleted_GetCustomers(object sender, RunWorkerCompletedEventArgs e)
        {
            this.textBox_CheckCustomersProgress.Visibility = System.Windows.Visibility.Hidden;
            this.comboBox_MatchFilter.IsEnabled = true;
            this.comboBox_ActionFilter.IsEnabled = true;
            ActionResult result = (ActionResult)e.Result;

            if (Gen4Customers != null)
            {
                if ((bool)this.chkBox_DisplayOnlyActiveCustomers.IsChecked)
                {
                    var activeCustomer = (from c in Gen4Customers
                                          where c.Status == "Active"
                                          select c).ToList();
                    this.dataGrid_Customers.ItemsSource = activeCustomer;
                }
                else
                {
                    this.dataGrid_Customers.ItemsSource = Gen4Customers;
                }

                this.tabItem_Leads.IsEnabled = true;
            }

            if (result.IsErrorPresent)
            {
                Error errDialog = new Error();
                errDialog.Owner = this;
                errDialog.textBox_Error.Text = result.ErrorMessage;
                errDialog.ShowDialog();
            }            
        }
开发者ID:VardanMk,项目名称:Gen4.QuuckBooks,代码行数:32,代码来源:MainWindow.xaml.cs

示例10: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     err = new Error("Error0X002F: Cannot Save File");
     err.ShowDialog();
     this.Close();
 }
开发者ID:TheRealNOIG,项目名称:SoundPlayer,代码行数:6,代码来源:Save.cs

示例11: dateTimePicker_Validated

        public bool dateTimePicker_Validated()
        {
            if (this.dateTimePicker.Value.CompareTo(System.DateTime.Now) < 0)
            {
                Error error = new Error();
                error.ShowDialog();

                this.dateTimePicker.Value = System.DateTime.Now;

                return false;
            }
            else
            {
                return true;
            }
        }
开发者ID:danygolden,项目名称:gianfratti,代码行数:16,代码来源:TimerComputerShutdown.cs

示例12: AGWindow_Load

        private void AGWindow_Load(object sender, EventArgs e)
        {
            string[] args = Environment.GetCommandLineArgs();
            if(args == null || args.Length <= 1)
            {
                try
                {
                    if (openAdventureGameDialog.ShowDialog() == DialogResult.OK)
                    {
                        //Let's load an adventure game
                        var AGserializer = new XmlSerializer(typeof(AdventureGame));

                        var reader = XmlReader.Create(openAdventureGameDialog.FileName);

                            var testGame = (AdventureGameReader.AdventureGame)AGserializer.Deserialize(reader);

                            //Load the first page
                            string firstPageId = testGame.FirstPage;
                            bool foundFirstPage = false;

                            foreach (Page p in testGame.Pages)
                            {
                                if (p.ID == firstPageId)
                                {
                                    //Load first page text
                                    pageText.Text = p.Text;
                                    actionBox.Items.Clear();

                                    //Populate action list box with actions from first page
                                    foreach (AGAction a in p.AGActions)
                                    {
                                        ListViewItem lvi = new ListViewItem(a.Text);
                                        lvi.Tag = a.ID;

                                        actionBox.Items.Add(lvi);
                                    }

                                    foundFirstPage = true;
                                    CurrentPage = firstPageId;

                                }
                            }

                            //If the first page wasn't found, throw an exception.
                            if (foundFirstPage == false)
                            {
                                throw new Exception("Could not find a page with an ID of \'" + testGame.FirstPage + "\'. Could not display first page.");
                            }

                            Game = testGame;
                            this.Text = Game.Name;
                            //We're done.

                    }
                }
                catch(Exception ex)
                {
                    Error er = new Error();

                    er.doErrorMsg("There was an error loading the adventure game.", ex);
                    if(er.ShowDialog() == DialogResult.Abort)
                    {
                        Application.Exit();
                    }
                }
            }
            else
            {
                try
                {

                        //Let's load an adventure game
                        var AGserializer = new XmlSerializer(typeof(AdventureGame));

                        var reader = XmlReader.Create(args[1]);

                        var testGame = (AdventureGameReader.AdventureGame)AGserializer.Deserialize(reader);

                        //Load the first page
                        string firstPageId = testGame.FirstPage;
                        bool foundFirstPage = false;

                        foreach (Page p in testGame.Pages)
                        {
                            if (p.ID == firstPageId)
                            {
                                //Load first page text
                                pageText.Text = p.Text;
                                actionBox.Items.Clear();
                                //Populate action list box with actions from first page
                                foreach (AGAction a in p.AGActions)
                                {
                                    ListViewItem lvi = new ListViewItem(a.Text);
                                    lvi.Tag = a.ID;

                                    actionBox.Items.Add(lvi);
                                }

                                foundFirstPage = true;
                                CurrentPage = firstPageId;
//.........这里部分代码省略.........
开发者ID:jansky,项目名称:XMLAdventureGame,代码行数:101,代码来源:AGWindow.cs

示例13: generatePathMapToolStripMenuItem_Click

 /// <summary>
 /// Prompts for the free points in each subField and then saves the field.
 /// This is different from just saving the playField map because it also 
 /// stores the freePoints in the Field.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void generatePathMapToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (subFields.Count == 0)
     {
         Error noFields = new Error(errorTypes.NoFields);
         noFields.ShowDialog();
         noFields.Dispose();
         return;
     }
     List<Field> fields = new List<Field>();
     foreach (KeyValuePair<string, Polygon> p in subFields)
     {
         Field f = split(p);
         if (f == null)
         {
             return;
         }
         fields.Add(f);
     }
     PathMapGenerator path = new PathMapGenerator(fields);
     path.ShowDialog();
     if (path.complete)
     {
         save(path.fields, path.PRMs, path.pm, true);
     }
     path.Dispose();
 }
开发者ID:elieberson,项目名称:Map-Builder,代码行数:34,代码来源:Form1.cs

示例14: LogError


//.........这里部分代码省略.........
                }
                StringBuilder error = new StringBuilder();
                error.AppendLine(
                    "*******************************************************************************************");
                error.Append("                           ");
                if (firstchance)
                {
                    error.AppendLine("Silent Exception");
                }
                else
                {
                    error.AppendLine("Fatal Exception");
                }
                error.AppendLine(
                    "*******************************************************************************************");

                error.AppendLine(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "." +
                                 DateTime.Now.Millisecond);
                if (Telemetry.m == null) error.AppendLine("No Telemetry object");
                else
                {
                    error.AppendLine("-----------------------------------------------------------------");
                    error.Append("Simulator: ");
                    if (Telemetry.m.Active_Sim == false) error.AppendLine("No simulator running");
                    else error.AppendLine(Telemetry.m.Sim.ProcessName.ToLower());

                    error.AppendLine("-----------------------------------------------------------------");
                    error.Append("Session: ");
                    if (Telemetry.m.Active_Session == false) error.AppendLine("No session running");
                    else error.AppendLine(Telemetry.m.Sim.Session.Type.Type.ToString());

                    if (Telemetry.m.Active_Session && Telemetry.m.Sim != null)
                    {
                        error.AppendLine("-----------------------------------------------------------------");
                        error.Append("Driver: ");
                        if (Telemetry.m.Sim != null && Telemetry.m.Sim.Drivers != null &&
                            Telemetry.m.Sim.Drivers.Player != null)
                        {
                            error.AppendLine(Telemetry.m.Sim.Drivers.Player.Name + " / " +
                                             Telemetry.m.Sim.Drivers.Player.CarClass + " / " +
                                             Telemetry.m.Sim.Drivers.Player.CarModel);
                            error.AppendLine("Laps: " + Telemetry.m.Sim.Drivers.Player.Laps);
                        }
                        else if (Telemetry.m.Sim == null)
                            error.AppendLine("Error in Sim object");
                        else if (Telemetry.m.Sim.Drivers == null)
                            error.AppendLine("Error in Drivers object");
                        else if (Telemetry.m.Sim.Drivers.Player == null)
                            error.AppendLine("No player found");

                        error.AppendLine("Cars: " + Telemetry.m.Sim.Session.Cars);
                        error.AppendLine("-----------------------------------------------------------------");
                        error.AppendLine("Track loaded: " + ((Telemetry.m.Track == null) ? "No" : "Yes"));
                        error.AppendLine("Track: " + Telemetry.m.Sim.Session.GameData_TrackFile);
                        if (Telemetry.m.Track != null)
                        {
                            error.AppendLine("Track: " + Telemetry.m.Track.Name);
                            error.AppendLine("Route points: " + Telemetry.m.Track.Route.Racetrack.Count.ToString());
                        }

                    }
                }

                error.AppendLine("-----------------------------------------------------------------");
                error.AppendLine("Simulator Event log:");
                error.AppendLine("TODO");

                error.AppendLine("-----------------------------------------------------------------");
                error.AppendLine("Exception info:");
                error.AppendLine(ex.Message);

                error.AppendLine("-----------------------------------------------------------------");
                error.AppendLine(ex.StackTrace);

                if (ex.InnerException != null)
                {
                    error.AppendLine("-----------------------------------------------------------------");
                    error.AppendLine("INNER Exception info:");
                    error.AppendLine(ex.InnerException.Message);

                    error.AppendLine("-----------------------------------------------------------------");
                    error.AppendLine(ex.InnerException.StackTrace);
                }
                error.AppendLine("-----------------------------------------------------------------");

                byte[] sb = ASCIIEncoding.ASCII.GetBytes(error.ToString());
                fs.Write(sb, 0, sb.Length);
                fs.Close();
                if (!firstchance)
                {
                    Error err = new Error();
                    err.ShowDialog();
                }
            }catch(Exception w)
            {

            }

            ReportingError = false;
        }
开发者ID:Quikcurl,项目名称:SimTelemetry,代码行数:101,代码来源:Program.cs

示例15: MainFOrm_Load

        private void MainFOrm_Load(object sender, EventArgs e)
        {
            try
            {
                webcams = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                foreach (FilterInfo webcam in webcams)
                {
                    comboBox1.Items.Add(webcam.Name);
                }

                comboBox1.SelectedIndex = 0;
                cam = new VideoCaptureDevice();
            }
            catch
            {
                Error obj = new Error();
                obj.ShowDialog();

            }
        }
开发者ID:Rohail1,项目名称:OOP-Project,代码行数:21,代码来源:Form1.cs


注:本文中的Error.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。