Пример #1
0
        //履歴入力
        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            // 選択されている行のデータを取り込む
            ListBoxCustomItem selItem = (ListBoxCustomItem)listBox1.SelectedItem;

            if (selItem == null)
            {
                return;
            }

            textBox2.Text = selItem.Player;
            //textBox3.Text = selItem.Action;
            comboBox1.Text = selItem.Action;
            textBox4.Text  = selItem.Keyword;
            textBox5.Text  = selItem.World;
            textBox6.Text  = selItem.PosX;
            textBox7.Text  = selItem.PosY;
            textBox8.Text  = selItem.PosZ;
            textBox9.Text  = selItem.Radius;
            if (selItem.TermStart == "" && selItem.TermEnd == "")
            {
                checkBox7.Checked = false;
            }
            else
            {
                checkBox7.Checked    = true;
                dateTimePicker1.Text = selItem.TermStart;
                dateTimePicker2.Text = selItem.TermEnd;
            }
        }
Пример #2
0
        //パラメータ生成
        private string fncSetParameters()
        {
            string player = textBox2.Text;
            //string action = textBox3.Text;
            string action    = comboBox1.Text;
            string keyword   = textBox4.Text;
            string world     = textBox5.Text;
            string posX      = textBox6.Text;
            string posY      = textBox7.Text;
            string posZ      = textBox8.Text;
            string radius    = textBox9.Text;
            string termStart = dateTimePicker1.Text;
            string termEnd   = dateTimePicker2.Text;

            string parameters = "";

            parameters += (string.IsNullOrEmpty(player)) ? "" : " p:" + player;
            parameters += (string.IsNullOrEmpty(action)) ? "" : " a:" + action;
            parameters += (string.IsNullOrEmpty(keyword)) ? "" : " f:" + keyword;
            parameters += (string.IsNullOrEmpty(world)) ? "" : " w:" + world;
            parameters +=
                (string.IsNullOrEmpty(posX) || string.IsNullOrEmpty(posX) || string.IsNullOrEmpty(posX))
                                ? ""
                                : " l:" + posX + "," + posY + "," + posZ;
            parameters += (string.IsNullOrEmpty(radius)) ? "" : " r:" + radius;
            if (checkBox7.Checked)
            {
                parameters += " t:" + termStart + "," + termEnd;
            }

            if (parameters.Length == 0)
            {
                MessageBox.Show("パラメーターを設定してください。");
                return(parameters);
            }

            ListBoxCustomItem lbci1 = new ListBoxCustomItem();

            lbci1.Text    = parameters;
            lbci1.Player  = player;
            lbci1.Action  = action;
            lbci1.Keyword = keyword;
            lbci1.World   = world;
            lbci1.PosX    = posX;
            lbci1.PosY    = posY;
            lbci1.PosZ    = posZ;
            lbci1.Radius  = radius;
            if (checkBox7.Checked)
            {
                lbci1.TermStart = termStart;
                lbci1.TermEnd   = termEnd;
            }
            fncAddHistory(lbci1);

            return(parameters);
        }
Пример #3
0
        //objと自分自身が等価のときはtrueを返す
        public override bool Equals(object obj)
        {
            //objがnullか、型が違うときは、等価でない
            if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }
            ListBoxCustomItem lbci = (ListBoxCustomItem)obj;

            if (this.Text != lbci.Text)
            {
                return(false);
            }
            if (this.Player != lbci.Player)
            {
                return(false);
            }
            if (this.Action != lbci.Action)
            {
                return(false);
            }
            if (this.Keyword != lbci.Keyword)
            {
                return(false);
            }
            if (this.World != lbci.World)
            {
                return(false);
            }
            if (this.PosX != lbci.PosX)
            {
                return(false);
            }
            if (this.PosY != lbci.PosY)
            {
                return(false);
            }
            if (this.PosZ != lbci.PosZ)
            {
                return(false);
            }
            if (this.Radius != lbci.Radius)
            {
                return(false);
            }
            if (this.TermStart != lbci.TermStart)
            {
                return(false);
            }
            if (this.TermEnd != lbci.TermEnd)
            {
                return(false);
            }
            return(true);
        }
Пример #4
0
        private void fncAddHistory(ListBoxCustomItem lbci)
        {
            int i      = 0;
            int length = listBox1.Items.Count;
            ListBoxCustomItem tmpLbci;

            for (i = 0; i < length; i++)
            {
                tmpLbci = (ListBoxCustomItem)listBox1.Items[i];
                if (tmpLbci.Equals(lbci))
                {
                    listBox1.Items.RemoveAt(i);
                    break;
                }
            }

            listBox1.Items.Insert(0, lbci);
        }