Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
        private void OnSelfIntroductionMenuClicked(object sender, EventArgs e)
        {
            string name = (string)(sender as ToolStripMenuItem).Tag;
            SelfIntroductionDialog dialog = new SelfIntroductionDialog(name, selfIntroductionManager);

            dialog.MdiParent = this;
            dialog.OnFileRenamedOrDeleted += OnSelfIntroductionFileChanged;
            dialog.Show();
        }
        private void menuBtn_cloneSelfIntroduction_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().SaveSelfIntroduction(inputBox.GetResult(), selfIntroduction);
                OnFileRenamedOrDeleted(this, new EventArgs());

                SelfIntroductionDialog dialog = new SelfIntroductionDialog(inputBox.GetResult(), GetSelfIntroductionManager());
                dialog.OnFileRenamedOrDeleted += OnFileRenamedOrDeleted;
                dialog.MdiParent = this.MdiParent;
                dialog.Show();
            }
        }