/// <summary> /// FireTabChangedEvent publishes a TabChangedEvent /// based on the current state of the TabHost. /// </summary> /// <param name="sendBlank">Determines if the Active Window should be checked for validity prior to sending the Message</param> private void FireTabChangedEvent(Boolean sendBlank) { //Get a reference to the TabHostView TabHostView thv = this._unity.Resolve <TabHostView>(Strings.TabHostViewName); //Create an ActiveTabInfo and fill it ActiveTabInfo info = new ActiveTabInfo(); //If the flag says to check the active window, do it if (sendBlank == false) { //If there is a current Tab available, fill the //ActiveDocumentInfo object. TabView dw = thv._tabContainer.ActiveWindow as TabView; if (dw != null) { //Cast the DataContext to the TabViewModel TabViewModel tvm = dw.DataContext as TabViewModel; //Fill the info info.DocumentName = tvm.DocumentName; info.TabsOpen = thv._tabContainer.Children.Count; } } //Finally, fire the TabChangedEvent this._eventAggregator.GetEvent <TabChangedEvent>().Publish(info); }
/// <summary> /// OnDocumentNameChangedEvent sets the value of the /// DocumentName and fires an event to subscribers. /// </summary> /// <param name="tabName">The Name of the Tab</param> private void OnTabChanged(ActiveTabInfo info) { //Generate the String for the Title StringBuilder title = new StringBuilder(info.DocumentName); //Add a separator if necessary if (title.Length > 0) { title.Append(Strings.TitleSeparator); } //Now add the Application name title.Append(Strings.ApplicationName); //Set the Document Name Property this.Title = title.ToString(); }
/// <summary> /// OnTabChange is called when a Tab in the MDI region /// is changed in some way. The SpectrumInfo is exposed /// directly to the View for DataBinding. /// </summary> /// <param name="info">The SpectrumInfo </param> private void OnTabChanged(ActiveTabInfo info) { //Set the TabsAvailable Property this.TabsAvailable = (info.TabsOpen > 0); }