Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                // 起動時のチェック
                TwitterAwaySpecificProcess.StartUpCheck();
            }
            catch (DllNotFoundException ex)
            {
                MessageBox.Show(ex.Message);
                Application.Exit();

                return;
            }

            try
            {
                // 起動時の初期化
                TwitterAwaySpecificProcess.StartUpInitialize();

                // アップデートタイマーの設定が有効な場合、タイマーを動作させる
                if (UserSetting.UpdateTimerCheck == true)
                {
                    UpdateCheckTimerStart();
                }
                else
                {
                    UpdateCheckTimerStop();
                }
            }
            catch (XmlException)
            {
                MessageBox.Show("設定ファイルが読み込めませんでした", "設定ファイルの解析エラー");
            }
            catch (IOException)
            {
                MessageBox.Show("設定ファイルが読み込めませんでした", "設定ファイルの読み込みエラー");
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("設定ファイルが読み込めませんでした", "設定ファイルの読み込みエラー");
            }

            twitterListView.Columns[0].Width = UserSetting.TwitterListViewNameColumnWidth;
            twitterListView.Columns[1].Width = UserSetting.TwitterListViewDoingColumnWidth;
            twitterListView.Columns[2].Width = UserSetting.TwitterListViewDateColumnWidth;

            SetAnchorControl();
            FixWindowSize();
        }
Example #2
0
        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        static void Main()
        {
            try
            {
                Application.Run(new MainForm());

                // 終了処理
                try
                {
                    // 終了時処理
                    TwitterAwaySpecificProcess.ExitDisable();
                }
                catch (IOException)
                {
                    MessageBox.Show("設定ファイルが書き込めませんでした", "設定ファイル書き込みエラー");
                }
            }
            catch (Exception ex)
            {
                // ログに例外情報を書き込む
                Log           exceptionLog = new Log(AssemblyUtility.GetExecutablePath() + @"\" + TwitterAwayInfo.ExceptionLogFile);
                StringBuilder error        = new StringBuilder();


                error.Append("Application:       " +
                             TwitterAwayInfo.ApplicationName + " " + TwitterAwayInfo.VersionNumber + "\r\n");
                error.Append("Date:              " +
                             System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "\r\n");
                error.Append("OS:                " +
                             Environment.OSVersion.ToString() + "\r\n");
                error.Append("Culture:           " +
                             System.Globalization.CultureInfo.CurrentCulture.Name + "\r\n");
                error.Append("Exception class:   " +
                             ex.GetType().ToString() + "\r\n");
                error.Append("ToString:   " +
                             ex.ToString() + "\r\n");
                error.Append("Exception message: "
                             + "\r\n");
                error.Append(ex.Message);

                Exception innnerEx = ex.InnerException;
                while (innnerEx != null)
                {
                    error.Append(innnerEx.Message);
                    error.Append("\r\n");
                    innnerEx = innnerEx.InnerException;
                }

                error.Append("\r\n");
                error.Append("\r\n");

                exceptionLog.LogThis(error.ToString(), Log.LogPrefix.date);

#if DEBUG
                // デバッガで例外内容を確認するため、例外をアプリケーションの外に出す
                throw ex;
#else
                Trace.Assert(false, "予期しないエラーが発生したため、終了します");
#endif
            }
        }