public override void SyncChanges() { EnsureChildControls(); ExtentrixWIWebPart webpart = this.WebPartToEdit as ExtentrixWIWebPart; // initialize textbox with UserGreeting property lblVersionInfo.Text = webpart.VersionInfo; lblLicenseExpirationDate.Text = string.Format("<br/>License Expiration Date: {0}", webpart.LicenseExpirationDate); lblLicenseExpirationDate.Visible = webpart.LicenseTrial == true; if (webpart.LicenseTrial != null) { lblTrialLicense.Text = webpart.LicenseTrial == true ? "<br/>Trial Version License" : ""; } else { lblTrialLicense.Text = "<br/>No License"; } }
private ExtentrixWIWebPart getWebPartCurrentInstance() { ExtentrixWIWebPart wp_res = null; WebPartManager web_manager = WebPartManager.GetCurrentWebPartManager(this.Page); IEnumerator it = web_manager.WebParts.GetEnumerator(); while (it.MoveNext()) { if (it.Current != null) { if (it.Current.GetType() == typeof(ExtentrixWIWebPart)) { wp_res = (ExtentrixWIWebPart)it.Current; break; } } } ; return(wp_res); }
protected void Page_Load(object sender, EventArgs e) { ExtentrixWIWebPart wp = getWebPartCurrentInstance(); //set appearance properties MainBodyPanel.BorderWidth = MainBodyBorderWidth; MainBodyPanel.BorderColor = MainBodyBorderColor; MainBodyPanel.BackColor = MainBodyBackColor; ToolBarPanel.BackColor = ToolBarBackColor; linkIcaClientUrl.DataBind(); fldIcaClientVersion.DataBind(); if (!Page.IsPostBack) { fldShowExpirationMessage.DataBind(); } else { fldShowExpirationMessage.Value = ""; } //Page.Response.Cache.SetNoServerCaching(); //to create current folder Application if (Page.Session[CurrentFolder] == null) { Page.Session[CurrentFolder] = string.Empty; } //fill view switcher if (!Page.IsPostBack) { FillViewSwitcher(); } var queryString = Page.Request.QueryString; if (queryString.HasKeys() && !string.IsNullOrEmpty(queryString["app"]) && !string.IsNullOrEmpty(queryString["farmName"])) { // Lunch application passed by query string string id = queryString["app"].ToString(); string frmName = queryString["farmName"].ToString(); string hostName = wp.getCurrentHost(); if (!IsUseSecureStore) { wp.launchApplication(wp.GetCredentials(SPContext.Current.Web.CurrentUser), id, hostName, frmName); } else { var credentials = Credentials ?? SecureStoreManager.GetExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); if (credentials != null) { if (CredentialLiveTime != -1) { if (!SecureStoreManager.IsCredentialsExpired(CredentialLiveTime)) { wp.launchApplication(credentials, id, hostName, frmName); } else { SecureStoreManager.DeleteExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); LoadCredentialsView(true); } } else { var isValid = true; if (!Page.IsPostBack) { var service = new WebServiceAPI(); if (service.IsCredentialsValid((WindowsCredentials)credentials)) { Credentials = credentials; } else { isValid = false; SecureStoreManager.DeleteExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); } } if (isValid) { wp.launchApplication(Credentials, id, hostName, frmName); } else { LoadCredentialsView(false); } } } else { LoadCredentialsView(SecureStoreManager.IsCredentialsExpired(CredentialLiveTime)); } } return; } else { try { if (!IsUseSecureStore) { if (Credentials == null) { Credentials = wp.GetCredentials(SPContext.Current.Web.CurrentUser); } LoadWebPartView(wp); } else { var credentials = Credentials ?? SecureStoreManager.GetExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); if (credentials != null) { if (CredentialLiveTime != -1) { if (!SecureStoreManager.IsCredentialsExpired(CredentialLiveTime)) { Credentials = credentials; LoadWebPartView(wp); } else { SecureStoreManager.DeleteExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); LoadCredentialsView(true); } } else { var isValid = true; if (!Page.IsPostBack) { var service = new WebServiceAPI(); if (service.IsCredentialsValid((WindowsCredentials)credentials)) { Credentials = credentials; } else { isValid = false; SecureStoreManager.DeleteExtentrixWindowsCredentials(Page, LogLocation, SPContext.Current.Web.CurrentUser); } } if (isValid) { LoadWebPartView(wp); } else { LoadCredentialsView(false); } } } else { LoadCredentialsView(SecureStoreManager.IsCredentialsExpired(CredentialLiveTime)); } } } catch (Exception ex) { Logger.Default.Error(LogLocation, "User - " + Page.Request.LogonUserIdentity.Name + " ; Error = " + ex.Message, ex); AppMultiView.ActiveViewIndex = 5; } } }
private void LoadWebPartView(ExtentrixWIWebPart wp) { //if (Page.Session[PublishedApps] == null) PublishedApplication[] publishedApps = Page.Session[PublishedApps] as PublishedApplication[]; if (!Page.IsPostBack && publishedApps == null) { var watch = Stopwatch.StartNew(); Logger.Default.Info(LogLocation, string.Format("LoadWebPartView: Start getting applications {0}", DateTime.Now)); DelegateGetApplications delGetApp = new DelegateGetApplications(wp.getApplication); IAsyncResult result = delGetApp.BeginInvoke(Credentials, null, null); publishedApps = delGetApp.EndInvoke(result); Logger.Default.Info(LogLocation, string.Format("LoadWebPartView: End getting applications {0}", watch.Elapsed)); //check is app filter applied if ((publishedApps != null) && (publishedApps.Length > 0)) { Page.Session[PublishedApps] = publishedApps; new Thread(() => wp.ProcessIcons(Credentials, wp.getService())).Start(); } } if (publishedApps != null) { if (IsAppFilterApplied) { var appsFiltered = new List <PublishedApplication>(); string[] filter = AppFilter.Split(','); for (int i = 0; i < filter.Length; i++) { foreach (PublishedApplication app in publishedApps) { if (app.AppName.ToLower().Contains(filter[i].ToLower())) { appsFiltered.Add(app); } } } publishedApps = appsFiltered.ToArray(); } Logger.Default.Info(LogLocation, "LoadWebPartView: Start creating app tree"); tree = new ApplicationsTree(publishedApps); Logger.Default.Info(LogLocation, "LoadWebPartView: End creating app tree"); if (SPContext.Current.Web.CurrentUser != null) { favorites = new Favorites(tree); } } if (SPContext.Current.Web.CurrentUser == null) { DropDownViewSwitcher.Items.Remove(DropDownViewSwitcher.Items.FindByText("Favorites")); } if ((publishedApps != null) && (publishedApps.Length > 0)) { FillView(GetCurrentView(DropDownViewSwitcher.SelectedValue)); } }
protected void DisconnectSessionsButton_Click(object sender, EventArgs e) { ExtentrixWIWebPart wp = getWebPartCurrentInstance(); wp.DisconnectSessions(Credentials); }