public TreeBrowser(Word.Application application, SitecoreItemGetter sitecoreItemGetter) { Globals.SitecoreAddin.Log("Initializing the tree browser..."); Application = application; InitializeComponent(); ControlContext.Initalize(application); //InitializeItems(); //This constructor is called upon Microsoft Word startup. Initializing the items //will call the the Sitecore Tree. Instead, load the items only when the user tries //to open the Sitecore Tree. _siteCoreItemGetter = sitecoreItemGetter; _scTree = new SCTree(); Globals.SitecoreAddin.Log("Tree Browser initialized."); }
public ArticleDetails() { try { Globals.SitecoreAddin.Log("Initializing the article details window..."); InitializeComponent(); Opacity = 0; _scTree = new SCTree(); _scServer = new SCServer(); // TEMPORARY code to deal with QA login var credCache = new CredentialCache(); var netCred = new NetworkCredential("velir", "ebi3000"); credCache.Add(new Uri(_scTree.Url), "Basic", netCred); credCache.Add(new Uri(_scServer.Url), "Basic", netCred); _scTree.PreAuthenticate = true; _scTree.Credentials = credCache; _scServer.PreAuthenticate = true; _scServer.Credentials = credCache; // end temporary _user = SitecoreUser.GetUser(); _authors = _scTree.GetAuthors().Select(t => new StaffStruct() { ID = t.ID, Name = t.Name, Publications = t.Publications }).ToArray().ToList(); _editors = _scTree.GetEditors().Select(t => new StaffStruct() { ID = t.ID, Name = t.Name, Publications = t.Publications }).ToArray().ToList(); _sitecoreArticle = new SitecoreArticle(); _wordUtils = new WordUtils(); _wordApp = SitecoreAddin.WordApp; _documentCustomProperties = new DocumentCustomProperties(_wordApp, _wordApp.ActiveDocument); try { InitializeDropdowms(); InitializeControllers(); Opacity = 1; SetCheckedOutStatus(); _connectedAtStart = true; } catch (WebException e) { AlertConnectionFailed(); Globals.SitecoreAddin.LogException("Error getting metadata or checked out status!", e); throw new ApplicationException("Error getting metadata or checked out status!", e); } var deleteIcon = new ImageList(); deleteIcon.Images.Add(Resources.delete_icon); uxSelectedAuthors.SmallImageList = deleteIcon; uxSelectedEditors.SmallImageList = deleteIcon; string articleNumber = GetArticleNumber(); if (!articleNumber.IsNullOrEmpty()) { uxArticleNumber.Text = articleNumber; GetArticeDetailsFromSitecore(); } uxLockStatus.Refresh(); Globals.SitecoreAddin.Log("Article details window initialized."); } catch (Exception ex) { Globals.SitecoreAddin.LogException("Error while loading article details!", ex); } }