diff --git a/SourceGenWPF/MainController.cs b/SourceGenWPF/MainController.cs index 5e08f1f..e50b90c 100644 --- a/SourceGenWPF/MainController.cs +++ b/SourceGenWPF/MainController.cs @@ -70,6 +70,11 @@ namespace SourceGenWPF { #endregion Project state + /// + /// Reference back to MainWindow object. + /// + private MainWindow mMainWin; + /// /// List of recently-opened projects. /// @@ -142,6 +147,10 @@ namespace SourceGenWPF { /// private bool mUseMainAppDomainForPlugins = false; + public MainController(MainWindow win) { + mMainWin = win; + } + /// /// Ensures that the named project is at the top of the list. If it's elsewhere @@ -477,6 +486,7 @@ namespace SourceGenWPF { ShowNoProject(); InvalidateControls(null); #endif + mMainWin.ShowCodeListView = false; mGenerationLog = null; @@ -538,6 +548,8 @@ namespace SourceGenWPF { RefreshProject(UndoableChange.ReanalysisScope.CodeAndData); //ShowProject(); //InvalidateControls(null); + mMainWin.ShowCodeListView = true; + mNavStack.Clear(); // Want to do this after ShowProject() or we see a weird glitch. UpdateRecentProjectList(mProjectPathName); diff --git a/SourceGenWPF/ProjWin/MainWindow.xaml b/SourceGenWPF/ProjWin/MainWindow.xaml index 3004213..13cc2f8 100644 --- a/SourceGenWPF/ProjWin/MainWindow.xaml +++ b/SourceGenWPF/ProjWin/MainWindow.xaml @@ -31,6 +31,13 @@ limitations under the License. + + + @@ -172,7 +179,8 @@ limitations under the License. HorizontalAlignment="Stretch" VerticalAlignment="Center"/> - + @@ -207,6 +215,24 @@ limitations under the License. + + + + + + + + + + + + + + + + diff --git a/SourceGenWPF/ProjWin/MainWindow.xaml.cs b/SourceGenWPF/ProjWin/MainWindow.xaml.cs index b339d19..9994d84 100644 --- a/SourceGenWPF/ProjWin/MainWindow.xaml.cs +++ b/SourceGenWPF/ProjWin/MainWindow.xaml.cs @@ -15,8 +15,10 @@ */ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -32,11 +34,8 @@ namespace SourceGenWPF.ProjWin { /// /// Interaction logic for MainWindow.xaml /// - public partial class MainWindow : Window { - public string ProgramVersionString { - get { return App.ProgramVersion.ToString(); } - } - + public partial class MainWindow : Window, INotifyPropertyChanged { + /// private MainController mUI; public MainWindow() { @@ -44,7 +43,62 @@ namespace SourceGenWPF.ProjWin { // TODO: verify that RuntimeData dir is accessible - mUI = new MainController(); + this.DataContext = this; + mUI = new MainController(this); + } + + + /// + /// INotifyPropertyChanged event + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Call this when a notification-worthy property changes value. + /// + /// The CallerMemberName attribute puts the calling property's name in the first arg. + /// + /// Name of property that changed. + private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + private bool mShowCodeListView; + + /// + /// Which panel are we showing, launchPanel or codeListView? + /// + public bool ShowCodeListView { + get { + return mShowCodeListView; + } + set { + mShowCodeListView = value; + NotifyPropertyChanged("LaunchPanelVisibility"); + NotifyPropertyChanged("CodeListVisibility"); + } + } + + /// + /// Returns true if we should be showing the launch panel. + /// (Intended for use from XAML.) + /// + public Visibility LaunchPanelVisibility { + get { return mShowCodeListView ? Visibility.Hidden : Visibility.Visible; } + } + + /// + /// Returns true if we should be showing the code ListView. + /// (Intended for use from XAML.) + /// + public Visibility CodeListVisibility { + get { return mShowCodeListView ? Visibility.Visible : Visibility.Hidden; } + } + + /// Version string, for display. + /// + public string ProgramVersionString { + get { return App.ProgramVersion.ToString(); } } private void AssembleCmd_Executed(object sender, ExecutedRoutedEventArgs e) {