예제 #1
0
        /// <summary>
        /// DB 테스트 버튼 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DbTestBtn_Click(object sender, EventArgs e)
        {
            if (!this.dbValidator())
            {
                MessageBox.Show(LangPack.GetMongolian("Please check DB items."), LangPack.GetMongolian("DB Test"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            AdengOleDb db = null;

            try
            {
                db = new AdengOleDb();
                db.OracleProvider = "OraOLEDB.Oracle.1"; //64bit OracleProvider
                db.OpenOracle(this.DbIPTB.Text, this.DbSidTB.Text, this.DbIdTB.Text, this.DbPwTB.Text, this.Oracle8CB.Checked);

                if (db.IsOpen)
                {
                    this.DbTestRstLB.ForeColor = Color.Blue;
                    this.DbTestRstLB.Text      = string.Format(LangPack.GetTCPResult() + " : {0}", LangPack.GetTCPSuccess());
                }
                else
                {
                    this.DbTestRstLB.ForeColor = Color.Red;
                    this.DbTestRstLB.Text      = string.Format(LangPack.GetTCPResult() + " : {0}", LangPack.GetTCPFail());
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("DBMngOption.DbTestBtn_Click - " + ex.Message);
            }
            finally
            {
                if (db != null)
                {
                    db.Close();
                    db = null;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 취소 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (this.timeTD != null)
            {
                this.timeTD.Abort();
                this.timeTD = null;
            }

            string tmpStr = LangPack.GetMongolian("Want to cancel the auto alert?");

            if (this.btnCancel.Text == LangPack.GetClear())
            {
                tmpStr = LangPack.GetMongolian("Want to cancel the auto alert?");

                if (MessageBox.Show(tmpStr, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (this.OnCancleEvt != null)
                    {
                        this.OnCancleEvt(this, new CountEndEventArgs(this.p24));
                    }

                    this.Close();
                }
            }
            else
            {
                if (MessageBox.Show(tmpStr, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    this.tmpTime             = (int.Parse(this.label13.Text.ToString()) + 1);
                    this.timeTD              = new Thread(timeTDMethod);
                    this.timeTD.IsBackground = true;
                    this.timeTD.Start();
                }
                else
                {
                    this.Close();
                }
            }
        }
예제 #3
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;
        }
예제 #4
0
        private void btnMove_Click(object sender, EventArgs e)
        {
            Dictionary <string, TermData> dicTermTemp = new Dictionary <string, TermData>();
            Dictionary <string, DistData> dicDistTemp = new Dictionary <string, DistData>();
            Dictionary <string, ProvData> dicProvTemp = new Dictionary <string, ProvData>();

            foreach (TreeNode nodeProv in tvAll.Nodes[0].Nodes)
            {
                // Add Prov All
                if (nodeProv.Checked)
                {
                    ProvData prov = nodeProv.Tag as ProvData;
                    dicProvTemp.Add(prov.Code.ToString(), prov);
                }
                else
                {
                    foreach (TreeNode nodeDist in nodeProv.Nodes)
                    {
                        //  Add Dist All
                        if (nodeDist.Checked)
                        {
                            DistData dist = nodeDist.Tag as DistData;
                            dicDistTemp.Add(dist.Code.ToString(), dist);
                        }
                        else
                        {
                            foreach (TreeNode nodeTerm in nodeDist.Nodes)
                            {
                                // Add Term One
                                if (nodeTerm.Checked)
                                {
                                    TermData term = nodeTerm.Tag as TermData;
                                    dicTermTemp.Add(term.Code.ToString(), term);
                                }
                            }
                        }
                    }
                }
            }

            if (dicTermTemp.Count == 0 && dicDistTemp.Count == 0 && dicProvTemp.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select terminal/province/district."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            TreeNode grpNode = tvGrp.SelectedNode;

            if (grpNode == null || !(grpNode.Tag is Group))
            {
                MessageBox.Show(LangPack.GetMongolian("Please select group."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (grpNode.Nodes.Count >= 17)
            {
                MessageBox.Show(LangPack.GetMongolian("A group of up to sixteen members."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if ((grpNode.Nodes.Count + dicProvTemp.Count + dicDistTemp.Count + dicTermTemp.Count) > 16)
            {
                MessageBox.Show(LangPack.GetMongolian("A group of up to sixteen members."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Group gp = grpNode.Tag as Group;

            grpMng.UpdateGrpProv(gp.Key, dicProvTemp);
            grpMng.UpdateGrpDist(gp.Key, dicDistTemp);
            grpMng.UpdateGrpTerm(gp.Key, dicTermTemp);

            DisplayGroupTree();

            tvAll.Nodes[0].Checked = false;
        }
예제 #5
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            bool bRult = false;

            TreeNode node    = tvGrp.SelectedNode;
            TreeNode prtNode = node;

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

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

            if (node.Tag is Group)
            {
                Group gp = node.Tag as Group;
                bRult = grpMng.DeleteGrp(gp.Key);
            }
            else
            {
                int    iCnt   = 0;
                string grpKey = string.Empty;

                while (true)
                {
                    // 무한 Loop 방지
                    iCnt++;
                    if (iCnt > 100)
                    {
                        return;
                    }

                    prtNode = prtNode.Parent;

                    if (prtNode.Tag is Group)
                    {
                        grpKey = (prtNode.Tag as Group).Key;
                        break;
                    }
                }

                if (node.Tag is ProvData)
                {
                    ProvData prov = node.Tag as ProvData;
                    bRult = grpMng.DeleteGrpProv(grpKey, prov);
                }
                else if (node.Tag is DistData)
                {
                    DistData dist = node.Tag as DistData;
                    bRult = grpMng.DeleteGrpDist(grpKey, dist);
                }
                else if (node.Tag is TermData)
                {
                    TermData term = node.Tag as TermData;
                    bRult = grpMng.DeleteGrpTerm(grpKey, term);
                }
            }

            tvGrp.Nodes.Remove(node);

            if (bRult)
            {
                MessageBox.Show(LangPack.GetMongolian("Deleted."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(LangPack.GetMongolian("Failed."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            DisplayGroupTree();
        }
예제 #6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            TreeNode node = tvGrp.SelectedNode;

            if (node == null || !(node.Tag is Group))
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the group to modify."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            this.newGrpName = node.Text;
            GroupEditForm form = new GroupEditForm(this);

            if (DialogResult.OK != form.ShowDialog())
            {
                return;
            }

            node.Text = this.newGrpName;

            Group gp = node.Tag as Group;

            gp.Name = this.newGrpName;
            grpMng.UpdateGrp(gp.Key, gp);
        }
예제 #7
0
        private void playSiren(byte _num)
        {
            if (!(System.IO.File.Exists(Util.file_Siren + "siren_" + _num.ToString() + ".wav")))
            {
                MessageBox.Show(LangPack.GetMongolian("Sorry! can not play sound because file don't exists."), LangPack.GetMongolian("Siren"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (_num == 1)
                {
                    btnMic.BackColor = Color.Black;
                }
                else
                {
                    btnRec.BackColor = Color.Black;
                }

                return;
            }

            if (this.sp == null)
            {
                this.sp = new SoundPlayer(Util.file_Siren + "siren_" + _num.ToString() + ".wav");
            }
            else
            {
                this.sp.SoundLocation = Util.file_Siren + "siren_" + _num.ToString() + ".wav";
            }

            this.sp.Play();
            this.playTD = new Thread(new ParameterizedThreadStart(playMethod));
            this.playTD.Start(this.msgTime[_num - 1]);
        }
예제 #8
0
        public void btnEnd_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if ((selDist == null && selTerm == null) || ((selDist.Count + selTerm.Count) == 0))
            {
                MessageBox.Show(LangPack.GetMongolian("Please select terminal(s) to issue."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if ((selDist.Count + selTerm.Count) > 16)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            List <string> lstDistIP = new List <string>();
            List <string> lstTermIP = new List <string>();

            for (int i = 0; i < selDist.Count; i++)
            {
                lstDistIP.Add((lvDist.Items[selDist[i]].Tag as DistData).DistIp);
            }

            for (int i = 0; i < selTerm.Count; i++)
            {
                lstTermIP.Add((lvTerm.Items[selTerm[i]].Tag as TermData).TermIp);
            }

            if (evtIndInfo != null)
            {
                evtIndInfo(lstDistIP, lstTermIP);
            }

            this.lvDist.CheckBoxes = false;
            this.lvTerm.CheckBoxes = false;

            if (bSnGrp)
            {
                this.BackgroundImage = Util.GetBackgroundImage((byte)Util.emBackImage.grpNone);
            }
            else
            {
                this.BackgroundImage = Util.GetBackgroundImage((byte)Util.emBackImage.IndNone);
            }

            btnEnd.Enabled = false;
        }
예제 #9
0
        private void lvTerm_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if (e.NewValue == CheckState.Checked && (selDist.Count + selTerm.Count) >= 17)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.NewValue = CheckState.Unchecked;
                return;
            }

            ListViewItem item = lvTerm.Items[e.Index];

            if (e.NewValue == CheckState.Checked)
            {
                item.ForeColor = Color.Blue;
                item.Font      = new Font(lvTerm.Font, FontStyle.Bold);
            }
            else
            {
                item.ForeColor = Color.Black;
                item.Font      = new Font(lvTerm.Font, FontStyle.Regular);
            }
        }
예제 #10
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection selText = lvMsg.SelectedIndices;

            if (selText.Count <= 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select message text to modify."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            StMsgEditForm form = new StMsgEditForm((lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum, this.storedIsPrimary);

            form.OnStoMsgChangedEvt += new EventHandler <StoredMsgChangedEventArgs>(form_OnStoMsgChangedEvt);
            form.ShowDialog();
            form.OnStoMsgChangedEvt -= new EventHandler <StoredMsgChangedEventArgs>(form_OnStoMsgChangedEvt);

            AddListViewItem();
            this.SetMsgInfo();
        }
예제 #11
0
        private void Init()
        {
            brdMng = BoardDataMng.GetBrdMng();

            if (brdMng.dicBrd.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please register kind first."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            cbBlack.Items.Add("Unused");
            cbBlack.Items.Add("Used");

            foreach (KeyValuePair <string, BoardInfo> pair in brdMng.dicBrd)
            {
                cbKind.Items.Add(pair.Key);
            }

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

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

            if (bAdd)
            {
                cbKind.SelectedIndex  = 0;
                cbBlack.SelectedIndex = 0;
            }
            else
            {
                oldName        = this.infoD.name;
                cbKind.Text    = this.infoD.kind;
                tbName.Text    = this.infoD.name;
                cbKind.Enabled = false;

                tbText.Text = this.infoD.text;
                tbText_TextChanged(null, null);
                cbBlack.SelectedIndex = (this.infoD.isBlack ? 1 : 0);

                for (int i = 0; i < 9; i++)
                {
                    if (this.infoD.cut[i])
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.ImageIndex = i;
                        lvi.Text       = (i + 1).ToString();
                        this.cutImageLV.Items.Add(lvi);
                    }
                }
            }
        }
예제 #12
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show(LangPack.GetMongolian("Please write a name."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbName.Focus();
                return;
            }

            GroupMng grpMng = GroupMng.GetGrpMng();

            foreach (KeyValuePair <string, Group> pair in grpMng.dicGrp)
            {
                if (pair.Value.Name.Trim() == tbName.Text.Trim())
                {
                    MessageBox.Show(LangPack.GetMongolian("The same name already exists. Please enter check again after."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tbName.Focus();
                    return;
                }
            }

            if (this.bGrp)
            {
                this.grpForm.NewGrpName = tbName.Text + "   ";
            }
            else
            {
                if (this.brdForm.IsExistKey(string.Format("({0})_{1}", this.numericUpDown1.Value, this.tbName.Text)))
                {
                    MessageBox.Show(LangPack.GetMongolian("The title already exists. Please enter after checking again."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tbName.Focus();
                    return;
                }

                this.brdForm.BrdNewName = tbName.Text;
                this.brdForm.BrdKindNum = (int)this.numericUpDown1.Value;

                if (this.OnCGChangeBoxEvt != null)
                {
                    this.OnCGChangeBoxEvt(this, new CGChangeEventArgs());
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
예제 #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());
            }
        }
예제 #14
0
        /// <summary>
        /// 저장메시지 Play 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.button1.Text == LangPack.GetPlay())
            {
                try
                {
                    ListView.SelectedIndexCollection selText = lvMsg.SelectedIndices;

                    if (selText.Count <= 0)
                    {
                        MessageBox.Show(LangPack.GetMongolian("Please choose the stored message to play."), LangPack.GetMongolian("Sound Play"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (!(System.IO.File.Exists(Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav")))
                    {
                        MessageBox.Show(LangPack.GetMongolian("Sorry! can not play sound because file don't exists."), LangPack.GetMongolian("Sound Play"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (this.sp == null)
                    {
                        this.sp = new SoundPlayer(Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav");
                    }
                    else
                    {
                        this.sp.SoundLocation = Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav";
                    }

                    this.sp.Play();
                    this.playTD = new Thread(new ParameterizedThreadStart(playMethod));
                    this.playTD.Start((lvMsg.Items[selText[0]].Tag as MsgInfo).msgTime);
                    this.button1.Text = LangPack.GetStop();
                }
                catch (Exception ex)
                {
                    this.button1.Text = LangPack.GetPlay();
                }
            }
            else
            {
                try
                {
                    this.sp.Stop();
                    this.button1.Text = LangPack.GetPlay();

                    if (this.playTD != null)
                    {
                        this.playTD.Abort();
                        this.playTD = null;
                    }
                }
                catch (Exception ex)
                {
                    this.sp           = null;
                    this.button1.Text = LangPack.GetPlay();

                    if (this.playTD != null)
                    {
                        this.playTD.Abort();
                        this.playTD = null;
                    }
                }
            }
        }
예제 #15
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection selText = lvMsg.SelectedIndices;
            if (selText.Count <= 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select message text to delete."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

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

            msgMng.dicMsg.Remove((lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum);
            msgMng.SaveMsgNameData();

            AddListViewItem();
            this.SetMsgInfo();

            if (this.OnStoMsgChangedEvt != null)
            {
                this.OnStoMsgChangedEvt(this, new StoMsgChangedEventArgs());
            }
        }
예제 #16
0
        /// <summary>
        /// 설정 값 저장 메소드
        /// </summary>
        private void save()
        {
            //DB
            if (this.dbFLAG)
            {
                if (!this.dbValidator())
                {
                    MessageBox.Show(LangPack.GetMongolian("Please check DB items."), LangPack.GetMongolian("DB"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (this.OnDbSettingDataEvt != null)
                {
                    this.OnDbSettingDataEvt(this, new DbSettingDataEvtArgs(
                                                this.DbIPTB.Text, this.DbSidTB.Text,
                                                this.DbIdTB.Text, this.DbPwTB.Text, this.Oracle8CB.Checked));
                }
            }

            //TCP
            if (this.tcpFLAG)
            {
                if (!this.tcp1Validator())
                {
                    MessageBox.Show(LangPack.GetMongolian("Please check TCP1 items."), LangPack.GetMongolian("TCP1"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (this.OnTcpSettingEvt != null)
                {
                    this.OnTcpSettingEvt(this, new TcpSettingEventArgs(this.TcpIpTB.Text, this.TcpPortTB.Text));
                }
            }

            //TCP1
            if (this.tcpFLAG1)
            {
                if (!this.tcp2Validator())
                {
                    MessageBox.Show(LangPack.GetMongolian("Please check TCP2 items."), LangPack.GetMongolian("TCP2"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (this.OnTcpSettingEvt1 != null)
                {
                    this.OnTcpSettingEvt1(this, new TcpSettingEventArgs(this.TcpIpTB1.Text, this.TcpPortTB1.Text));
                }
            }

            //LOG
            if (this.logFLAG)
            {
                if (this.OnLogSettingEvt != null)
                {
                    this.OnLogSettingEvt(this, new LogSettingEventArgs(this.LogCB.Checked));
                }
            }

            if (this.buzzerFlag)
            {
                if (this.OnBuzzerEvt != null)
                {
                    this.OnBuzzerEvt(this, new BuzzerEventArgs(this.checkBox1.Checked, this.checkBox2.Checked, this.checkBox3.Checked));
                }
            }

            this.SaveBtn.Enabled = false;
            this.dbFLAG          = false;
            this.tcpFLAG         = false;
            this.tcpFLAG1        = false;
            this.logFLAG         = false;
            this.buzzerFlag      = false;
        }
예제 #17
0
        private void lvDist_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if (e.NewValue == CheckState.Checked && (selDist.Count + selTerm.Count) >= 17)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.NewValue = CheckState.Unchecked;
                return;
            }

            ListViewItem item = lvDist.Items[e.Index];

            if (bGroup)
            {
                Group grp = item.Tag as Group;

                if (evtGroupInfo != null)
                {
                    evtGroupInfo(grp);
                }

                item.ForeColor    = Color.Blue;
                item.Font         = new System.Drawing.Font(lvDist.Font, FontStyle.Bold);
                lvDist.CheckBoxes = false;
            }
            else
            {
                DistData            dist     = item.Tag as DistData;
                List <ListViewItem> lstIndex = new List <ListViewItem>();

                if (e.NewValue == CheckState.Checked)
                {
                    item.ForeColor = Color.Blue;
                    item.Font      = new Font(lvDist.Font, FontStyle.Bold);

                    foreach (ListViewItem lv in lvTerm.Items)
                    {
                        TermData term = lv.Tag as TermData;
                        if (term.DistCode == dist.Code)
                        {
                            lstIndex.Add(lv);
                        }
                    }

                    foreach (ListViewItem index in lstIndex)
                    {
                        lvTerm.Items.Remove(index);
                    }
                }
                else
                {
                    item.ForeColor = Color.Black;
                    item.Font      = new Font(lvDist.Font, FontStyle.Regular);

                    ListViewItem newItem = null;

                    foreach (KeyValuePair <string, TermData> pair in dist.dicBroadTermData)
                    {
                        TermData term = pair.Value as TermData;

                        newItem      = new ListViewItem();
                        newItem.Text = "";
                        newItem.Tag  = term;
                        lvTerm.Items.Add(newItem);
                        newItem.SubItems.Add(term.Name);
                        newItem.SubItems.Add(dist.Name);
                    }

                    lvTerm.Sort();
                }
            }
        }
예제 #18
0
        private void btnEnd_Click(object sender, EventArgs e)
        {
            ListView.CheckedListViewItemCollection selText = lvMsg.CheckedItems;

            if (selText == null || selText.Count <= 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select stored message."), LangPack.GetMongolian("Stored Message"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            MsgInfo msg = lvMsg.Items[selText[0].Index].Tag as MsgInfo;

            msg.msgReptCtn = numRptCnt.Value.ToString();

            if (evtMsgInfo != null)
            {
                evtMsgInfo(Convert.ToByte(msg.msgNum), Convert.ToByte(numRptCnt.Value));
            }
        }
예제 #19
0
        private void btnSve_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show(LangPack.GetMongolian("Please enter the name."), LangPack.GetMongolian(this.Text), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbName.Focus();
                return;
            }

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

            string stNum = numNo.Value.ToString();

            if (msgMng.dicMsg.ContainsKey(stNum))
            {
                if (bAdd)
                {
                    if (DialogResult.No == MessageBox.Show(LangPack.GetMongolian("Message already exists. Want to overwrite it?"), LangPack.GetMongolian(this.Text), MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        return;
                    }
                }

                msgMng.dicMsg[stNum].msgName = tbName.Text;
                msgMng.dicMsg[stNum].msgText = tbText.Text;
                msgMng.dicMsg[stNum].msgTime = Convert.ToInt32(numSec.Value);

                MessageBox.Show(LangPack.GetMongolian("Modified."), LangPack.GetMongolian(this.Text), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MsgInfo msg = new MsgInfo();
                msg.msgNum  = stNum;
                msg.msgName = tbName.Text;
                msg.msgText = tbText.Text;
                msg.msgTime = Convert.ToInt32(numSec.Value);
                msgMng.dicMsg.Add(msg.msgNum, msg);

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

            //저장메시지 추가 및 수정했음..이 밑에서 이벤트로 전송
            if (this.OnStoMsgChangedEvt != null)
            {
                this.OnStoMsgChangedEvt(this, new StoredMsgChangedEventArgs());
            }
        }