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); } } }
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; } } } }
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); } } } }
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); } } } }