コード例 #1
0
        private void _alarmPictureBox_Click(object sender, EventArgs e)
        {
            using (DetailsReminder reminder = new DetailsReminder())
            {
                reminder.SetRecord(_record);

                using (ControlEditor ce = new ControlEditor())
                {
                    ce.ShowDialog("Reminder", reminder);
                }
            }
        }
コード例 #2
0
 private void _dueDateLinkLabel_Click(object sender, EventArgs e)
 {
     using (ControlEditor te = new ControlEditor())
     {
         using (DateTimePicker tb = new DateTimePicker())
         {
             tb.Value = this.CallRecord.DueDate;
             if (DialogResult.OK == te.ShowDialog("Edit Due Date", tb))
             {
                 this.CallRecord.DueDate = tb.Value;
             }
         }
     }
 }
コード例 #3
0
        private void _commonPhrasesPictureBox_Click(object sender, EventArgs e)
        {
            using (ControlEditor ce = new ControlEditor())
            {
                UserControl uc = new UserControl();
                uc.Dock = DockStyle.Fill;

                ImageButton ib = new ImageButton();
                ib.IsTransparent = false;
                ib.Image         = Properties.Resources.add_small;
                ib.PushImage     = Properties.Resources.add_small_hover;
                ib.Size          = new Size(ib.Image.Height, ib.Image.Height);
                ib.Dock          = DockStyle.Right;
                ib.Click        += new EventHandler(ib_Click);

                TextBox tb = new TextBox();
                tb.Height      = ib.Image.Height;
                tb.BorderStyle = BorderStyle.None;
                tb.Dock        = DockStyle.Top;

                Panel panel = new Panel();
                panel.Height    = ib.Image.Height;
                panel.BackColor = SystemColors.Window;
                panel.Dock      = DockStyle.Top;

                panel.Controls.Add(tb);
                panel.Controls.Add(ib);

                ListBox lb = new ListBox();
                lb.Dock     = DockStyle.Fill;
                lb.KeyDown += new KeyEventHandler(lb_KeyDown);

                uc.Controls.Add(lb);
                uc.Controls.Add(panel);

                XmlSerializer xs   = new XmlSerializer(typeof(List <string>));
                string        file = Settings.GetSettingsPath("phrases.xml");

                if (!File.Exists(file))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(file));
                }
                else
                {
                    using (FileStream fs = File.OpenRead(file))
                    {
                        List <string> list = xs.Deserialize(fs) as List <string>;

                        if (list != null)
                        {
                            foreach (string str in list)
                            {
                                lb.Items.Add(str);
                            }
                        }
                    }
                }


                if (DialogResult.OK == ce.ShowDialog("Common Phrases", uc))
                {
                    this._callReasonTextBox.Text = lb.Text;

                    if (File.Exists(file))
                    {
                        File.Delete(file);
                    }
                    using (StreamWriter sw = File.CreateText(file))
                    {
                        xs.Serialize(sw, lb.Items);
                    }
                }
            }
        }
コード例 #4
0
 private void _dueDateLinkLabel_Click(object sender, EventArgs e)
 {
     using (ControlEditor te = new ControlEditor())
     {
         using (DateTimePicker tb = new DateTimePicker())
         {
             tb.Value = this.CallRecord.DueDate;
             if (DialogResult.OK == te.ShowDialog("Edit Due Date", tb))
             {
                 this.CallRecord.DueDate = tb.Value;
             }
         }
     }
 }
コード例 #5
0
        private void _commonPhrasesPictureBox_Click(object sender, EventArgs e)
        {
            using (ControlEditor ce = new ControlEditor())
            {
                UserControl uc = new UserControl();
                uc.Dock = DockStyle.Fill;

                ImageButton ib = new ImageButton();
                ib.IsTransparent = false;
                ib.Image = Properties.Resources.add_small;
                ib.PushImage = Properties.Resources.add_small_hover;
                ib.Size = new Size(ib.Image.Height, ib.Image.Height);
                ib.Dock = DockStyle.Right;
                ib.Click += new EventHandler(ib_Click);

                TextBox tb = new TextBox();
                tb.Height = ib.Image.Height;
                tb.BorderStyle = BorderStyle.None;
                tb.Dock = DockStyle.Top;

                Panel panel = new Panel();
                panel.Height = ib.Image.Height;
                panel.BackColor = SystemColors.Window;
                panel.Dock = DockStyle.Top;

                panel.Controls.Add(tb);
                panel.Controls.Add(ib);

                ListBox lb = new ListBox();
                lb.Dock = DockStyle.Fill;
                lb.KeyDown += new KeyEventHandler(lb_KeyDown);

                uc.Controls.Add(lb);
                uc.Controls.Add(panel);

                XmlSerializer xs = new XmlSerializer(typeof(List<string>));
                string file = Settings.GetSettingsPath("phrases.xml");

                if (!File.Exists(file))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(file));
                }
                else
                {
                    using (FileStream fs = File.OpenRead(file))
                    {
                        List<string> list = xs.Deserialize(fs) as List<string>;

                        if (list != null)
                        {
                            foreach (string str in list)
                            {
                                lb.Items.Add(str);
                            }
                        }
                    }
                }

                if (DialogResult.OK == ce.ShowDialog("Common Phrases", uc))
                {
                    this._callReasonTextBox.Text = lb.Text;

                    if (File.Exists(file))
                    {
                        File.Delete(file);
                    }
                    using (StreamWriter sw = File.CreateText(file))
                    {
                        xs.Serialize(sw, lb.Items);
                    }
                }
            }
        }
コード例 #6
0
        private void _alarmPictureBox_Click(object sender, EventArgs e)
        {
            using (DetailsReminder reminder = new DetailsReminder())
            {
                reminder.SetRecord(_record);

                using (ControlEditor ce = new ControlEditor())
                {
                    ce.ShowDialog("Reminder", reminder);
                }
            }
        }