Esempio n. 1
0
 /// <summary>
 /// a static functoin that creates an object of FGModelImp
 /// </summary>
 /// <param name="telnetClient">telnet client to initialize</param>
 public static void CreateModel(ITelnetClient telnetClient)
 {
     if (fgModel != null)
     {
         throw new Exception("FGModel was created");
     }
     fgModel = new FGModelImp(telnetClient);
 }
        /// <summary>
        /// this function starts InspectorWindow and closes loadingWindow, after flight gear fully started.
        /// </summary>
        /// <param name="sender"> the sender object </param>
        /// <param name="e"> the event args </param>
        void bg_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // create a new view model, with flight gear model and telnet client
            FGModelImp model = FGModelImp.Instance;

            InspectorWindow inspector = new InspectorWindow(vm, fileCSV, fileDLL);

            inspector.Show();
            loadingWindow.Close();
            vm.Start(fileCSV);
        }
        /// <summary>
        /// this function starts flight gear, while the loading window is shown.
        /// </summary>
        /// <param name="sender"> the sender object </param>
        /// <param name="e"> the event args </param>
        void bg_DoWork(object sender, DoWorkEventArgs e)
        {
            // run the view model
            string binFolder   = Directory.GetParent(fileFG).ToString();
            string XMLFileName = System.IO.Path.GetFileNameWithoutExtension(fileXML);

            DataModel.CreateModel(fileCSV, fileXML);
            FGModelImp.CreateModel(new TelnetClient());
            FGModelImp model = FGModelImp.Instance;

            vm = new FGViewModel(model);
            vm.Run(binFolder, fileFG, XMLFileName);
        }