/// <summary> /// Sets the ToolTip values to all controls of the view. /// </summary> protected static void SetToolTipValues(bool ttOnOff, decimal ttDelay, decimal ttDisplayTime, Control control) { if (control == null) { return; } ToolTip tt = ControlTranslator.GetToolTipControl(control); if (tt != null) { tt.Active = ttOnOff; tt.InitialDelay = (int)(ttDelay * 1000); tt.AutoPopDelay = (int)(ttDisplayTime * 1000); } if (control.GetType() == typeof(ToolStrip)) { ((ToolStrip)control).ShowItemToolTips = ttOnOff; } foreach (Control ctrl in control.Controls) { SetToolTipValues(ttOnOff, ttDelay, ttDisplayTime, ctrl); } }
private void cbWelcomeLanguages_SelectedIndexChanged(object sender, EventArgs e) { Language lang = cbWelcomeLanguages.SelectedItem as Language; if (lang != null) { OptionsController.SelectedLanguage = Localizer.GlobalInstance.GetLanguageNameByLongName(lang.LongName); ControlTranslator.TranslateControls(Localizer.GlobalInstance, this); EventDistributor.InvokeLanguageChanged(this); } }
/// <summary> /// Callback function for the LanguageChanged event. /// Translates all controls of the BaseView. /// </summary> protected static void LanguageChanged(object sender) { // translates the controls of the view. ControlTranslator.TranslateControls(Localizer.GlobalInstance, View as Control, OptionsController.SelectedLanguage); foreach (TabView addedTabView in mAddedTabViews.Values) { TabPage tabPage = addedTabView.TabUserControl.Parent as TabPage; if (tabPage != null) { tabPage.Text = addedTabView.TabUserControl.GetTabCaption(); } } }
internal void LanguageChanged() { // translates the controls of the view. ControlTranslator.TranslateControls(Localizer.GlobalInstance, this as Control, OptionsController.SelectedLanguage); // translate columns of ModSelection TreeView foreach (NamedTreeColumn column in tvCkanRepositories.Columns) { var newColData = TreeViewAdvColumnHelper.GetColumn(Columns, column.Name); if (newColData != null) { column.Header = newColData.Header; } } }
internal void LanguageChanged() { // translates the controls of the view. ControlTranslator.TranslateControls(Localizer.GlobalInstance, this as Control, OptionsController.SelectedLanguage); // translate columns of ModSelection TreeView List <NamedTreeColumn> columns = new List <NamedTreeColumn>(); foreach (NamedTreeColumn column in tvModSelection.Columns) { var newColData = ModSelectionColumnsInfo.GetColumn(column.Name); if (newColData != null) { column.Header = newColData.Header; } } }
private void HandleMouseDoubleClick(object sender, MouseEventArgs e) { string xml = ControlTranslator.CreateTranslateSettingsFileOfControls(this); string filepath = Path.Combine(Application.StartupPath, string.Format("{0}.eng.lang", Name)); var assembly = (from asm in AppDomain.CurrentDomain.GetAssemblies() from type in asm.GetTypes() where type.IsClass && type.Name == this.GetType().Name select asm).FirstOrDefault(); if (assembly != null) { Type objectType = (from type in assembly.GetTypes() where type.IsClass && type.Name == "Messages" select type).FirstOrDefault(); if (objectType != null) { object obj = Activator.CreateInstance(objectType); var p = obj.GetType().GetProperties(); FieldInfo[] fields = obj.GetType().GetFields( BindingFlags.NonPublic | BindingFlags.Static); xml = xml.Replace("</Language>", string.Empty); foreach (FieldInfo fInfo in fields) { string name = fInfo.Name; if (fInfo.FieldType != typeof(string)) { continue; } string value = fInfo.GetValue(obj).ToString(); string node = string.Format("<String Name=\"{0}\" Value=\"{1}\"/>", name.Replace("DEFAULT_", string.Empty), ControlTranslator.GetXmlEscapedString(value)); xml += node + Environment.NewLine; } xml += "</Language>"; } } File.WriteAllText(filepath, xml); MessageBox.Show(string.Format("Control translation file saved to \"{0}\"", filepath)); }
private void EmulatedControlTreeViewItem_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { TextBox castedSender = (TextBox)sender; ClientInfo clientInfo = _inputBoxEmulatedControls[castedSender]; string message = castedSender.Text; castedSender.Text = ""; try { ControlMessageResultClient messageResult = ControlTranslator.DecodeFrom(message); string robotCommand; switch (messageResult.Type) { case ControlMessageTypesClient.Path: robotCommand = _server.ConvertToRobCmd(messageResult.RobotID, messageResult.WaitTime, messageResult.Path); break; case ControlMessageTypesClient.Pickup: robotCommand = RobotTranslator.EncodeToPickup(); break; case ControlMessageTypesClient.Setdown: robotCommand = RobotTranslator.EncodeToSetdown(); break; case ControlMessageTypesClient.Rest: robotCommand = RobotTranslator.EncodeToRest(); break; case ControlMessageTypesClient.GetItem: robotCommand = RobotTranslator.EncodeToGetItem(); break; case ControlMessageTypesClient.PutItem: robotCommand = RobotTranslator.EncodeToPutItem(); break; default: throw new ArgumentException("Unknown command type: " + messageResult.Type.ToString()); } _server.SendMsg(ClientType.R, messageResult.RobotID, robotCommand); } catch (Exception ex) { ShowMessage("Error: " + ex.Message); } } }
private void tvModSelection_SelectionChanged(object sender, EventArgs e) { if (LicenseManager.UsageMode == LicenseUsageMode.Designtime || DesignMode) { return; } ModNode selectedNode = SelectedNode; tvModSelection.ContextMenuStrip = (selectedNode == null) ? cmsModSelectionAllMods : cmsModSelectionOneMod; ControlTranslator.TranslateControls(Localizer.GlobalInstance, tvModSelection.ContextMenuStrip, OptionsController.SelectedLanguage); if (selectedNode != null) { ModNode zipRoot = selectedNode.ZipRoot; ArchivePath = string.IsNullOrEmpty(zipRoot.Key) ? Messages.NONE : zipRoot.Key; ModName = zipRoot.Name; ModVersionControl = zipRoot.SiteHandlerName; ModID = zipRoot.ProductID; ModVersion = zipRoot.Version; KSPVersion = zipRoot.KSPVersion; ModAuthor = zipRoot.Author; ModCreationDate = zipRoot.CreationDate; ModChangeDate = zipRoot.ChangeDate; ModOutdated = zipRoot.IsOutdated; ModRating = zipRoot.Rating; ModDownloads = zipRoot.Downloads; ModNote = zipRoot.Note; FileName = selectedNode.Name; FileDestination = selectedNode.Destination; FileConflict = selectedNode.HasCollision; FileInstalled = selectedNode.IsInstalled; btnProceedHighlighted.Enabled = true; tsbProceedMod.Enabled = true; tssbAddMod.Enabled = true; tsmiAddMod.Enabled = true; tsmiAddModArchives.Enabled = true; tsbRemoveMod.Enabled = true; tsbRemoveAll.Enabled = true; ////tsbExImport.Enabled = true; tsbScan.Enabled = true; tsbUpdateCheckAllMods.Enabled = true; tsbUpdateMod.Enabled = true; tsbProceedMod.Enabled = true; tsbModUpdateCheck.Enabled = true; tssbVisitVersionControlSite.Enabled = true; tsmiVisitVersionControlSite.Enabled = !string.IsNullOrEmpty(selectedNode.ZipRoot.ModURL); tsmiVisitAdditionalLink.Enabled = !string.IsNullOrEmpty(selectedNode.ZipRoot.AdditionalURL); tsbEditModInfos.Enabled = true; tsbCopyModInfos.Enabled = true; tsbSolveConflicts.Enabled = ModRegister.HasConflicts; tsbRefreshCheckedState.Enabled = true; tssbChangeDestination.Enabled = true; tsmiChangeDestination.Enabled = true; tsmiResetDestination.Enabled = true; tsbCreateZip.Enabled = !selectedNode.ZipExists; tsbRelocateArchivePath.Enabled = true; } else { ModName = "KSP Mod Admin AnyOS"; ArchivePath = System.Reflection.Assembly.GetEntryAssembly().Location; ModVersionControl = (OptionsController.VersionCheck) ? Messages.ON : Messages.OFF; ModID = string.Empty; ModVersion = VersionHelper.GetAssemblyVersion(false); KSPVersion = "0.21 or higher"; ModAuthor = "BHeinrich ([email protected])"; ModCreationDate = "25.04.2013"; ModChangeDate = VersionHelper.GetChangeDate(false).ToString(); ModOutdated = false; ModRating = string.Empty; ModDownloads = "86k+"; ModNote = "KSP MA aOS is the mod managing tool for KSP on any OS. ;)"; FileName = "KSPModAdmin.exe"; FileDestination = string.Empty; FileConflict = false; FileInstalled = true; btnProceedHighlighted.Enabled = false; tsbProceedMod.Enabled = false; ////tssbAddMod.Enabled = false; ////tsmiAddMod.Enabled = false; ////tsmiAddModArchives.Enabled = false; tsbRemoveMod.Enabled = false; ////tsbRemoveAll.Enabled = false; ////tsbExImport.Enabled = false; ////tsbScan.Enabled = false; ////tsbUpdateCheckAllMods.Enabled = false; tsbUpdateMod.Enabled = false; tsbProceedMod.Enabled = false; tsbModUpdateCheck.Enabled = false; tssbVisitVersionControlSite.Enabled = false; tsmiVisitVersionControlSite.Enabled = false; tsmiVisitAdditionalLink.Enabled = false; tsbEditModInfos.Enabled = false; tsbCopyModInfos.Enabled = false; tsbSolveConflicts.Enabled = ModRegister.HasConflicts; tsbRefreshCheckedState.Enabled = false; tssbChangeDestination.Enabled = false; tsmiChangeDestination.Enabled = false; tsmiResetDestination.Enabled = false; tsbCreateZip.Enabled = false; tsbRelocateArchivePath.Enabled = false; } lvModSelection.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent); lvModSelection.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); }
/// <summary> /// Shows the Form. /// </summary> public new void Show(IWin32Window p) { ControlTranslator.TranslateControls(Localizer.GlobalInstance, this); base.Show(p); }
/// <summary> /// Shows the Form. /// </summary> /// <returns>The results of the dialog.</returns> public new DialogResult ShowDialog(IWin32Window p) { ControlTranslator.TranslateControls(Localizer.GlobalInstance, this); return(base.ShowDialog(p)); }
/// <summary> /// Callback function for the LanguageChanged event. /// Translates all controls of the BaseView. /// </summary> protected static void LanguageChanged(object sender) { // translates the controls of the view. ControlTranslator.TranslateControls(Localizer.GlobalInstance, View as Control, OptionsController.SelectedLanguage); }