public override bool Initialize(IPluginHost host) { Debug.Assert(host != null, PlugInName + ": " + "No host instance available.", "PlugIn host instance is null."); Terminate(); m_host = host; if (host != null) { m_provOpt = new SAPLogonOpt(host.CustomConfig); m_prov = new LogonColumnProvider(host, m_provOpt); m_host.ColumnProviderPool.Add(m_prov); // Get a reference to the 'Tools' menu item container ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems; // Add the popup menu item m_tsmiSetDlg = new ToolStripMenuItem(); m_tsmiSetDlg.Text = Translatable.ButtonSAPLogonDlg; m_tsmiSetDlg.ToolTipText = Translatable.ButtonSAPLogonDlg; m_tsmiSetDlg.Image = KeeSAPLogon.Properties.Resources.KeeSAPLogonIcon_png; m_tsmiSetDlg.Click += this.OnSettingsDlg; tsMenu.Add(m_tsmiSetDlg); return(true); } return(false); }
private void LoadOptions(SAPLogonOpt config) { if (config != null) { this.cbSAPID.Checked = Convert.ToBoolean(config.DisSystemID); this.cbClient.Checked = Convert.ToBoolean(config.DisClient); this.cbLanguage.Checked = Convert.ToBoolean(config.DisLanguage); this.cbTransaction.Checked = Convert.ToBoolean(config.DisTx); this.tbDefaultLng.Text = config.DefaultLng; this.tbDefaultTx.Text = config.DefaultTx; this.tbSAPGUIPath.Text = config.SAPGUIPath; } }
//--------------------------------------------------------------------------------------------------- // Class Constructors //--------------------------------------------------------------------------------------------------- public OptionDlg(MainForm form, SAPLogonOpt config) { InitializeComponent(); this.tbDefaultLng.KeyPress += new KeyPressEventHandler(this.tbDefaultLng_KeyPress); this.Text = Translatable.TitelOptionDlg; this.Icon = IconExtractor.GetSettingsIcon(); this.btnFolderDlg.Image = IconExtractor.GetOpenFolderIcon().ToBitmap(); this.fbDlgGUIPath.RootFolder = Environment.SpecialFolder.ProgramFilesX86; LoadOptions(config); m_form = form; m_config = config; }
//--------------------------------------------------------------------------------------------------- // Class Constructors //--------------------------------------------------------------------------------------------------- public LogonColumnProvider(IPluginHost host, SAPLogonOpt config) { if (host == null) { string msg = "No plugin host defined."; Debug.Assert((host == null), msg); throw new ApplicationException(msg); } if (config == null) { string msg = "No option handler defined."; Debug.Assert((config == null), msg); throw new ApplicationException(msg); } m_host = host; m_config = config; }