private void cboAction_SelectedIndexChanged(object sender, EventArgs e) { chkForce.Enabled = cboAction.SelectedIndex != cboAction.FindStringExact(EXIT_TEXT); if (cboAction.SelectedIndex == cboAction.FindStringExact(EXIT_TEXT)) { chkForce.Enabled = false; chkForce.Text = Localization.Get(UI_Key.Sleep_Force); } else if (cboAction.SelectedIndex == cboAction.FindStringExact(SHUTDOWN_TEXT)) { chkForce.Enabled = txtTime.Checked; chkForce.Text = Localization.Get(UI_Key.Sleep_Force_Shutdown); } else if (cboAction.SelectedIndex == cboAction.FindStringExact(HIBERNATE_TEXT)) { chkForce.Enabled = txtTime.Checked; chkForce.Text = Localization.Get(UI_Key.Sleep_Force_Hibernate); } else if (cboAction.SelectedIndex == cboAction.FindStringExact(STANDBY_TEXT)) { chkForce.Enabled = txtTime.Checked; chkForce.Text = Localization.Get(UI_Key.Sleep_Force_StandBy); } }
private void setupCompilation(out QComboBox ComboBox, string Caption, bool MakeCheckbox) { ComboBox = new QComboBox(false, Styles.FontSmaller); bool?isComp = tracks[0].Compilation; foreach (Track t in tracks) { if (t.Compilation != isComp) { isComp = null; break; } } if (isComp.HasValue) { ComboBox.Items.AddRange(new string[] { Localization.YES, Localization.NO }); if (isComp.Value) { ComboBox.SelectedIndex = ComboBox.FindStringExact(Localization.YES); } else { ComboBox.SelectedIndex = ComboBox.FindStringExact(Localization.NO); } } else { System.Diagnostics.Debug.Assert(isMultiple); ComboBox.Items.AddRange(new string[] { MULTIPLE_VALUES, Localization.YES, Localization.NO }); ComboBox.SelectedIndex = 0; ComboBox.EnableWatermark(this, MULTIPLE_VALUES, MULTIPLE_VALUES); } setupControl(ComboBox, Caption, MakeCheckbox); }
public void Start(Rectangle Rect, int MaxItems, bool UseColor) { this.Bounds = Rect; this.ViewMode = ViewModeEnum.Artist; this.ChooseMode = ChooseModeEnum.Top; btnUseColor.Value = UseColor; Item.UseColor = UseColor; int index = cboType.FindStringExact(MaxItems.ToString()); if (index >= 0) { cboType.SelectedIndex = index; maxItems = MaxItems; } cboType.SelectedValueChanged += new EventHandler(cboType_SelectedValueChanged); //Clock.DoOnMainThread(setupItems, 1000); }
public frmTwitter() : base(Localization.Get(UI_Key.Twitter_Title), ButtonCreateType.OKAndCancel) { this.ClientSize = new Size(420, 200); lblInstructions = new QLabel(Localization.Get(UI_Key.Twitter_Instructions, Application.ProductName)); lblInstructions.Location = new Point(MARGIN, MARGIN); lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN); this.Controls.Add(lblInstructions); chkEnable = new QCheckBox(Localization.Get(UI_Key.Twitter_Enable), this.BackColor); chkEnable.Location = new Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN); chkEnable.CheckedChanged += new EventHandler(enableCheckChanged); this.Controls.Add(chkEnable); lblUserName = new QLabel(Localization.Get(UI_Key.Twitter_User_Name)); lblPassword = new QLabel(Localization.Get(UI_Key.Twitter_Password)); txtUserName = new QTextBox(); txtUserName.Text = Twitter.UserName; txtUserName.MaxLength = 64; txtUserName.TextChanged += new EventHandler(textChanged); txtPassword = new QTextBox(); txtPassword.Text = Twitter.Password; txtPassword.MaxLength = 64; txtPassword.TextChanged += new EventHandler(textChanged); txtPassword.PasswordChar = '*'; lblUserName.Location = new Point(2 * MARGIN, chkEnable.Bottom + MARGIN + MARGIN + (txtUserName.Height - lblUserName.Height) / 2); lblPassword.Location = new Point(2 * MARGIN, lblUserName.Top + MARGIN + txtUserName.Height); this.Controls.Add(lblUserName); this.Controls.Add(lblPassword); int x = Math.Max(lblUserName.Right, lblPassword.Right) + MARGIN; txtUserName.Location = new Point(x, lblUserName.Top + (lblUserName.Height - txtUserName.Height) / 2); txtPassword.Location = new Point(x, lblPassword.Top + (lblPassword.Height - txtPassword.Height) / 2); this.Controls.Add(txtUserName); this.Controls.Add(txtPassword); lblMode = new QLabel("Post A Tweet With Each:"); this.Controls.Add(lblMode); lblMode.Location = new Point(4 * MARGIN, txtPassword.Bottom + MARGIN); cboMode = new QComboBox(false); cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Song)); cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Album)); this.Controls.Add(cboMode); cboMode.Location = new Point(lblMode.Right + MARGIN, lblMode.Top + (lblMode.Height - cboMode.Height) / 2); switch (Twitter.TwitterMode) { case Twitter.Mode.Album: cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Album)); break; default: cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Song)); break; } btnTest = new QButton(Localization.Get(UI_Key.Twitter_Test), false, false); AddButton(btnTest, test); btnViewOnWeb = new QButton(Localization.Get(UI_Key.Twitter_View_On_Web), false, false); AddButton(btnViewOnWeb, viewOnWeb); PlaceButtons(this.ClientRectangle.Width, cboMode.Bottom + MARGIN + MARGIN, btnCancel, btnOK, btnTest, btnViewOnWeb); this.ClientSize = new Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN); int tabIndex = 0; chkEnable.TabIndex = tabIndex++; txtUserName.TabIndex = tabIndex++; txtPassword.TabIndex = tabIndex++; btnViewOnWeb.TabIndex = tabIndex++; btnTest.TabIndex = tabIndex++; btnOK.TabIndex = tabIndex++; btnCancel.TabIndex = tabIndex++; chkEnable.Checked = Twitter.On; enableControls(); }
public Organizer(Callback DoneCallback) : base() { TrackWriter.Stop(); done = DoneCallback; invalidPath = Localization.Get(UI_Key.Organize_Invalid_Path); sample = Localization.Get(UI_Key.Organize_Sample); tokenMyMusic = Localization.Get(UI_Key.Organize_Token_My_Music); tokenMyDocuments = Localization.Get(UI_Key.Organize_Token_My_Documents); tokenDesktop = Localization.Get(UI_Key.Organize_Token_Desktop); font = Styles.FontSmaller; boldFont = new Font(font, FontStyle.Bold); btnOK = new QButton(Localization.OK, false, true); btnCancel = new QButton(Localization.CANCEL, false, true); btnHelp = new QButton(Localization.Get(UI_Key.Organize_Help), false, true); AddButton(btnHelp, help); lblTitle = new QLabel(Localization.Get(UI_Key.Organize_Title), font); this.Controls.Add(lblTitle); lblTitle.Location = new System.Drawing.Point(MARGIN, MARGIN); lblDirectory = new QLabel(Localization.Get(UI_Key.Organize_Top_Folder), font); lblDirectory.ShowAccellerator(); this.Controls.Add(lblDirectory); txtDirectory = new QTextBox(); txtDirectory.Font = font; this.Controls.Add(txtDirectory); if (Setting.TopLevelDirectory.Length == 0) { Setting.TopLevelDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); } oldRoot = Setting.TopLevelDirectory; txtDirectory.Text = simplify(oldRoot); btnBrowse = new QButton(Localization.Get(UI_Key.Organize_Browse), false, false); btnBrowse.ShowAccellerator(Keys.B); AddButton(btnBrowse, browse); lblSubdirectory = new QLabel(Localization.Get(UI_Key.Organize_Folder_Structure), font); lblSubdirectory.ShowAccellerator(); this.Controls.Add(lblSubdirectory); cboSubdirectory = new QComboBox(false); cboSubdirectory.Font = font; cboSubdirectory.Items.AddRange(TrackWriter.GetDirFormats().ToArray()); string sub = TrackWriter.GetDirFormat(Setting.DefaultDirectoryFormat); if (cboSubdirectory.Items.Contains(sub)) { cboSubdirectory.SelectedIndex = cboSubdirectory.FindStringExact(sub); } else { cboSubdirectory.SelectedIndex = 0; } this.Controls.Add(cboSubdirectory); cboSubdirectory.AutoSetWidth(); lblRename = new QLabel(Localization.Get(UI_Key.Organize_Rename), font); lblRename.ShowAccellerator(); this.Controls.Add(lblRename); cboRename = new QComboBox(false); cboRename.Font = font; string[] renames = TrackWriter.GetRenames().ToArray(); renames[0] = Localization.Get(UI_Key.Organize_Dont_Change); cboRename.Items.AddRange(renames); string ren = TrackWriter.GetRenameFormat(Setting.DefaultRenameFormat); if (cboRename.Items.Contains(ren)) { cboRename.SelectedIndex = cboRename.FindStringExact(ren); } else { cboRename.SelectedIndex = 0; } this.Controls.Add(cboRename); cboRename.AutoSetWidth(); chkKeepOrganized = new QCheckBox(Localization.Get(UI_Key.Organize_Keep_Organized), this.BackColor); chkKeepOrganized.ShowAccellerator(); chkKeepOrganized.Font = font; chkKeepOrganized.Checked = Setting.KeepOrganized; this.Controls.Add(chkKeepOrganized); chkMoveIntoTopFolder = new QCheckBox(Localization.Get(UI_Key.Organize_Move_Into_Top_Folder), this.BackColor); chkMoveIntoTopFolder.Font = font; chkMoveIntoTopFolder.Checked = Setting.MoveNewFilesIntoMain; this.Controls.Add(chkMoveIntoTopFolder); btnOK.Text = Localization.Get(UI_Key.Organize_Organize); btnCancel.Text = Localization.Get(UI_Key.Organize_Dont_Organize); btnOK.ShowAccellerator(Keys.O); btnCancel.ShowAccellerator(Keys.D); AddButton(btnOK, ok); AddButton(btnCancel, cancel); sampleTrack = new Track(-1, Localization.Get(UI_Key.Organize_Sample_Track_Path), Track.FileType.MP3, Localization.Get(UI_Key.Organize_Sample_Track_Title), Localization.Get(UI_Key.Organize_Sample_Track_Album), Localization.Get(UI_Key.Organize_Sample_Track_Artist), String.Empty, String.Empty, Localization.Get(UI_Key.Organize_Sample_Track_Grouping), Localization.Get(UI_Key.Organize_Sample_Track_Genre), (6 * 60 + 24) * 1000, 5, 0, 1973, 0, 5, 320000, 0, false, DateTime.Today, DateTime.Today, DateTime.Today, String.Empty, 2, 44100, ChangeType.None, null, float.MinValue, float.MinValue); resize(); this.Height = chkKeepOrganized.Bottom + MARGIN; cboSubdirectory.SelectedIndexChanged += (s, e) => { updateSample(); }; cboRename.SelectedIndexChanged += (s, e) => { updateSample(); }; txtDirectory.TextChanged += (s, e) => { updateSample(); }; updateSample(); int tabIndex = 0; lblDirectory.TabIndex = tabIndex++; txtDirectory.TabIndex = tabIndex++; btnBrowse.TabIndex = tabIndex++; lblSubdirectory.TabIndex = tabIndex++; cboSubdirectory.TabIndex = tabIndex++; lblRename.TabIndex = tabIndex++; cboRename.TabIndex = tabIndex++; chkKeepOrganized.TabIndex = tabIndex++; chkMoveIntoTopFolder.TabIndex = tabIndex++; btnHelp.TabIndex = tabIndex++; btnCancel.TabIndex = tabIndex++; btnOK.TabIndex = tabIndex++; setWrapAroundTabControl(tabIndex, txtDirectory, null); initialized = true; }