示例#1
0
    static void Main()
    {
        bool bContinue = false;

        do
        {
            try
            {
                bContinue = false;
                Form form = new CalcForm();
                Program.Prepare();
                Application.Run(form);
            }
            catch (Exception xcp)
            {
                DEBUG.DUMP_EXCEPTION(xcp);
                DialogResult r = MessageBox.Show(
                    "Programm was wondered by underestimated but handled exception."
                    + "\nWTF are you doing there?\n\n- Restart the programm?" + xcp.ToString()
                    , "What a wonderful world :)"
                    , MessageBoxButtons.RetryCancel, MessageBoxIcon.Question
                    , MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                bContinue = (r == DialogResult.Retry);
            }
        } while (bContinue);
    }
示例#2
0
        public void btnLaunchSwitch_Click(object sender, EventArgs e)
        {
            bool bEnableUI = true;

            try
            {
                if (btnLaunchSwitch.Tag == null)
                {
                    string sPath = Path_Normalize(cmbPath.Text);
                    cmbPath.Text = sPath;

                    if (!Path_IsValid(sPath))
                    {
                        cmbPath.BackColor = m_clrError;
                        return;
                    }
                    else
                    {
                        cmbPath.BackColor = Color.White;
                    }

                    if (null != OnFolderChanged)
                    {
                        OnFolderChanged(this.Parent as TabPage, GetCurrentFolderName(sPath));
                    }

                    Start(sPath);

                    btnLaunchSwitch.Tag         = 1;
                    btnLaunchSwitch.ToolTipText = "Stop";
                    btnLaunchSwitch.Image       = global::FSWatch.Properties.Resources.Stop;
                    this.Invoke(m_UpdateTraceInvokeMethod, new object[] { "Started...\r\n" });
                    bEnableUI = false;
                }
                else
                {
                    Stop();

                    btnLaunchSwitch.Tag         = null;
                    btnLaunchSwitch.ToolTipText = "Start";
                    btnLaunchSwitch.Image       = global::FSWatch.Properties.Resources.Start;
                    this.Invoke(m_UpdateTraceInvokeMethod, new object[] { "Stopped...\r\n\r\n" });
                    bEnableUI = true;
                }
            }
            catch (Exception xcp)
            {
                DEBUG.DUMP_EXCEPTION(xcp);
                bEnableUI = true;
            }
            finally
            {
                EnableUI(bEnableUI);
            }
        }
示例#3
0
        private bool Path_IsValid(string sPath)
        {
            try
            {
                if (Directory.Exists(sPath))
                {
                    return(true);
                }
            }
            catch (Exception xcp)
            {
                DEBUG.DUMP_EXCEPTION(xcp);
            }

            return(false);
        }
示例#4
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(true);

                using (Form form = new MainForm())
                {
                    Application.Run(form);
                }
            }
            catch (Exception xcp)
            {
                DEBUG.DUMP_EXCEPTION(xcp);
            }
        }