public void Navigate(XTMFPage gotoPage, object extraData = null) { try { do { this.Reload = false; if (this.CheckToSave) { this.InterruptedNavigationTo = gotoPage; this.InterruptedNavigationData = extraData; gotoPage = XTMFPage.SaveProjectPage; this.CheckToSave = false; } if (this.CurrentPage == XTMFPage.SaveProjectPage) { gotoPage = this.CurrentPage = this.InterruptedNavigationTo; extraData = this.InterruptedNavigationData; } else { this.CurrentPage = gotoPage; } var isTerminal = System.Windows.Forms.SystemInformation.TerminalServerSession; if (!isTerminal) { this.DoFadeInAnimation(typeof(Grid)); } this.CurrentMode.Children.Clear(); this.CurrentMode.Visibility = System.Windows.Visibility.Hidden; this.LoadingPane.Visibility = System.Windows.Visibility.Visible; /*if(!isTerminal) * { * DoubleAnimation fadeIn = new DoubleAnimation( 0, 1, new Duration( TimeSpan.FromMilliseconds( 300 ) ) ); * this.LoadingPane.BeginAnimation( Grid.OpacityProperty, fadeIn ); * }*/ this.DoEvents(); if (this.Pages[(int)this.CurrentPage] == null) { this.CreatePage(this.CurrentPage); } this.Pages[(int)this.CurrentPage].SetActive(extraData); this.CurrentMode.Visibility = System.Windows.Visibility.Visible; this.LoadingPane.Visibility = System.Windows.Visibility.Hidden; extraData = null; } while (this.Reload); this.CurrentPath = this.Pages[(int)this.CurrentPage].Path; this.HeaderControl.NewPathSet(); this.CurrentMode.Children.Add((UserControl)this.Pages[(int)this.CurrentPage]); this.HeaderControl.CurrentPageIsStart = (this.CurrentPage == XTMFPage.StartPage); var itemToFocus = (this.Pages[(int)this.CurrentPage] as IInputElement); Keyboard.Focus(itemToFocus); } catch (Exception e) { MessageBox.Show(this, "XTMF.GUI had an internal error:\r\n" + e.Message + "\r\nStack Trace:\r\n" + e.StackTrace, "Internal Error", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(1); } }
public void SetActive(object data) { var questionData = data as BooleanQuestionData; if (questionData == null) { if (data is BooleanQuestionResult) { var res = data as BooleanQuestionResult; if (res.Data is BooleanQuestionData) { questionData = res.Data as BooleanQuestionData; } } } if (questionData == null) { return; } SetupButton(this.SelectButton, questionData.Yes); SetupButton(this.CancelButton, questionData.No); this.Data = questionData; this.QuestionTextBox.Content = questionData.Question; int length; XTMFPage[] ourPath = new XTMFPage[(length = questionData.Path.Length) + 1]; for (int i = 0; i < length; i++) { ourPath[i] = questionData.Path[i]; } ourPath[length] = XTMFPage.QuestionPage; this.Path = ourPath; this.SelectButton.IsEnabled = true; }
public void SetActive(object data) { var questionData = data as QuestionData; if (questionData == null) { if (data is QuestionResult) { var res = data as QuestionResult; if (res.Data is QuestionData) { questionData = res.Data as QuestionData; } } } if (questionData == null) { return; } this.PreviousValid = false; this.Data = questionData; this.QuestionTextBox.Width = double.NaN; this.QuestionTextBox.HeaderText = questionData.Question; this.QuestionTextBox.HintText = questionData.Hint; this.QuestionTextBox.Dispatcher.BeginInvoke( new Action(delegate() { var width = this.QuestionTextBox.HeaderContent.ActualWidth + 50; this.QuestionTextBox.Width = width + (50 - (width % 50)); }), System.Windows.Threading.DispatcherPriority.Background); if (questionData.DefaultText != null) { this.QuestionTextBox.Text = questionData.DefaultText; } else { this.QuestionTextBox.Text = String.Empty; } int length; XTMFPage[] ourPath = new XTMFPage[(length = questionData.Path.Length) + 1]; for (int i = 0; i < length; i++) { ourPath[i] = questionData.Path[i]; } ourPath[length] = XTMFPage.QuestionPage; this.Path = ourPath; if (this.Data.Validate != null) { this.SelectButton.IsEnabled = this.PreviousValid = ((this.ErrorLabel.Content = this.Data.Validate(this.QuestionTextBox.Text)) == null); } else { this.SelectButton.IsEnabled = true; } }
public PathLabel(XTMFPage page) { this.Page = page; InitializeComponent(); }
private void CreatePage(XTMFPage page) { switch ( page ) { case XTMFPage.StartPage: this.Pages[(int)XTMFPage.StartPage] = new StartingPage( this ); break; case XTMFPage.SettingsPage: this.Pages[(int)XTMFPage.SettingsPage] = new SettingsPage( this ); break; case XTMFPage.ImportPage: this.Pages[(int)XTMFPage.ImportPage] = new ImportTypeSelectPage( this ); break; case XTMFPage.ProjectSelectPage: this.Pages[(int)XTMFPage.ProjectSelectPage] = new ProjectPage( this ); break; case XTMFPage.NewProjectPage: this.Pages[(int)XTMFPage.NewProjectPage] = new NewProjectPage( this ); break; case XTMFPage.DeleteProjectPage: this.Pages[(int)XTMFPage.DeleteProjectPage] = new DeleteProjectPage( this ); break; case XTMFPage.SaveProjectPage: this.Pages[(int)XTMFPage.SaveProjectPage] = new SaveProjectPage( this ); break; case XTMFPage.ProjectSettingsPage: this.Pages[(int)XTMFPage.ProjectSettingsPage] = new ProjectSettingsPage( this ); break; case XTMFPage.SelectModelSystemPage: this.Pages[(int)XTMFPage.SelectModelSystemPage] = new SelectModelSystemPage( this ); break; case XTMFPage.ModelSystemSettingsPage: this.Pages[(int)XTMFPage.ModelSystemSettingsPage] = new ModelSystemPage( this ); break; case XTMFPage.RemoveModelSystem: this.Pages[(int)XTMFPage.RemoveModelSystem] = new RemoveModelSystemPage( this ); break; case XTMFPage.RunModelSystemPage: this.Pages[(int)XTMFPage.RunModelSystemPage] = new RunModelSystemPage( this ); break; case XTMFPage.ViewProjectRunsPage: this.Pages[(int)XTMFPage.ViewProjectRunsPage] = new ViewRunsPage( this ); break; case XTMFPage.ViewProjectRunPage: this.Pages[(int)XTMFPage.ViewProjectRunPage] = new ViewRunPage( this ); break; case XTMFPage.DeleteRunPage: this.Pages[(int)XTMFPage.DeleteRunPage] = new DeleteRunPage( this ); break; case XTMFPage.EditModelSystem: this.Pages[(int)XTMFPage.EditModelSystem] = new EditModelSystemPage( this ); break; case XTMFPage.DeleteModelSystemPage: this.Pages[(int)XTMFPage.DeleteModelSystemPage] = new DeleteModelSystemPage( this ); break; case XTMFPage.QuestionPage: this.Pages[(int)XTMFPage.QuestionPage] = new QuestionPage( this ); break; case XTMFPage.BooleanQuestionPage: this.Pages[(int)XTMFPage.BooleanQuestionPage] = new BooleanQuestionPage( this ); break; case XTMFPage.FileNamePage: this.Pages[(int)XTMFPage.FileNamePage] = new CopyFileConflictPage( this ); break; case XTMFPage.AboutPage: this.Pages[(int)XTMFPage.AboutPage] = new AboutPage( this ); break; } }
public void Navigate(XTMFPage gotoPage, object extraData = null) { try { do { this.Reload = false; if ( this.CheckToSave ) { this.InterruptedNavigationTo = gotoPage; this.InterruptedNavigationData = extraData; gotoPage = XTMFPage.SaveProjectPage; this.CheckToSave = false; } if ( this.CurrentPage == XTMFPage.SaveProjectPage ) { gotoPage = this.CurrentPage = this.InterruptedNavigationTo; extraData = this.InterruptedNavigationData; } else { this.CurrentPage = gotoPage; } var isTerminal = System.Windows.Forms.SystemInformation.TerminalServerSession; if ( !isTerminal ) { this.DoFadeInAnimation( typeof( Grid ) ); } this.CurrentMode.Children.Clear(); this.CurrentMode.Visibility = System.Windows.Visibility.Hidden; this.LoadingPane.Visibility = System.Windows.Visibility.Visible; /*if(!isTerminal) { DoubleAnimation fadeIn = new DoubleAnimation( 0, 1, new Duration( TimeSpan.FromMilliseconds( 300 ) ) ); this.LoadingPane.BeginAnimation( Grid.OpacityProperty, fadeIn ); }*/ this.DoEvents(); if ( this.Pages[(int)this.CurrentPage] == null ) { this.CreatePage( this.CurrentPage ); } this.Pages[(int)this.CurrentPage].SetActive( extraData ); this.CurrentMode.Visibility = System.Windows.Visibility.Visible; this.LoadingPane.Visibility = System.Windows.Visibility.Hidden; extraData = null; } while ( this.Reload ); this.CurrentPath = this.Pages[(int)this.CurrentPage].Path; this.HeaderControl.NewPathSet(); this.CurrentMode.Children.Add( (UserControl)this.Pages[(int)this.CurrentPage] ); this.HeaderControl.CurrentPageIsStart = ( this.CurrentPage == XTMFPage.StartPage ); var itemToFocus = ( this.Pages[(int)this.CurrentPage] as IInputElement ); Keyboard.Focus( itemToFocus ); } catch ( Exception e ) { MessageBox.Show(this, "XTMF.GUI had an internal error:\r\n" + e.Message + "\r\nStack Trace:\r\n" + e.StackTrace, "Internal Error", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit( 1 ); } }
private void CreatePage(XTMFPage page) { switch (page) { case XTMFPage.StartPage: this.Pages[(int)XTMFPage.StartPage] = new StartingPage(this); break; case XTMFPage.SettingsPage: this.Pages[(int)XTMFPage.SettingsPage] = new SettingsPage(this); break; case XTMFPage.ImportPage: this.Pages[(int)XTMFPage.ImportPage] = new ImportTypeSelectPage(this); break; case XTMFPage.ProjectSelectPage: this.Pages[(int)XTMFPage.ProjectSelectPage] = new ProjectPage(this); break; case XTMFPage.NewProjectPage: this.Pages[(int)XTMFPage.NewProjectPage] = new NewProjectPage(this); break; case XTMFPage.DeleteProjectPage: this.Pages[(int)XTMFPage.DeleteProjectPage] = new DeleteProjectPage(this); break; case XTMFPage.SaveProjectPage: this.Pages[(int)XTMFPage.SaveProjectPage] = new SaveProjectPage(this); break; case XTMFPage.ProjectSettingsPage: this.Pages[(int)XTMFPage.ProjectSettingsPage] = new ProjectSettingsPage(this); break; case XTMFPage.SelectModelSystemPage: this.Pages[(int)XTMFPage.SelectModelSystemPage] = new SelectModelSystemPage(this); break; case XTMFPage.ModelSystemSettingsPage: this.Pages[(int)XTMFPage.ModelSystemSettingsPage] = new ModelSystemPage(this); break; case XTMFPage.RemoveModelSystem: this.Pages[(int)XTMFPage.RemoveModelSystem] = new RemoveModelSystemPage(this); break; case XTMFPage.RunModelSystemPage: this.Pages[(int)XTMFPage.RunModelSystemPage] = new RunModelSystemPage(this); break; case XTMFPage.ViewProjectRunsPage: this.Pages[(int)XTMFPage.ViewProjectRunsPage] = new ViewRunsPage(this); break; case XTMFPage.ViewProjectRunPage: this.Pages[(int)XTMFPage.ViewProjectRunPage] = new ViewRunPage(this); break; case XTMFPage.DeleteRunPage: this.Pages[(int)XTMFPage.DeleteRunPage] = new DeleteRunPage(this); break; case XTMFPage.EditModelSystem: this.Pages[(int)XTMFPage.EditModelSystem] = new EditModelSystemPage(this); break; case XTMFPage.DeleteModelSystemPage: this.Pages[(int)XTMFPage.DeleteModelSystemPage] = new DeleteModelSystemPage(this); break; case XTMFPage.QuestionPage: this.Pages[(int)XTMFPage.QuestionPage] = new QuestionPage(this); break; case XTMFPage.BooleanQuestionPage: this.Pages[(int)XTMFPage.BooleanQuestionPage] = new BooleanQuestionPage(this); break; case XTMFPage.FileNamePage: this.Pages[(int)XTMFPage.FileNamePage] = new CopyFileConflictPage(this); break; case XTMFPage.AboutPage: this.Pages[(int)XTMFPage.AboutPage] = new AboutPage(this); break; } }
public void SetActive(object data) { var questionData = data as BooleanQuestionData; if ( questionData == null ) { if ( data is BooleanQuestionResult ) { var res = data as BooleanQuestionResult; if ( res.Data is BooleanQuestionData ) { questionData = res.Data as BooleanQuestionData; } } } if ( questionData == null ) return; SetupButton( this.SelectButton, questionData.Yes ); SetupButton( this.CancelButton, questionData.No ); this.Data = questionData; this.QuestionTextBox.Content = questionData.Question; int length; XTMFPage[] ourPath = new XTMFPage[( length = questionData.Path.Length ) + 1]; for ( int i = 0; i < length; i++ ) { ourPath[i] = questionData.Path[i]; } ourPath[length] = XTMFPage.QuestionPage; this.Path = ourPath; this.SelectButton.IsEnabled = true; }
public void SetActive(object data) { var questionData = data as QuestionData; if ( questionData == null ) { if ( data is QuestionResult ) { var res = data as QuestionResult; if ( res.Data is QuestionData ) { questionData = res.Data as QuestionData; } } } if ( questionData == null ) return; this.PreviousValid = false; this.Data = questionData; this.QuestionTextBox.Width = double.NaN; this.QuestionTextBox.HeaderText = questionData.Question; this.QuestionTextBox.HintText = questionData.Hint; this.QuestionTextBox.Dispatcher.BeginInvoke( new Action( delegate() { var width = this.QuestionTextBox.HeaderContent.ActualWidth + 50; this.QuestionTextBox.Width = width + ( 50 - ( width % 50 ) ); } ), System.Windows.Threading.DispatcherPriority.Background ); if ( questionData.DefaultText != null ) { this.QuestionTextBox.Text = questionData.DefaultText; } else { this.QuestionTextBox.Text = String.Empty; } int length; XTMFPage[] ourPath = new XTMFPage[( length = questionData.Path.Length ) + 1]; for ( int i = 0; i < length; i++ ) { ourPath[i] = questionData.Path[i]; } ourPath[length] = XTMFPage.QuestionPage; this.Path = ourPath; if ( this.Data.Validate != null ) { this.SelectButton.IsEnabled = this.PreviousValid = ( ( this.ErrorLabel.Content = this.Data.Validate( this.QuestionTextBox.Text ) ) == null ); } else { this.SelectButton.IsEnabled = true; } }
public PathLabel(XTMFPage page) { this.Page = page; InitializeComponent(); }