/// <summary> /// Update graphic objects with language file values /// </summary> private void UpdateGraphicObjects() { // Main Window Title this.WindowTitle = MainClass.AppNameVer + " [" + GlobalObj.AppNameVer + "]"; // Update menu and toolbar mainwindow_Ui.menu_File.Title = GlobalObj.LMan.GetString("filemenulbl").Replace("_", "&"); mainwindow_Ui.action_Open.Text = GlobalObj.LMan.GetString("openmenulbl").Replace("_", "&"); mainwindow_Ui.action_Open.IconText = GlobalObj.LMan.GetString("openlbl"); mainwindow_Ui.action_Close.Text = GlobalObj.LMan.GetString("closemenulbl").Replace("_", "&"); mainwindow_Ui.action_Close.IconText = GlobalObj.LMan.GetString("closelbl"); mainwindow_Ui.action_SerialSettings.Text = GlobalObj.LMan.GetString("settingsmenulbl"); mainwindow_Ui.action_SerialSettings.IconText = GlobalObj.LMan.GetString("settingslbl"); mainwindow_Ui.action_Exit.Text = GlobalObj.LMan.GetString("exitmenulbl").Replace("_", "&"); mainwindow_Ui.action_Exit.IconText = GlobalObj.LMan.GetString("exitlbl"); mainwindow_Ui.menu_Reader.Title = GlobalObj.LMan.GetString("readermenulbl").Replace("_", "&"); mainwindow_Ui.menu_About.Title = GlobalObj.LMan.GetString("helpmenulbl").Replace("_", "&"); mainwindow_Ui.action_Info.Text = GlobalObj.LMan.GetString("infomenulbl").Replace("_", "&"); mainwindow_Ui.action_Info.IconText = GlobalObj.LMan.GetString("infolbl"); mainwindow_Ui.action_ATR.IconText = GlobalObj.LMan.GetString("atrlbl"); mainwindow_Ui.FrameATR.Title = GlobalObj.LMan.GetString("atrframelbl"); mainwindow_Ui.FrameFile.Title = GlobalObj.LMan.GetString("commandfilelbl"); mainwindow_Ui.FrameExchange.Title = GlobalObj.LMan.GetString("cardframelbl"); mainwindow_Ui.LblCommand.Text = GlobalObj.LMan.GetString("cmdlbl"); mainwindow_Ui.LblResponse.Text = GlobalObj.LMan.GetString("resplbl"); mainwindow_Ui.BtnSend.Text = GlobalObj.LMan.GetString("sendlbl"); // Update font for command list if (GlobalObj.IsWindows()) { mainwindow_Ui.LstCommands.Font = new QFont("Courier New", 10); } else { mainwindow_Ui.LstCommands.Font = new QFont("Fixed", 10); } // loop for each managed readers type foreach (IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } // Update readers list on gui QAction action_Reader; QActionGroup readersGrp = new QActionGroup(this); for (int r = 0; r < allReaders.Count; r++) { action_Reader = new QAction(allReaders[r], mainwindow_Ui.menu_Reader); action_Reader.ObjectName = "action_Reader_" + r.ToString(); action_Reader.SetVisible(true); action_Reader.IconVisibleInMenu = false; action_Reader.Checkable = true; action_Reader.SetActionGroup(readersGrp); if (r == 0) { action_Reader.SetChecked(true); } else { action_Reader.SetChecked(false); } mainwindow_Ui.menu_Reader.AddAction(action_Reader); Connect(action_Reader, SIGNAL("activated()"), this, SLOT("ActionChangeReader()")); } // check for available readers if (allReaders.Count > 0) { // select first reader GlobalObj.SelectedReader = allReaders[0]; } // LANGUAGE STATUS TIP // mainwindow_Ui.action_Open.StatusTip = ""; // status bar desc // LANGUAGE TOOL TIP // mainwindow_Ui.action_Open.ToolTip = ""; // tool tip text }
/// <summary> /// Update Gtk objects properties /// </summary> private void UpdateGraphicObjects() { // Set dialog icon MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png"); // Set tool tip text for toolbutton TbOpen.TooltipText = GlobalObj.LMan.GetString("openact"); TbOpen.Label = GlobalObj.LMan.GetString("openlbl"); TbClose.Label = GlobalObj.LMan.GetString("closelbl"); TbSettings.Label = GlobalObj.LMan.GetString("settingslbl"); TbSettings.TooltipText = GlobalObj.LMan.GetString("settingsmenulbl"); TbAbout.TooltipText = GlobalObj.LMan.GetString("infoact"); TbAbout.Label = GlobalObj.LMan.GetString("infolbl"); TbExit.TooltipText = GlobalObj.LMan.GetString("exitact"); TbExit.Label = GlobalObj.LMan.GetString("exitlbl"); TbATR.TooltipText = GlobalObj.LMan.GetString("atract"); TbATR.Label = GlobalObj.LMan.GetString("atrlbl"); // Set labels ((Label)MenuFileItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("filemenulbl"); ((Label)MenuFileOpen.Child).TextWithMnemonic = GlobalObj.LMan.GetString("openmenulbl"); ((Label)MenuFileClose.Child).TextWithMnemonic = GlobalObj.LMan.GetString("closemenulbl"); ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObj.LMan.GetString("settingsmenulbl"); ((Label)MenuFileExit.Child).TextWithMnemonic = GlobalObj.LMan.GetString("exitmenulbl"); ((Label)MenuReaderItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("readermenulbl"); ((Label)MenuAboutItem.Child).TextWithMnemonic = GlobalObj.LMan.GetString("helpmenulbl"); ((Label)MenuAboutInfo.Child).TextWithMnemonic = GlobalObj.LMan.GetString("infomenulbl"); LblATR.Markup = "<b>" + GlobalObj.LMan.GetString("atrframelbl") + "</b>"; LblCommand.Text = GlobalObj.LMan.GetString("cmdlbl"); LblResponse.Text = GlobalObj.LMan.GetString("resplbl"); LblSend.Text = GlobalObj.LMan.GetString("sendlbl"); LblExchange.Markup = "<b>" + GlobalObj.LMan.GetString("cardframelbl") + "</b>"; LblFile.Markup = "<b>" + GlobalObj.LMan.GetString("commandfilelbl") + "</b>"; Gdk.Color color = new Gdk.Color(); Gdk.Color.Parse("#0000FF", ref color); TxtATR.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#0000FF", ref color); TxtResp.ModifyText(StateType.Normal, color); Gdk.Color.Parse("#1F6D20", ref color); TxtCmd.ModifyText(StateType.Normal, color); // TreeView (List) LstCommands.Selection.Mode = SelectionMode.Single; CellRendererText rendererText = new CellRendererText(); TreeViewColumn column = new TreeViewColumn(); column.Title = "Commands"; column.Resizable = true; column.PackStart(rendererText, true); column.AddAttribute(rendererText, "text", 0); LstCommands.RulesHint = true; LstCommands.AppendColumn(column); if (GlobalObj.IsWindows()) { LstCommands.ModifyFont(FontDescription.FromString("Courier New Normal 10")); } else { LstCommands.ModifyFont(FontDescription.FromString("Fixed Normal 10")); } // update gui menu Gtk.RadioMenuItem rmi; // loop for all readers List <string> allReaders = new List <string>(); // loop for each managed readers type foreach (IReader rdr in GlobalObj.ReaderManager.Values) { allReaders.AddRange(rdr.Readers); } for (int n = 0; n < allReaders.Count; n++) { // set first as selected if (n == 0) { rmi = new Gtk.RadioMenuItem(allReaders[n]); GlobalObj.SelectedReader = allReaders[n]; StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]); } else { // added others rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]); } rmi.ButtonReleaseEvent += ActionChangeReader; MenuReader.Add(rmi); } MenuReader.ShowAll(); }