Exemple #1
0
        private void btnCreateSave_Click(object sender, EventArgs e)
        {
            WatchGroup watchGroup = new WatchGroup();

            watchGroup.Name       = tbxName.Text.Trim();
            watchGroup.GroupColor = lblColorTest.ForeColor;
            watchGroup.Notify     = chbxNotification.Checked;
            if ((cbbxSound.SelectedItem as string) == DEFAULT_SOUND)
            {
                watchGroup.NotifySoundFile = null;
            }
            else
            {
                watchGroup.NotifySoundFile = (FileInfo)cbbxSound.SelectedItem;
            }
            ReturnValue = watchGroup;

            this.DialogResult = DialogResult.OK;
        }
Exemple #2
0
 public FormWatchGroup(WatchGroup watchGroup)
 {
     Initialize();
     this.Text    = string.Format("{0} - Edit \"{1}\"", this.Text, watchGroup.Name);
     tbxName.Text = watchGroup.Name;
     foreach (Color color in cbbxColor.Items)
     {
         if (color.ToArgb() == watchGroup.GroupColor.ToArgb())
         {
             cbbxColor.SelectedItem = color;
             break;
         }
     }
     if (cbbxColor.SelectedIndex == -1)
     {
         nudColor.Value = watchGroup.GroupColor.R + (watchGroup.GroupColor.G * 0x0100) + (watchGroup.GroupColor.B * 0x010000);
     }
     chbxNotification.Checked = watchGroup.Notify;
     if (watchGroup.NotifySoundFile == null)
     {
         cbbxSound.SelectedIndex = 0;
     }
     else
     {
         foreach (object file in cbbxSound.Items)
         {
             string filename = file.ToString();
             if (filename == watchGroup.NotifySoundFile.Name)
             {
                 cbbxSound.SelectedItem = file;
                 break;
             }
         }
     }
     btnCreateSave.Text = "Save";
     tbxName_TextChanged(null, null);
 }