public LanguagesBox() { this.SuspendLayout(); this.Dock = DockStyle.Fill; this.Font = SystemFonts.MenuFont; this.Font = new Font(this.Font.FontFamily, this.Font.Size + 1F); this.Controls.AddRange(new Control[] { cmbLanguages, btnOpenDir, btnDownLoad, btnTranslate, lblThank, pnlTranslators }); this.VisibleChanged += (sender, e) => this.SetEnabled(this.Visible); cmbLanguages.SelectionChangeCommitted += (sender, e) => ChangeLanguage(); btnOpenDir.MouseDown += (sender, e) => ExternalProgram.OpenDirectory(AppConfig.LangsDir); lblThank.MouseEnter += (sender, e) => lblThank.ForeColor = Color.FromArgb(0, 162, 255); lblThank.MouseLeave += (sender, e) => lblThank.ForeColor = Color.DimGray; btnDownLoad.MouseDown += (sender, e) => { this.Cursor = Cursors.WaitCursor; this.ShowLanguageDialog(); this.Cursor = Cursors.Default; }; btnTranslate.MouseDown += (sender, e) => { using (TranslateDialog dlg = new TranslateDialog()) { dlg.ShowDialog(); } }; ToolTipBox.SetToolTip(btnOpenDir, AppString.Menu.FileLocation); ToolTipBox.SetToolTip(btnDownLoad, AppString.Dialog.DownloadLanguages); ToolTipBox.SetToolTip(btnTranslate, AppString.Dialog.TranslateTool); lblHeader.Font = new Font(this.Font, FontStyle.Bold); cmbLanguages.AutosizeDropDownWidth(); this.OnResize(null); this.ResumeLayout(); }
private VisibleRegRuleItem(ItemInfo info) : base(info) { ChkVisible = new VisibleCheckBox(this); ToolTipBox.SetToolTip(ChkVisible, info.Tip); TsiRegLocation = new RegLocationMenuItem(this); this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripSeparator(), TsiRegLocation }); }
public NumberRegRuleItem(RegRule rule, ItemInfo info) : base(info) { this.AddCtr(NudValue); ToolTipBox.SetToolTip(NudValue, info.Tip); TsiRegLocation = new RegLocationMenuItem(this); this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripSeparator(), TsiRegLocation }); this.Rule = rule; NudValue.Maximum = rule.MaxValue; NudValue.Minimum = rule.MinValue; NudValue.Font = new Font(this.Font.FontFamily, this.Font.Size + 3F); NudValue.ValueChanged += (sender, e) => { if (NudValue.Value == Rule.DefaultValue) { NudValue.ForeColor = Color.FromArgb(0, 138, 217); NudValue.Font = new Font(NudValue.Font, FontStyle.Bold); } else { NudValue.ForeColor = Color.Black; NudValue.Font = new Font(NudValue.Font, FontStyle.Regular); } this.ItemValue = (int)NudValue.Value; }; NudValue.Value = ItemValue; }
public DictionariesBox() { this.SuspendLayout(); this.Dock = DockStyle.Fill; this.Controls.AddRange(pages); this.Font = SystemFonts.MenuFont; this.Font = new Font(this.Font.FontFamily, this.Font.Size + 1F); cms.Items.AddRange(items); for (int i = 0; i < 6; i++) { boxs[i] = new ReadOnlyRichTextBox { Parent = pages[i] }; if (i > 0) { boxs[i].ContextMenuStrip = cms; } } items[0].Click += (sender, e) => ExternalProgram.OpenNotepadWithText(GetInitialText()); items[2].Click += (sender, e) => SaveFile(); boxs[0].Controls.Add(btnOpenDir); btnOpenDir.Top = boxs[0].Height - btnOpenDir.Height; ToolTipBox.SetToolTip(btnOpenDir, AppString.Menu.FileLocation); btnOpenDir.MouseDown += (sender, e) => ExternalProgram.OpenDirectory(AppConfig.DicsDir); this.SelectedIndexChanged += (sender, e) => LoadText(); this.VisibleChanged += (sender, e) => this.SetEnabled(this.Visible); this.ResumeLayout(); }
public SubNewItem(bool isPublic) { this.AddCtrs(new[] { btnAddExisting, btnAddSeparator }); ToolTipBox.SetToolTip(btnAddExisting, isPublic ? AppString.Tip.AddReference : AppString.Tip.AddFromParentMenu); ToolTipBox.SetToolTip(btnAddSeparator, AppString.Tip.AddSeparator); btnAddExisting.MouseDown += (sender, e) => AddExisting?.Invoke(); btnAddSeparator.MouseDown += (sender, e) => AddSeparator?.Invoke(); }
public SubSeparatorItem() { this.Text = AppString.Other.Separator; this.HasImage = false; BtnDelete = new DeleteButton(this); BtnMoveDown = new MoveButton(this, false); BtnMoveUp = new MoveButton(this, true); ToolTipBox.SetToolTip(BtnDelete, AppString.Menu.Delete); }
public NewItem(string text) { this.Text = text; this.Image = AppImage.NewItem; this.AddCtr(BtnAddNewItem); ToolTipBox.SetToolTip(BtnAddNewItem, text); BtnAddNewItem.MouseDown += (sender, e) => AddNewItem?.Invoke(); this.MouseDoubleClick += (sender, e) => AddNewItem?.Invoke(); }
private void LoadShellExItems(XmlNode shellExXN, FoldGroupItem groupItem) { foreach (XmlNode itemXN in shellExXN.SelectNodes("Item")) { if (!XmlDicHelper.FileExists(itemXN)) { continue; } if (!XmlDicHelper.JudgeCulture(itemXN)) { continue; } if (!XmlDicHelper.JudgeOSVersion(itemXN)) { continue; } if (!GuidEx.TryParse(itemXN.SelectSingleNode("Guid")?.InnerText, out Guid guid)) { continue; } EnhanceShellExItem item = new EnhanceShellExItem { FoldGroupItem = groupItem, ShellExPath = $@"{groupItem.GroupPath}\ShellEx", Image = ResourceIcon.GetIcon(itemXN.SelectSingleNode("Icon")?.InnerText)?.ToBitmap() ?? AppImage.SystemFile, DefaultKeyName = itemXN.SelectSingleNode("KeyName")?.InnerText, Guid = guid }; foreach (XmlNode textXE in itemXN.SelectNodes("Text")) { if (XmlDicHelper.JudgeCulture(textXE)) { item.Text = ResourceString.GetDirectString(textXE.InnerText); } } if (item.Text.IsNullOrWhiteSpace()) { item.Text = GuidInfo.GetText(guid); } if (item.DefaultKeyName.IsNullOrWhiteSpace()) { item.DefaultKeyName = guid.ToString("B"); } string tip = ""; foreach (XmlElement tipXE in itemXN.SelectNodes("Tip")) { if (XmlDicHelper.JudgeCulture(tipXE)) { tip = tipXE.GetAttribute("Text"); } } ToolTipBox.SetToolTip(item.ChkVisible, tip); this.AddItem(item); } }
public InvalidItem(PulicMultiItemsList list, string keyName) { this.Owner = list; this.Text = $"{AppString.Other.InvalidItem} {keyName}"; this.Image = AppImage.NotFound.ToTransparent(); BtnDelete = new DeleteButton(this); BtnMoveDown = new MoveButton(this, false); BtnMoveUp = new MoveButton(this, true); BtnMoveUp.MouseDown += (sender, e) => Owner.MoveItem(this, true); BtnMoveDown.MouseDown += (sender, e) => Owner.MoveItem(this, false); ToolTipBox.SetToolTip(this, AppString.Tip.InvalidItem); ToolTipBox.SetToolTip(BtnDelete, AppString.Menu.Delete); }
public ShellNewLockItem(ShellNewList list) { this.Owner = list; this.Image = AppImage.Lock; this.Text = AppString.Other.LockNewMenu; BtnShowMenu = new MenuButton(this); ChkVisible = new VisibleCheckBox(this) { Checked = IsLocked }; ToolTipBox.SetToolTip(ChkVisible, AppString.Tip.LockNewMenu); TsiSearch = new WebSearchMenuItem(this); TsiRegLocation = new RegLocationMenuItem(this); this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { TsiSearch, new ToolStripSeparator(), TsiRegLocation }); }
public ExplorerRestarter() { this.Visible = false; this.DoubleBuffered = false; this.Dock = DockStyle.Bottom; this.Image = AppImage.Explorer; this.Text = AppString.Other.RestartExplorer; ToolTipBox.SetToolTip(BtnRestart, AppString.Tip.RestartExplorer); this.AddCtr(BtnRestart); this.CanMoveForm(); ShowHandler += () => this.Visible = true; HideHandler += () => this.Visible = false; BtnRestart.MouseDown += (sender, e) => { ExternalProgram.RestartExplorer(); this.Visible = false; }; }
private void InitializeComponents() { this.Controls.AddRange(new Control[] { lblName, txtName, lblIcon, picIcon, btnBrowse, btnDelete, btnOK, btnCancel }); int a = 20.DpiZoom(); lblName.Left = lblName.Top = lblIcon.Left = btnDelete.Left = txtName.Top = a; txtName.Left = lblName.Right + a; btnOK.Left = btnDelete.Right + a; btnCancel.Left = btnOK.Right + a; txtName.Width = btnCancel.Right - txtName.Left; btnBrowse.Left = btnCancel.Right - btnBrowse.Width; picIcon.Left = btnOK.Left + (btnOK.Width - picIcon.Width) / 2; btnBrowse.Top = txtName.Bottom + a; picIcon.Top = btnBrowse.Top + (btnBrowse.Height - picIcon.Height) / 2; lblIcon.Top = btnBrowse.Top + (btnBrowse.Height - lblIcon.Height) / 2; btnDelete.Top = btnOK.Top = btnCancel.Top = btnBrowse.Bottom + a; this.ClientSize = new Size(btnCancel.Right + a, btnCancel.Bottom + a); ToolTipBox.SetToolTip(btnDelete, AppString.Tip.DeleteGuidDic); btnBrowse.Click += (sender, e) => SelectIcon(); btnDelete.Click += (sender, e) => this.IsDelete = true; }
public StringRegRuleItem(RegRule rule, ItemInfo info) : base(info) { this.AddCtr(LblValue); ToolTipBox.SetToolTip(LblValue, info.Tip); TsiRegLocation = new RegLocationMenuItem(this); this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripSeparator(), TsiRegLocation }); this.Rule = rule; LblValue.Text = ItemValue; LblValue.Font = new Font(this.Font.FontFamily, this.Font.Size + 3F); LblValue.MouseDown += (sender, e) => { using (InputDialog dlg = new InputDialog()) { dlg.Title = AppString.Menu.ChangeText; dlg.Text = ItemValue; if (dlg.ShowDialog() != DialogResult.OK) { return; } ItemValue = LblValue.Text = dlg.Text; } }; LblValue.TextChanged += (sender, e) => ItemValue = LblValue.Text; }
private void AddDirItem() { MyListItem item = new MyListItem { Text = Path.GetFileNameWithoutExtension(SendToPath), Image = ResourceIcon.GetFolderIcon(SendToPath).ToBitmap() }; PictureButton btnPath = new PictureButton(AppImage.Open); ToolTipBox.SetToolTip(btnPath, AppString.Menu.FileLocation); btnPath.MouseDown += (sender, e) => ExternalProgram.OpenDirectory(SendToPath); item.AddCtr(btnPath); this.InsertItem(item, 1); item.ContextMenuStrip = new ContextMenuStrip(); ToolStripMenuItem tsiRestoreDefault = new ToolStripMenuItem(AppString.Menu.RestoreDefault); item.ContextMenuStrip.Items.Add(tsiRestoreDefault); tsiRestoreDefault.Enabled = Directory.Exists(DefaultSendToPath); tsiRestoreDefault.Click += (sender, e) => { if (AppMessageBox.Show(AppString.Message.RestoreDefault, MessageBoxButtons.OKCancel) == DialogResult.OK) { File.SetAttributes(SendToPath, FileAttributes.Normal); Directory.Delete(SendToPath, true); Directory.CreateDirectory(SendToPath); File.SetAttributes(SendToPath, File.GetAttributes(DefaultSendToPath)); foreach (string srcPath in Directory.GetFiles(DefaultSendToPath)) { string dstPath = $@"{SendToPath}\{Path.GetFileName(srcPath)}"; File.Copy(srcPath, dstPath); } this.ClearItems(); this.LoadItems(); } }; }
private void LoadShellItems(XmlNode shellXN, FoldGroupItem groupItem) { foreach (XmlElement itemXE in shellXN.SelectNodes("Item")) { if (!XmlDicHelper.FileExists(itemXE)) { continue; } if (!XmlDicHelper.JudgeCulture(itemXE)) { continue; } if (!XmlDicHelper.JudgeOSVersion(itemXE)) { continue; } string keyName = itemXE.GetAttribute("KeyName"); if (keyName.IsNullOrWhiteSpace()) { continue; } EnhanceShellItem item = new EnhanceShellItem() { RegPath = $@"{groupItem.GroupPath}\shell\{keyName}", FoldGroupItem = groupItem, ItemXE = itemXE }; foreach (XmlElement szXE in itemXE.SelectNodes("Value/REG_SZ")) { if (!XmlDicHelper.JudgeCulture(szXE)) { continue; } if (szXE.HasAttribute("MUIVerb")) { item.Text = ResourceString.GetDirectString(szXE.GetAttribute("MUIVerb")); } if (szXE.HasAttribute("Icon")) { item.Image = ResourceIcon.GetIcon(szXE.GetAttribute("Icon"))?.ToBitmap(); } else if (szXE.HasAttribute("HasLUAShield")) { item.Image = AppImage.Shield; } } if (item.Image == null) { XmlElement cmdXE = (XmlElement)itemXE.SelectSingleNode("SubKey/Command"); if (cmdXE != null) { Icon icon = null; if (cmdXE.HasAttribute("Default")) { string filePath = ObjectPath.ExtractFilePath(cmdXE.GetAttribute("Default")); icon = ResourceIcon.GetIcon(filePath); } else { XmlNode fileXE = cmdXE.SelectSingleNode("FileName"); if (fileXE != null) { string filePath = ObjectPath.ExtractFilePath(fileXE.InnerText); icon = ResourceIcon.GetIcon(filePath); } } item.Image = icon?.ToBitmap(); icon?.Dispose(); } } if (item.Image == null) { item.Image = AppImage.NotFound; } if (item.Text.IsNullOrWhiteSpace()) { item.Text = keyName; } string tip = ""; foreach (XmlElement tipXE in itemXE.SelectNodes("Tip")) { if (XmlDicHelper.JudgeCulture(tipXE)) { tip = tipXE.GetAttribute("Value"); } } if (itemXE.GetElementsByTagName("CreateFile").Count > 0) { if (!tip.IsNullOrWhiteSpace()) { tip += "\n"; } tip += AppString.Tip.CommandFiles; } ToolTipBox.SetToolTip(item.ChkVisible, tip); this.AddItem(item); } }
public AppSettingBox() { this.SuspendLayout(); this.Font = SystemFonts.MenuFont; this.Font = new Font(this.Font.FontFamily, this.Font.Size + 1F); mliConfigDir.AddCtrs(new Control[] { cmbConfigDir, btnConfigDir }); mliBackup.AddCtrs(new Control[] { chkBackup, btnBackupDir }); mliUpdate.AddCtrs(new Control[] { cmbUpdate, btnUpdate }); mliRepo.AddCtr(cmbRepo); mliTopMost.AddCtr(chkTopMost); mliProtect.AddCtr(chkProtect); mliEngine.AddCtr(cmbEngine); mliWinXSortable.AddCtr(chkWinXSortable); mliShowFilePath.AddCtr(chkShowFilePath); mliOpenMoreRegedit.AddCtr(chkOpenMoreRegedit); mliOpenMoreExplorer.AddCtr(chkOpenMoreExplorer); mliHideDisabledItems.AddCtr(chkHideDisabledItems); mliHideSysStoreItems.AddCtr(chkHideSysStoreItems); ToolTipBox.SetToolTip(btnUpdate, AppString.Tip.ImmediatelyCheck); ToolTipBox.SetToolTip(cmbConfigDir, AppString.Tip.ConfigPath); ToolTipBox.SetToolTip(btnConfigDir, AppString.Menu.FileLocation); ToolTipBox.SetToolTip(btnBackupDir, AppString.Menu.FileLocation); cmbRepo.Items.AddRange(new[] { "Github", "Gitee" }); cmbConfigDir.Items.AddRange(new[] { AppString.Other.AppDataDir, AppString.Other.AppDir }); cmbEngine.Items.AddRange(AppConfig.EngineUrlsDic.Keys.ToArray()); cmbEngine.Items.Add(AppString.Other.CustomEngine); cmbUpdate.Items.AddRange(new[] { AppString.Other.OnceAWeek, AppString.Other.OnceAMonth, AppString.Other.OnceASeason, AppString.Other.NeverCheck }); cmbConfigDir.Width = cmbEngine.Width = cmbUpdate.Width = cmbRepo.Width = 120.DpiZoom(); cmbConfigDir.DropDownStyle = cmbEngine.DropDownStyle = cmbUpdate.DropDownStyle = cmbRepo.DropDownStyle = ComboBoxStyle.DropDownList; cmbConfigDir.AutosizeDropDownWidth(); cmbEngine.AutosizeDropDownWidth(); cmbUpdate.AutosizeDropDownWidth(); cmbRepo.AutosizeDropDownWidth(); btnUpdate.MouseDown += (sender, e) => { this.Cursor = Cursors.WaitCursor; Updater.Update(true); this.Cursor = Cursors.Default; }; btnConfigDir.MouseDown += (sender, e) => ExternalProgram.OpenDirectory(AppConfig.ConfigDir); btnBackupDir.MouseDown += (sender, e) => ExternalProgram.OpenDirectory(AppConfig.BackupDir); chkBackup.CheckChanged += () => AppConfig.AutoBackup = chkBackup.Checked; chkProtect.CheckChanged += () => AppConfig.ProtectOpenItem = chkProtect.Checked; chkWinXSortable.CheckChanged += () => AppConfig.WinXSortable = chkWinXSortable.Checked; chkOpenMoreRegedit.CheckChanged += () => AppConfig.OpenMoreRegedit = chkOpenMoreRegedit.Checked; chkTopMost.CheckChanged += () => AppConfig.TopMost = this.FindForm().TopMost = chkTopMost.Checked; chkOpenMoreExplorer.CheckChanged += () => AppConfig.OpenMoreExplorer = chkOpenMoreExplorer.Checked; chkHideDisabledItems.CheckChanged += () => AppConfig.HideDisabledItems = chkHideDisabledItems.Checked; chkHideSysStoreItems.CheckChanged += () => AppConfig.HideSysStoreItems = chkHideSysStoreItems.Checked; cmbRepo.SelectionChangeCommitted += (sender, e) => AppConfig.RequestUseGithub = cmbRepo.SelectedIndex == 0; chkShowFilePath.CheckChanged += () => AppConfig.ShowFilePath = chkShowFilePath.Checked; cmbUpdate.SelectionChangeCommitted += (sender, e) => ChangeUpdateFrequency(); cmbConfigDir.SelectionChangeCommitted += (sender, e) => ChangeConfigDir(); cmbEngine.SelectionChangeCommitted += (sender, e) => ChangeEngineUrl(); this.ResumeLayout(); }
private void AddNewItem() { NewItem newItem = new NewItem(); this.AddItem(newItem); PictureButton btnCreateDir = new PictureButton(AppImage.NewFolder); ToolTipBox.SetToolTip(btnCreateDir, AppString.Tip.CreateGroup); newItem.AddCtr(btnCreateDir); btnCreateDir.MouseDown += (sender, e) => CreateNewGroup(); newItem.AddNewItem += () => { using (NewLnkFileDialog dlg1 = new NewLnkFileDialog()) { if (dlg1.ShowDialog() != DialogResult.OK) { return; } using (SelectDialog dlg2 = new SelectDialog()) { dlg2.Title = AppString.Dialog.SelectGroup; dlg2.Items = GetGroupNames(); if (dlg2.ShowDialog() != DialogResult.OK) { return; } string dirName = dlg2.Selected; string dirPath = $@"{WinXPath}\{dirName}"; string itemText = dlg1.ItemText; string targetPath = dlg1.ItemFilePath; string arguments = dlg1.Arguments; string workDir = Path.GetDirectoryName(targetPath); string extension = Path.GetExtension(targetPath).ToLower(); string fileName = Path.GetFileNameWithoutExtension(targetPath); int count = Directory.GetFiles(dirPath, "*.lnk").Length; string index = (count + 1).ToString().PadLeft(2, '0'); string lnkName = $"{index} - {fileName}.lnk"; string lnkPath = $@"{dirPath}\{lnkName}"; using (ShellLink shellLink = new ShellLink(lnkPath)) { if (extension == ".lnk") { File.Copy(targetPath, lnkPath); shellLink.Load(); } else { shellLink.TargetPath = targetPath; shellLink.Arguments = arguments; shellLink.WorkingDirectory = workDir; } shellLink.Description = itemText; shellLink.Save(); } DesktopIni.SetLocalizedFileNames(lnkPath, itemText); foreach (MyListItem ctr in this.Controls) { if (ctr is WinXGroupItem groupItem && groupItem.Text == dirName) { WinXItem item = new WinXItem(lnkPath, groupItem) { Visible = !groupItem.IsFold }; item.BtnMoveDown.Visible = item.BtnMoveUp.Visible = AppConfig.WinXSortable; this.InsertItem(item, this.GetItemIndex(groupItem) + 1); break; } } WinXHasher.HashLnk(lnkPath); ExplorerRestarter.Show(); } } }; }