コード例 #1
0
 public detailForm(DialogForm dialogForm)
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     //this.ControlBox = false;
     //this.StartPosition = FormStartPosition.Manual;
     //this.Location = new Point(482, 218);
     this.dialogForm = dialogForm;
     label1.Text     = this.dialogForm.Messagebox.SelectedItem.ToString();
 }
コード例 #2
0
 private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     string str = null;
     if (listBox1.SelectedItem != null)
         str = listBox1.SelectedItem.ToString();
     bool btn = false;
     if (str != null)
         btn = true;
     if (btn == true)
     {
         dialogForm = new DialogForm(this);
         dialogForm.Show();
         this.Hide();
     }
     listBox1.SelectedItem = null;
 }
コード例 #3
0
        private void send_message_Click(object sender, RoutedEventArgs e)
        {
            ShortMessage shortMessage;

            if (NewmessageBox.Text == "")
            {
                messageBox.Show("不能发送空消息!");
                //this.StatusBar.Content = "不能发送空消息!";
                //MessageBox.Show("不能发送空消息!");
                return;
            }
            string phNum = textBox1.Text;

            String[] cmd = textBox1.Text.Split(' ');
            if (Timebox.IsChecked == true)
            {
                //DateTime time = DateTime.Parse(GetTime.SelectedDate.ToString() + ' ' + hour.Text + ' ' + min.Text + sec.Text);
                DateTime time;
                if (int.Parse(hour.Text) < 0 || int.Parse(hour.Text) > 24 || int.Parse(min.Text) < 0 || int.Parse(min.Text) > 60 || int.Parse(sec.Text) < 0 || int.Parse(sec.Text) > 60)
                {
                    messageBox.Show("输入时间有误");
                    return;
                }
                try
                {
                    time = (DateTime)GetTime.SelectedDate;
                }
                catch
                {
                    messageBox.Show("请输入日期!");
                    return;
                }
                time = time.AddHours((double.Parse(hour.Text)));
                time = time.AddMinutes((double.Parse(min.Text)));
                time = time.AddSeconds((double.Parse(sec.Text)));
                if (time < DateTime.Now)
                {
                    messageBox.Show("请选择将来的时间");
                    return;
                }
                else
                {
                    //ArrayList PhoneNumbers = new ArrayList();
                    for (int i = 0; i < cmd.Length; i++)
                    {
                        if (cmd[i].Length != 11)
                        {
                            if (cmd[i] == "")
                            {
                                continue;
                            }
                            //NumberForm numForm = new NumberForm();
                            messageBox.Show("号码格式错误!");
                            return;
                            //numForm.Show();
                        }
                        shortMessage = new ShortMessage(mainForm.openForm.client.GetPhoneNumber(), cmd[i], time, NewmessageBox.Text);
                        mainForm.openForm.client.MyDBController.Insert(shortMessage);
                        shortMessage.SetId(mainForm.openForm.client.MyDBController.GetMessageId(shortMessage));
                        mainForm.openForm.client.Send(shortMessage);
                    }
                    mainForm.UpdateMainForm();
                }
            }
            else
            {
                for (int i = 0; i < cmd.Length; i++)
                {
                    if (cmd[i].Length != 11)
                    {
                        if (cmd[i] == "")
                        {
                            continue;
                        }
                        //NumberForm numForm = new NumberForm();
                        messageBox.Show("号码格式错误!");
                        return;
                        //numForm.Show();
                    }
                    shortMessage = new ShortMessage(mainForm.openForm.client.GetPhoneNumber(), cmd[i], DateTime.Now, NewmessageBox.Text);
                    mainForm.openForm.client.MyDBController.Insert(shortMessage);
                    shortMessage.SetId(mainForm.openForm.client.MyDBController.GetMessageId(shortMessage));
                    mainForm.openForm.client.Send(shortMessage);
                    mainForm.UpdateMainForm();
                }
            }
            NewmessageBox.Clear();
            if (cmd.Length == 1)
            {
                DialogForm dialogForm = new DialogForm(mainForm, cmd[0]);
                dialogForm.Show();
                this.Hide();
            }
        }
コード例 #4
0
 public DeleteContact(DialogForm dialogForm)
 {
     InitializeComponent();
     this.dialogForm       = dialogForm;
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
 }