public Login() { InitializeComponent(); Utility.setTheme(this); _d = Globals.ThisAddIn.getData(); _settings = Globals.ThisAddIn.getSettings(); _local = Globals.ThisAddIn.GetLocalSettings(); // depending on the setting hide the demo logins GetLogins(_local.ShowAllLogins); if (radComboDemoLogins.Items.Count > 0) { radComboDemoLogins.SelectedIndex = 0; } // hid the theme pcicker and the local dbase themepick1.Visibility = System.Windows.Visibility.Hidden; label4.Visibility = System.Windows.Visibility.Hidden; themepick1.SelectedIndex = 0; cbLocal.Visibility = System.Windows.Visibility.Hidden; tbUserName.Focus(); tbUserName.SelectAll(); }
public LoginSSO() { // Login to Support CS SSO - just use a browser control to hit the SSO page and then // sniff for the Session Id and use that to login to the API // started with the WPF browser control but was very buggy! searching the internet said // the windows forms one was more stable, switched and seems to be fine // TODO - timeout detection - when salesforce timesout, there is a javascript error from the control // I think when SForce is trying to display the "You are about to be logged out due to inactivity" // this should be trapped and a message shown to the user with a better logout message/process InitializeComponent(); Utility.setTheme(this); RadWindowInteropHelper.SetAllowTransparency(this, false); _d = Globals.ThisAddIn.getData(); _settings = Globals.ThisAddIn.getSettings(); _local = Globals.ThisAddIn.GetLocalSettings(); // try the windows form browser _webBrowser1 = new System.Windows.Forms.WebBrowser(); this.wfh1.Child = _webBrowser1; _webBrowser1.Navigated += _webBrowser1_Navigated; _webBrowser1.DocumentCompleted += _webBrowser1_DocumentCompleted; // stop the reminders - salesforce puts up a reminder window - it doesn't work though // we get an IE window with an error so just cancel it _webBrowser1.NewWindow += _webBrowser1_NewWindow; }
public Playbook() { InitializeComponent(); Utility.setTheme(this); AddHandler(Hyperlink.RequestNavigateEvent, new RoutedEventHandler(OnNavigationRequest)); this.D = Globals.ThisAddIn.getData(); this.btnOK.IsEnabled = false; }
public Contract() { InitializeComponent(); Utility.setTheme(this); _d = Globals.ThisAddIn.getData(); RefreshContractList(); btnCancel.IsEnabled = false; btnSave.IsEnabled = false; btnOpen.IsEnabled = false; if (!Globals.ThisAddIn.getDebug()) tbHidden.Visibility = System.Windows.Visibility.Hidden; }
public Concept() { InitializeComponent(); Utility.setTheme(this); d = Globals.ThisAddIn.getData(); //populate the list box RefreshConceptList(); btnCancel.IsEnabled = false; btnSave.IsEnabled = false; if (!Globals.ThisAddIn.getDebug()) tbHidden.Visibility = System.Windows.Visibility.Hidden; _editmode = ""; }
public Element() { InitializeComponent(); Utility.setTheme(this); _d = Globals.ThisAddIn.getData(); //Get the drop down values and populate the list box RefreshElementList(); GetDropDown(); if (!Globals.ThisAddIn.getDebug()) tbHidden.Visibility = System.Windows.Visibility.Hidden; btnCancel.IsEnabled = false; btnSave.IsEnabled = false; btnDelete.IsEnabled = false; }
public bool isUserAdmin(Data d){ string profile = d.GetUserProfile(); JToken s = Globals.ThisAddIn.GetSettings().GetGeneralSetting("AdminMenu"); if(s!=null){ if(s.Type == JTokenType.Array){ foreach(string t in (JArray)s){ if (t == profile) return true; } } if (s.Type == JTokenType.String) { if (s.ToString() == profile) return true; } } // Default so that these profiles always get them if (profile == "System Administrator" || profile == "Axiom Admin") return true; return false; }
public Template() { InitializeComponent(); Utility.setTheme(this); d = Globals.ThisAddIn.getData(); //Get the drop down values and populate the list box GetDropDown(); RefreshTemplateList(); btnCancel.IsEnabled = false; btnSave.IsEnabled = false; btnOpen.IsEnabled = false; editmode = "edit"; Utility.ReadOnlyForm(true, new Grid[] { formGrid1, formGrid2 }); if (!Globals.ThisAddIn.getDebug()) tbHidden.Visibility = System.Windows.Visibility.Hidden; }
public Clause(bool refresh) { InitializeComponent(); Utility.setTheme(this); _d = Globals.ThisAddIn.getData(); // Get the drop down values and populate the list box // Russel 1 Oct - this takes ages! don't need to do it if we don;t need the list, i.e. when we open a clause // from a template so don't always do it if (refresh) { this.Refresh(); } else { // no refresh means an Add or Clone and we always need the Concept list for that if (cbConcept.Items.Count == 0) { RefreshConceptList(""); } // need to set up the table if its not been done before if (dgClauses.ItemsSource == null) { DataReturn dr = Utility.HandleData(_d.GetClause("123456789012345")); if (!dr.success) return; dgClauses.ItemsSource = dr.dt.DefaultView; } } if (!Globals.ThisAddIn.getDebug()) tbHidden.Visibility = System.Windows.Visibility.Hidden; btnCancel.IsEnabled = false; btnSave.IsEnabled = false; btnOpen.IsEnabled = false; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { // get the local settings and set the theme Logger.Log("get the local settings and set the theme"); _localSettings = new LocalSettings(); this.SetTheme(); //Create the Salesforce connection _d = new Data(); _p = new Processing(); _p.Hide(); if (_localSettings.SSOLogin) { // switch off normal login Globals.Ribbons.Ribbon1.btnLogin.Visible = false; if (_localSettings.ShowAllLogins) { Globals.Ribbons.Ribbon1.btnLoginSSO.Visible = false; Globals.Ribbons.Ribbon1.sbtnLoginSSO.Visible = true; } else { Globals.Ribbons.Ribbon1.btnLoginSSO.Visible = true; Globals.Ribbons.Ribbon1.sbtnLoginSSO.Visible = false; } } else { Globals.Ribbons.Ribbon1.btnLogin.Visible = true; Globals.Ribbons.Ribbon1.btnLoginSSO.Visible = false; Globals.Ribbons.Ribbon1.sbtnLoginSSO.Visible = false; } // set the name of the Ribbon button depending on the selected instances if (_localSettings.Inst != null && _localSettings.Inst != LocalSettings.Instances.Prod) { Globals.Ribbons.Ribbon1.btnLoginSSO.Label = _localSettings.Inst.ToString(); Globals.Ribbons.Ribbon1.sbtnLoginSSO.Label = _localSettings.Inst.ToString(); } if (_localSettings.Debug) { Globals.Ribbons.Ribbon1.gpDebug.Visible = true; // switch on normal login Globals.Ribbons.Ribbon1.btnLogin.Visible = true; Globals.Ribbons.Ribbon1.btnLoginSSO.Label = "SSO"; } else { Globals.Ribbons.Ribbon1.gpDebug.Visible = false; } // ---------------------------------------------------------------------------------------------------------------------------------------------------- // Change Nov : Auto Login bool autologin = false; if (autologin && _localSettings.Debug) { this.SetRibbon(); //Globals.ThisAddIn.ProcessingStart("AutoLogin - remember to switch off!"); // This can be used for testing so you don't have to login every time // set the autologin about to true // then add the details to the login call - should be username, password, sforce token, sforce url, login description to show in the about string rtn = _d.Login("[email protected]", "pass@word1", "LGZ0rTkNnuksEetJr1vrG0YS", "https://test.salesforce.com", "AutoLogin - Sales"); if (rtn == "") { // get the settings bool gotSettings = true; DataReturn settings = _d.GetStaticResource("RibbonSettings"); if (!settings.success || settings.strRtn == "") { // get the default settings var uri = new Uri("pack://application:,,,/AxiomIRISRibbon;component/Resources/Settings.json"); byte[] bjson = AxiomIRISRibbon.Properties.Resources.Settings; string sjson = Encoding.Default.GetString(bjson, 0, bjson.Length - 1); try { _settings = new SForceEdit.Settings(sjson); gotSettings = true; } catch (Exception eSet) { System.Windows.MessageBoxResult rslt = System.Windows.MessageBox.Show("Settings did not load : " + eSet.Message, "Axiom IRIS", System.Windows.MessageBoxButton.OK); } } else { try { _settings = new SForceEdit.Settings(settings.strRtn); gotSettings = true; } catch (Exception eSet) { System.Windows.MessageBoxResult rslt = System.Windows.MessageBox.Show("Settings did not load : " + eSet.Message, "Axiom IRIS", System.Windows.MessageBoxButton.OK); } } if (!gotSettings) return; DataReturn dr = Utility.HandleData(_d.LoadDefinitions()); Globals.Ribbons.Ribbon1.LoginOK(); Globals.Ribbons.Ribbon1.gpDebug.Visible = true; } //---------------------------------- } else { } Globals.ThisAddIn.ProcessingStop("LoggedIN"); // -------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ _editWindows = new Dictionary<string, Edit>(); _editZoomWindows = new Dictionary<string, Edit>(); //Add in the Save handler this.Application.DocumentBeforeSave += new Word.ApplicationEvents4_DocumentBeforeSaveEventHandler(Application_DocumentBeforeSave); //Add a loader this.Application.DocumentOpen += new Word.ApplicationEvents4_DocumentOpenEventHandler(Application_DocumentOpen); //add a handler to tidy up sidebars this.Application.DocumentChange += Application_DocumentChange; }
private void btnAmend_Click(object sender, RibbonControlEventArgs e) { try { foreach (Microsoft.Office.Tools.CustomTaskPane ctp in Globals.ThisAddIn.CustomTaskPanes) { ctp.Visible = false; } int cnt = Globals.ThisAddIn.CustomTaskPanes.Count; for (int i = 0; i < cnt; i++) Globals.ThisAddIn.CustomTaskPanes.RemoveAt(0); //==New code added above ==// CompareSideBar.SaveCompare(false, true); string attachmentId = Globals.ThisAddIn.GetAttachmentId(); if (attachmentId == null) attachmentId = Globals.ThisAddIn.GetCurrentDocId(); else if (attachmentId != "") { _d = Globals.ThisAddIn.getData(); DataReturn dr1 = AxiomIRISRibbon.Utility.HandleData(_d.AttachmentInfo(attachmentId)); if (!dr1.success) return; DataTable dtAllAttachments = dr1.dt; string _attachmentid = dtAllAttachments.Rows[0]["id"].ToString(); string _filename = dtAllAttachments.Rows[0]["name"].ToString(); string _parentId = dtAllAttachments.Rows[0]["ParentId"].ToString(); CompareAmendment amend = new CompareAmendment(); amend.Create(_attachmentid, _parentId, _filename); amend.Focus(); amend.Show(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Create Amendment"); } }
private void LoadTemplatesDLL() { try { d = Globals.ThisAddIn.getData(); DataReturn dr = AxiomIRISRibbon.Utility.HandleData(d.GetTemplates(true)); if (!dr.success) return; DataTable dt1 = dr.dt; //cbAmendmewnt.Items.Clear(); ComboBoxItem i; // RadComboBoxItem selected = null; foreach (DataRow r in dt1.Rows) { i = new ComboBoxItem(); i.Tag = r["Id"].ToString(); i.Content = r["Name"].ToString(); this.cbAmendmewnt.Items.Add(i); } } catch (Exception ex) { } }