Beispiel #1
0
        private void 새로만들기ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputBoxDialog inputBox = new InputBoxDialog();

            inputBox.SetDescription("새로 만들 자기소개서 이름을 입력하세요.");
            if (inputBox.ShowDialog() == DialogResult.OK)
            {
                string name = inputBox.GetResult();
                if (name.Any((char i) => System.IO.Path.GetInvalidFileNameChars().Contains(i)))
                {
                    MessageBox.Show("잘못된 이름입니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else if (selfIntroductionManager.GetSelfIntroductionNames().Contains(name))
                {
                    MessageBox.Show("이미 존재하는 이름입니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                selfIntroductionManager.SaveSelfIntroduction(name, null);
                refreshSelfIntroductionToolStrip();

                SelfIntroductionDialog dialog = new SelfIntroductionDialog(name, selfIntroductionManager);
                dialog.OnFileRenamedOrDeleted += OnSelfIntroductionFileChanged;
                dialog.MdiParent = this;
                dialog.Show();
            }
        }
        private void menuBtn_renameSelfIntroduction_Click(object sender, EventArgs e)
        {
            InputBoxDialog inputBox = new InputBoxDialog();

            inputBox.SetDescription("새로운 이름을 입력하세요.");
            if (inputBox.ShowDialog() == DialogResult.OK)
            {
                if (GetSelfIntroductionManager().GetSelfIntroductionNames().Contains(inputBox.GetResult()))
                {
                    MessageBox.Show("이미 존재하는 이름입니다.");
                    return;
                }
                Data.SelfIntroduction selfIntroduction = GetSelfIntroductionManager().GetSelfIntroduction(GetSelfIntroductionName());
                GetSelfIntroductionManager().DeleteSelfIntroduction(GetSelfIntroductionName());
                SetSelfIntroductionName(inputBox.GetResult());
                GetSelfIntroductionManager().SaveSelfIntroduction(GetSelfIntroductionName(), selfIntroduction);
                OnFileRenamedOrDeleted(this, new EventArgs());
                this.Text = "자기소개서 - " + this.GetSelfIntroductionName();
            }
        }