Ejemplo n.º 1
0
        /// <summary>
        /// 上書き保存ボタンのイベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TSBtn_OverSave_Click(object sender, EventArgs e)
        {
            if (isNewInfo)
            {
                TSBtn_NamedSave_Click(sender, e);
                return;
            }

            if (RequiredCheck() == false)
            {
                return;
            }

            try
            {
                string   path = Path.GetExtension(LblFilePath.Text);
                ItemInfo item = new ItemInfo(this);

                if (path.Equals(".so"))
                {
                    item.SaveSo(ToolTipFullPath.GetToolTip(LblFilePath));
                }
                else if (path.Equals(".csv"))
                {
                    item.SaveCsv(ToolTipFullPath.GetToolTip(LblFilePath));
                }
                else if (path.Equals(".json"))
                {
                    item.SaveJson(ToolTipFullPath.GetToolTip(LblFilePath));
                }

                RemoveFilePath();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                if (ex is ArgumentException || ex is IOException || ex is FormatException)
                {
                    MessageBox.Show(
                        this, ERR_MSG_SAVE, ERR_TITLE_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    AddFileAsterisk();
                }
                else
                {
                    throw;
                }
            }
            isDataChange = false;
            isNewInfo    = false;
            MessageBox.Show(this, SUCCESS_MSG_OVERSAVE, SUCCESS_TITLE_OVERSAVE, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// ファイルパスを表示する
 /// </summary>
 /// <param name="fullPath"></param>
 private void ShowFilePath(string fullPath)
 {
     LblFilePath.Text = Path.GetFileName(fullPath);
     ToolTipFullPath.SetToolTip(LblFilePath, fullPath);
 }