Esempio n. 1
0
        /// <summary>
        /// The constructor accepts the main window as an argument. 
        /// It initializes some variables and connects events from 
        /// the main window to functions.
        /// </summary>
        /// <param name="mainwin">
        ///  The main window of the application.
        /// </param>
        public Presenter(MainWindow mainwin, ResultViewWin resWin)
        {
            this.mainwin = mainwin;
            this.resWin = resWin;
            this.resultString = new StringBuilder ();

            this.mainwin.EventStartCalculation += StartCalculation;
            this.mainwin.EventViewResults += ViewResults;
            this.mainwin.EventFileIsOpened += InvalidateResult;

            this.resWin.EventSaveToFile += SaveToFile;

            this.resultIsCurrent = false;
        }
Esempio n. 2
0
 public static void Main(string[] args)
 {
     /*
      * We only create the main window and the presenter here
      * since for some reason if we create them all here and pass them along
      * as arguments to the presenter, they all show up right away. It's
      * probably an issue on my end, but it's not really a biggie to create
      * the windows in the presenter when needed.
      */
     Application.Init ();
     MainWindow mainWin = new MainWindow ();
     ResultViewWin resWin = new ResultViewWin();
     Presenter presenter = new Presenter(mainWin, resWin);
     mainWin.Show ();
     Application.Run ();
 }
Esempio n. 3
0
 /// <summary>
 /// ViewResult creates a new ResultViewWin and connects its event to presenter functions.
 /// The TextView in the result window is then updated with the results string from
 /// StartCalculation above. If the user wishes to save the result (Most likely),
 /// the event EventSaveToFile is fired and caught here.
 /// </summary>
 /// <param name="sender">
 /// A <see cref="System.Object"/>
 /// </param>
 public void ViewResults(object sender)
 {
     rvw = new ResultViewWin ();
     rvw.EventSaveToFile += SaveToFile;
     this.rvw.updateTextView(resultString.ToString());
     rvw.Show();
 }