Ejemplo n.º 1
0
        private void lvText_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection selText = lvText.SelectedItems;

            if (selText == null || selText.Count <= 0)
            {
                return;
            }

            if (bOrder)
            {
                BoardInfoDetail info = lvText.Items[selText[0].Index].Tag as BoardInfoDetail;

                if (evtBoardText != null)
                {
                    evtBoardText(info);
                }

                //this.Close();
            }

            if (lvText.Items[selText[0].Index].Checked)
            {
                lvText.Items[selText[0].Index].Checked = false;
            }
            else
            {
                lvText.Items[selText[0].Index].Checked = true;
            }
        }
Ejemplo n.º 2
0
        public BoardEditForm(BoardInfoDetail info, string _isPrimary)
            : this()
        {
            InitLang();

            if (info == null)
            {
                bAdd = true;
            }
            else
            {
                this.infoD = info;
                cutInfoD   = info;
            }

            Init();
            this.primary = _isPrimary;

            if (_isPrimary == "1")
            {
                this.panel1.BackgroundImage = MewsBroad.Properties.Resources.bgTitle;
            }
            else
            {
                this.panel1.BackgroundImage = MewsBroad.Properties.Resources.bgTitleGreen;
            }
        }
Ejemplo n.º 3
0
        private void AddListViewItem(BoardInfoDetail infoD)
        {
            bool imageFlag = false;

            for (int i = 0; i < infoD.cut.Length; i++)
            {
                if (infoD.cut[i])
                {
                    imageFlag = true;
                    break;
                }
            }

            ListViewItem item = new ListViewItem();

            if (imageFlag)
            {
                item.ImageIndex = 1;
            }
            else
            {
                item.ImageIndex = 0;
            }

            item.Text = "";
            item.Tag  = infoD;
            lvText.Items.Add(item);

            item.SubItems.Add(infoD.name);
            item.SubItems.Add(infoD.text);
            //item.SubItems.Add(infoD.isBlack ? "Yes" : "No");
        }
Ejemplo n.º 4
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            TreeNode selNode = tvKind.SelectedNode;

            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please choose the CG text to delete."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (DialogResult.No == MessageBox.Show(LangPack.GetMongolian("Want to delete?"), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2))
            {
                return;
            }

            for (int i = 0; i < selText.Count; i++)
            {
                BoardInfoDetail info = lvText.Items[selText[i]].Tag as BoardInfoDetail;
                brdMng.dicBrd[info.kind].dicText.Remove(info.name);
                brdMng.SaveBrdData();
            }

            MessageBox.Show(LangPack.GetMongolian("Deleted."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (this.OnCGChangedEvt != null)
            {
                this.OnCGChangedEvt(this, new CGChangedEventArgs());
            }

            tvKind.SelectedNode = null;
            tvKind.SelectedNode = selNode;
        }
Ejemplo n.º 5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            TreeNode selNode = tvKind.SelectedNode;

            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the items to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (selText.Count != 1)
            {
                MessageBox.Show(LangPack.GetMongolian("Please choose one CG text to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;
            BoardEditForm   form = new BoardEditForm(info, isPrimaryCG);

            form.OnCGChangeEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);
            form.ShowDialog();
            form.OnCGChangeEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);

            tvKind.SelectedNode = null;
            tvKind.SelectedNode = selNode;
        }
Ejemplo n.º 6
0
        private void btnKindEdit_Click(object sender, EventArgs e)
        {
            TreeNode node = tvKind.SelectedNode;

            if (node == null)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the items to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string tmpName = string.Empty;

            string[] tmp = node.Text.Split('_');
            tmpName = node.Text.Replace(tmp[0] + "_", "");
            tmp[0]  = tmp[0].Trim('(');
            tmp[0]  = tmp[0].Trim(')');

            this.brdNewName = tmpName;
            this.brdKindNum = int.Parse(tmp[0]);

            GroupEditForm form = new GroupEditForm(this);

            form.OnCGChangeBoxEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);

            if (DialogResult.OK != form.ShowDialog())
            {
                form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
                return;
            }

            BoardInfo brd = new BoardInfo();

            brd.kind    = string.Format("({0})_{1}", this.brdKindNum, this.brdNewName);
            brd.kindNum = this.brdKindNum;

            Dictionary <string, BoardInfoDetail> dicNewBrd = new Dictionary <string, BoardInfoDetail>();

            foreach (KeyValuePair <string, BoardInfoDetail> pair in brdMng.dicBrd[node.Text].dicText)
            {
                BoardInfoDetail newBrd = new BoardInfoDetail();
                newBrd.kind    = brd.kind;
                newBrd.kindNum = brd.kindNum;
                newBrd.name    = pair.Value.name;
                newBrd.text    = pair.Value.text;
                dicNewBrd.Add(newBrd.name, newBrd);
            }

            brd.dicText = dicNewBrd;
            brdMng.dicBrd.Add(string.Format("({0})_{1}", this.brdKindNum, this.brdNewName), brd);
            brdMng.dicBrd.Remove(node.Text);

            brdMng.SaveBrdData();
            AddTreeData();
            form.OnCGChangeBoxEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeBoxEvt);
        }
Ejemplo n.º 7
0
        private void lvText_DoubleClick(object sender, EventArgs e)
        {
            TreeNode selNode = tvKind.SelectedNode;

            ListView.SelectedIndexCollection selText = lvText.SelectedIndices;

            BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;
            BoardEditForm   form = new BoardEditForm(info, isPrimaryCG);

            form.OnCGChangeEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);
            form.ShowDialog();
            form.OnCGChangeEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);

            tvKind.SelectedNode = null;
            tvKind.SelectedNode = selNode;
        }
Ejemplo n.º 8
0
        public BoardMngForm(BoardInfoDetail info, bool bOrder, string _isPrimary)
            : this()
        {
            InitLang();

            this.brdInfo = info;
            this.bOrder  = bOrder;

            brdMng = BoardDataMng.GetBrdMng();
            InitCtrl();
            this.isPrimaryCG = _isPrimary;

            if (this.isPrimaryCG == "1")
            {
                this.panel1.BackgroundImage = MewsBroad.Properties.Resources.bgTitle;
            }
            else
            {
                this.panel1.BackgroundImage = MewsBroad.Properties.Resources.bgTitleGreen;
            }
        }
Ejemplo n.º 9
0
        private void lvText_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count <= 0)
            {
                return;
            }

            if (bOrder)
            {
                BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;

                if (evtBoardText != null)
                {
                    evtBoardText(info);
                }

                //this.Close();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// cut add 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cutAddBtn_Click(object sender, EventArgs e)
        {
            BoardInfo info = brdMng.dicBrd[cbKind.Text];
            BoardInfo tmp  = new BoardInfo();

            if (cutInfoD == null)
            {
                this.cutInfoD = new BoardInfoDetail();
            }

            cutInfoD.kindNum = info.kindNum;
            cutInfoD.kind    = cbKind.Text;

            tmp.kind    = cbKind.Text;
            tmp.kindNum = info.kindNum;
            tmp.dicText.Add(cutInfoD.kind, cutInfoD);

            using (BoardCutMng form = new BoardCutMng(tmp, this.primary))
            {
                form.OnCGCutEvt += new EventHandler <CGCutImageEventArgs>(form_OnCGCutEvt);
                form.ShowDialog();
                form.OnCGCutEvt -= new EventHandler <CGCutImageEventArgs>(form_OnCGCutEvt);
            }
        }
Ejemplo n.º 11
0
        private void btnView_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select CG text to preview."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (selText.Count != 1)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select one CG text to preview."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;

            BoardViewForm form = new BoardViewForm(info.text, info.isBlack, this.isPrimaryCG);

            form.ShowDialog();

            lvText.Items[selText[0]].Checked = false;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// CG CUT 선택 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void form_OnCGCutEvt(object sender, CGCutImageEventArgs e)
        {
            MethodInvoker set = delegate()
            {
                bool     cutFlag  = false;
                bool     cutClear = false;
                string[] tmp      = this.tbText.Text.Split('{');
                string   cutTmp   = string.Empty;
                this.cutInfoD = e.Info;

                this.cutImageList.Images.Clear();
                this.cutImageLV.Items.Clear();

                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-1.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-1.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-2.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-2.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-3.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-3.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-4.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-4.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-5.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-5.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-6.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-6.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-7.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-7.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-8.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-8.png");
                    this.cutImageList.Images.Add(img);
                }
                if (File.Exists(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-9.png"))
                {
                    Image img = Image.FromFile(Util.file_CGCutImage + e.Info.kindNum.ToString() + "-9.png");
                    this.cutImageList.Images.Add(img);
                }

                for (int i = 0; i < 9; i++)
                {
                    if (e.Info.cut[i])
                    {
                        cutTmp = cutTmp + (i + 1).ToString();

                        ListViewItem lvi = new ListViewItem();
                        lvi.ImageIndex = i;
                        lvi.Text       = (i + 1).ToString();
                        this.cutImageLV.Items.Add(lvi);

                        if (i != 8)
                        {
                            cutTmp = cutTmp + ",";
                        }
                    }
                }

                if (cutTmp != string.Empty)
                {
                    if (cutTmp[cutTmp.Length - 1] == ',')
                    {
                        cutTmp = cutTmp.Substring(0, cutTmp.Length - 1);
                    }
                }

                if (cutTmp == string.Empty)
                {
                    cutClear = true;
                }

                string cutPrt = "{CUT" + cutTmp + "}";

                try
                {
                    if (tmp[1].Substring(0, 3) == "CUT")
                    {
                        cutFlag = true;
                    }
                }
                catch (Exception ex)
                {
                    cutFlag = false;
                }

                if (!cutFlag)      //기존에 cut 선택이 없으면..
                {
                    if (!cutClear) //컷 해제가 아니면
                    {
                        this.tbText.Text = cutPrt + this.tbText.Text;
                    }
                }
                else
                {
                    int endPoint = this.tbText.Text.IndexOf('}');
                    this.tbText.Text = this.tbText.Text.Substring(endPoint + 1, this.tbText.Text.Length - (endPoint + 1));

                    if (!cutClear)
                    {
                        this.tbText.Text = cutPrt + this.tbText.Text;
                    }
                }
            };

            if (this.InvokeRequired)
            {
                this.Invoke(set);
            }
            else
            {
                set();
            }
        }
Ejemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show(LangPack.GetMongolian("Please enter the CG title."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbName.Focus();
                return;
            }

            if (string.IsNullOrEmpty(tbText.Text))
            {
                MessageBox.Show(LangPack.GetMongolian("Please enter the CG text."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbText.Focus();
                return;
            }

            if (bAdd)
            {
                BoardInfo info = brdMng.dicBrd[cbKind.Text];
                if (info.dicText != null && info.dicText.ContainsKey(tbName.Text))
                {
                    MessageBox.Show(LangPack.GetMongolian("The same title already exists. Please enter check again after."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tbName.Focus();
                    return;
                }

                BoardInfoDetail dinfo = new BoardInfoDetail();
                dinfo.name    = tbName.Text;
                dinfo.text    = tbText.Text;
                dinfo.kindNum = info.kindNum;
                dinfo.kind    = cbKind.Text;
                dinfo.isBlack = (cbBlack.SelectedIndex == 0 ? false : true);

                if (this.cutInfoD != null)
                {
                    for (int i = 0; i < 9; i++)
                    {
                        dinfo.cut[i] = this.cutInfoD.cut[i];
                    }
                }

                brdMng.dicBrd[cbKind.Text].dicText.Add(tbName.Text, dinfo);

                MessageBox.Show(LangPack.GetMongolian("Stored."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                ResetCtrl();
            }
            else
            {
                // Name(Key) 수정
                if (this.oldName != tbName.Text)
                {
                    // 기존 Name(Key) 삭제
                    brdMng.dicBrd[cbKind.Text].dicText.Remove(this.oldName);

                    // 새로운 Name(Key) 등록
                    BoardInfoDetail dinfo = new BoardInfoDetail();
                    dinfo.name    = tbName.Text;
                    dinfo.text    = tbText.Text;
                    dinfo.kind    = cbKind.Text;
                    dinfo.kindNum = infoD.kindNum;
                    dinfo.isBlack = (cbBlack.SelectedIndex == 0 ? false : true);

                    for (int i = 0; i < 9; i++)
                    {
                        dinfo.cut[i] = this.cutInfoD.cut[i];
                    }

                    brdMng.dicBrd[cbKind.Text].dicText.Add(tbName.Text, dinfo);
                }
                else
                {
                    brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].text    = tbText.Text;
                    brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].isBlack = (cbBlack.SelectedIndex == 0 ? false : true);

                    for (int i = 0; i < 9; i++)
                    {
                        brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].cut[i] = this.cutInfoD.cut[i];
                    }
                }

                brdMng.SaveBrdData();
                MessageBox.Show(LangPack.GetMongolian("Modified."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }

            if (this.OnCGChangeEvt != null)
            {
                this.OnCGChangeEvt(this, new CGChangeEventArgs());
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 생성자
 /// </summary>
 /// <param name="_state"></param>
 public CGCutImageEventArgs(BoardInfoDetail _info)
 {
     this.info = _info;
 }
Ejemplo n.º 15
0
        private void init()
        {
            this.pictureBox3.Tag  = 3;
            this.pictureBox4.Tag  = 4;
            this.pictureBox5.Tag  = 5;
            this.pictureBox6.Tag  = 6;
            this.pictureBox7.Tag  = 7;
            this.pictureBox8.Tag  = 8;
            this.pictureBox9.Tag  = 9;
            this.pictureBox10.Tag = 10;
            this.pictureBox11.Tag = 11;

            this.panel3.Tag  = 3;
            this.panel4.Tag  = 4;
            this.panel5.Tag  = 5;
            this.panel6.Tag  = 6;
            this.panel7.Tag  = 7;
            this.panel8.Tag  = 8;
            this.panel9.Tag  = 9;
            this.panel10.Tag = 10;
            this.panel11.Tag = 11;

            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-1.png"))
            {
                this.pictureBox3.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-1.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-2.png"))
            {
                this.pictureBox4.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-2.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-3.png"))
            {
                this.pictureBox5.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-3.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-4.png"))
            {
                this.pictureBox6.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-4.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-5.png"))
            {
                this.pictureBox7.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-5.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-6.png"))
            {
                this.pictureBox8.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-6.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-7.png"))
            {
                this.pictureBox9.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-7.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-8.png"))
            {
                this.pictureBox10.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-8.png");
            }
            if (File.Exists(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-9.png"))
            {
                this.pictureBox11.Image = Image.FromFile(Util.file_CGCutImage + this.bdInfo.kindNum.ToString() + "-9.png");
            }

            if (this.bdInfo.dicText.Count > 0)
            {
                BoardInfoDetail tmp = this.bdInfo.dicText[this.bdInfo.kind];
                PictureBox      pic = new PictureBox();

                for (int i = 3; i < 12; i++)
                {
                    if (tmp.cut[i - 3])
                    {
                        pic.Tag = i;
                        this.pictureBox3_Click(pic, new EventArgs());
                    }
                }
            }
        }