Beispiel #1
0
        private void RegistrationChanged(object sender, EventArgs e)
        {
            if (regComboBox.SelectedIndex < 0)
            {
                RefreshWtColor();
                return;
            }

            // unsubsribe all event handlers
            if (controller != null)
            {
                UnSubscribe(controller);
                currentTable = null;
                controller   = null;
            }

            // set currentTable and controller
            if (tables != null && tables.Count > 0)
            {
                var ac          = aircrafts.Find(regComboBox.Text).Config;
                var profileName = ac.TOProfile;
                currentTable = tables.First(t => t.Entry.ProfileName == profileName);

                controller = FormControllerFactory.GetController(
                    ControllerType.Boeing, ac, currentTable, elements, this);
                // TODO: only correct for Boeing.

                Subscribe(controller);
                controller.Initialize();
                RefreshWtColor();
            }
        }
        static void Main()
        {
            try
            {
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(OnGuiUnhandedException);
                AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                controller = new MainFormController();
                using (var form = new MainForm(controller))
                {
                    Application.Run(form);
                }
            }
            catch (Exception e)
            {
                HandleUnhandledException(e);
            }
            finally
            {
                // Cleanup
            }
        }
Beispiel #3
0
 void Work()
 {
     while (true)
     {
         IFormController task = null;
         lock (m_locker)
         {
             if (m_tasks.Count > 0)
             {
                 task = m_tasks.Dequeue();
                 if (task == null)
                 {
                     return;
                 }
             }
         }
         if (task != null)
         {
             task.InitiateSolution();
             task.DrawBoardOnForm();
         }
         else
         {
             m_waitHandle.WaitOne();
         }
     }
 }
        public AboutBox(Form parent, IFormController _controller) : base(_controller)
        {
            InitializeComponent();

            // Need to tell the utility class that this is the assembly
            var util = new AssemblyUtilities(Assembly.GetExecutingAssembly());

            // Set the form values
            this.Text = $"About {util.AssemblyTitle}";
            this.labelProductVersion.Text = $"V{util.AssemblyVersion}";
            this.labelCopyright.Text      = util.AssemblyCopyright;
            //this.labelDescription.Text = util.AssemblyDescription;
            this.textBoxDescription.Text          = util.AssemblyDescription;
            this.textBoxThirdpartyComponents.Text = _thirdpartyDescription;

            // Initialize the sourcecode link label
            this.linkLabelSource.Text = _sourceLink;
            //this.linkLabelSource.Links.Add(0, _sourceLink.Length, _sourceLink);
            //this.linkLabelSource.LinkClicked += (o, i) =>
            //{
            //    linkLabelSource.LinkVisited = true;
            //    System.Diagnostics.Process.Start(_sourceLink);
            //};

            // Initialize the thirdparty link label
            this.linkLabelThirdparty.Text = _thirdpartyLink;
            //this.linkLabelThirdparty.Links.Add(0, _thirdpartyLink.Length, _thirdpartyLink);
            //this.linkLabelThirdparty.LinkClicked += (o, i) =>
            //{
            //    linkLabelThirdparty.LinkVisited = true;
            //    System.Diagnostics.Process.Start(_thirdpartyLink);
            //};

            //SetTheme(((MainFormController)Controller).UserSettings.ActiveTheme);
        }
Beispiel #5
0
        private void UnSubscribe(IFormController controller)
        {
            wtUnitComboBox.SelectedIndexChanged -= controller.WeightUnitChanged;
            flapsComboBox.SelectedIndexChanged  -= controller.FlapsChanged;
            calculateBtn.Click -= controller.Compute;

            controller.CalculationCompleted -= SaveState;
        }
 public static InfoPanel GetInstance(Form parent, IFormController _controller)
 {
     if (_infoPanel == null)
     {
         _infoPanel = new InfoPanel(parent, _controller);
     }
     return(_infoPanel);
 }
Beispiel #7
0
        private void UnSubscribe(IFormController controller)
        {
            var e = elements;

            List(e.ThrustRating, e.AntiIce, e.Flaps, e.SurfCond, e.Packs).ForEach(i =>
                                                                                  i.SelectedIndexChanged -= (s, ev) => UpdateFormOptions());

            calculateBtn.Click -= Compute;
        }
        public MainForm(IFormController _controller) : base(_controller)
        {
            Log("Constructing MainForm()");
            InitializeComponent();
            Initialize();
            SetBindings();
            SetTitle();

            //TestBuildGridRectangle();
        }
        public FormBase(IFormController _controller)
        {
            if (_controller == null)
            {
                string msg = "The FormBase() constructor requires an IFormController object.";
                LogHelper.LogFatal(msg);
                throw new ArgumentNullException(msg);
            }

            this.Controller = _controller as MainFormController;
        }
Beispiel #10
0
        private void UnSubscribe(IFormController controller)
        {
            var c = controller;
            var e = elements;

            List(e.Brake, e.Reverser, e.Flaps, e.SurfCond).ForEach(i =>
                                                                   i.SelectedIndexChanged -= (s, ev) => UpdateFormOptions());

            wtUnitComboBox.SelectedIndexChanged -= WeightUnitChanged;
            calculateBtn.Click -= Compute;
        }
Beispiel #11
0
 public void MetaData_AfterLink() {
     MetaRegistry = MetaData.GetMetaData(this, "registry");
     conn = this.getInstance<IDataAccess>();
     metaNoTable = this.getInstance<IMetaData>();
     ctrl = this.getInstance<IFormController>();
     QHC = new CQueryHelper();
     QHS = conn.GetQueryHelper();
     rdoCF.Checked = true;
     QueryCreator.SetTableForPosting(DS.registrymainview, "registry");
     GetData.CacheTable(DS.registryclass, QHS.CmpEq("active", "S"), "idregistryclass", true);
     metaNoTable.searchEnabled = false;
     
 }
        private void UnSubscribe(IFormController controller)
        {
            var c = controller;
            var w = weatherInfoControl;

            w.surfCondComboBox.SelectedIndexChanged -= c.SurfCondChanged;
            wtUnitComboBox.SelectedIndexChanged     -= c.WeightUnitChanged;
            flapsComboBox.SelectedIndexChanged      -= c.FlapsChanged;
            revThrustComboBox.SelectedIndexChanged  -= c.ReverserChanged;
            brakeComboBox.SelectedIndexChanged      -= c.BrakesChanged;
            calculateBtn.Click -= c.Compute;

            c.CalculationCompleted -= SaveState;
        }
Beispiel #13
0
        public void MetaData_AfterLink()
        {
            _conn       = this.getInstance <IDataAccess>();
            _security   = this.getInstance <ISecurity>();
            _controller = this.getInstance <IFormController>();
            _dispatcher = this.getInstance <IMetaDataDispatcher>();
            _meta       = this.getInstance <IMetaData>();

            QHC = new CQueryHelper();
            QHS = _conn.GetQueryHelper();

            GetData.CacheTable(DS.expensephase, QHS.AppAnd(QHS.CmpNe("nphase", _security.GetSys("maxexpensephase")),
                                                           QHS.CmpGe("nphase", _security.GetSys("expensefinphase"))), "nphase", true);
            HelpForm.SetDenyNull(DS.csa_contractexpense.Columns["idexp"], true);
        }
    void GetForm(FormEnum form)
    {
        IFormController formController;

        switch (form)
        {
        case FormEnum.Nerdgard: formController = ng.GetComponent <NGController> (); break;

        case FormEnum.Spacefighter: formController = sf.GetComponent <SFController> (); break;

        case FormEnum.WarriorDwarf: formController = wd.GetComponent <WDController> (); break;

        default: formController = ng.GetComponent <NGController> (); break;
        }
        characterController = formController;
    }
        /// <summary>
        /// Create UI page, usually to configure a single service
        /// </summary>
        /// <param name="pageKey">Page key, the same as in <see cref="mappings"/></param>
        /// <param name="model">Settings container</param>
        /// <param name="formController">Reference to form controller</param>
        /// <returns>Representation of a configuration page</returns>
        public Control GetNextPage(string pageKey, ServiceHostConfiguration model, IFormController formController)
        {
            if (currentController != null)
            {
                currentController.UnregisterFormController(formController);
            }

            var stateDef      = RequestStateDef(pageKey);
            var modelResolved = ResolveModel(pageKey, model);

            var view       = Activator.CreateInstance(stateDef.ViewType);
            var controller = (IPageController)Activator.CreateInstance(stateDef.ControllerType, new[] { modelResolved, Facade.Instance });

            currentController = controller;

            controller.RegisterView(view);
            controller.RegisterFormController(formController);
            controller.PrepareView();

            return((Control)view);
        }
Beispiel #16
0
        private void RegistrationChanged(object sender, EventArgs e)
        {
            if (regComboBox.SelectedIndex < 0)
            {
                RefreshWtColor();
                return;
            }

            // unsubsribe all event handlers
            if (controller != null)
            {
                UnSubscribe(controller);
                currentTable = null;
                controller   = null;
            }

            // set currentTable and controller
            if (tables != null && tables.Count > 0)
            {
                var ac          = aircrafts.Find(regComboBox.Text).Config;
                var profileName = ac.LdgProfile;

                currentTable = tables.First(t => t.Entry.ProfileName == profileName);

                controller = GetFormController(new ControllerData()
                {
                    ConfigItem    = ac,
                    PerfTable     = currentTable,
                    Elements      = elements,
                    ParentControl = this
                });

                Subscribe(controller);
                UpdateFormOptions();

                RefreshWtColor();
            }
        }
Beispiel #17
0
        public void MetaData_AfterLink()
        {
            _conn       = this.getInstance <IDataAccess>();
            _security   = this.getInstance <ISecurity>();
            _controller = this.getInstance <IFormController>();
            _dispatcher = this.getInstance <IMetaDataDispatcher>();
            _meta       = this.getInstance <IMetaData>();

            QHC = new CQueryHelper();
            QHS = _conn.GetQueryHelper();

            GetData.CacheTable(DS.expensephase, QHS.AppAnd(QHS.CmpNe("nphase", _security.GetSys("maxexpensephase")),
                                                           QHS.CmpGe("nphase", _security.GetSys("expensefinphase")), QHS.CmpLt("nphase", _security.GetSys("expenseregphase"))), "nphase", true);

            int    esercizioCurr = (int)_meta.GetSys("esercizio");
            string filter        = QHS.CmpEq("ayear", esercizioCurr);

            GetData.SetStaticFilter(DS.fin, QHS.AppAnd(filter, QHS.BitSet("flag", 0)));
            GetData.SetStaticFilter(DS.account, filter);
            PostData.MarkAsTemporaryTable(DS.fase_epexp, false);
            GetData.MarkToAddBlankRow(DS.fase_epexp);
            GetData.Add_Blank_Row(DS.fase_epexp);
            EnableFaseImpegnoBudget(1, "Preimpegno di Budget");
            //EnableFaseImpegnoBudget(2, "Impegno di Budget");
            string filterSiope = QHS.CmpEq("codesorkind", _security.GetSys("codesorkind_siopespese"));

            DataTable tSortingkind = _conn.RUN_SELECT("sortingkind", "*", null, filterSiope, null, null, true);

            if ((tSortingkind != null) && (tSortingkind.Rows.Count > 0))
            {
                DataRow R              = tSortingkind.Rows[0];
                object  idsorkind      = R["idsorkind"];
                object  idsorkind_main = R["idsorkind"];
                SetGBoxClass(idsorkind);
            }
        }
Beispiel #18
0
        private void RegistrationChanged(object sender, EventArgs e)
        {
            if (regComboBox.SelectedIndex < 0)
            {
                RefreshWtColor();
                return;
            }

            // unsubsribe all event handlers
            if (controller != null)
            {
                UnSubscribe(controller);
                currentTable = null;
                controller   = null;
            }

            var(ac, perf) = FindTable.Find(tables, aircrafts, regComboBox.Text);
            if (ac != null && perf != null)
            {
                // Set currentTable and controller.

                currentTable = perf;

                controller = GetController(new FormControllerData()
                {
                    ConfigItem    = ac.Config,
                    PerfTable     = currentTable,
                    Elements      = elements,
                    ParentControl = this
                });

                Subscribe(controller);
                UpdateFormOptions();
                RefreshWtColor();
            }
        }
Beispiel #19
0
 public void SetController(IFormController controller)
 {
     this.controller = controller;
 }
Beispiel #20
0
 public LogViewer(Form parent, IFormController _controller) : base(_controller)
 {
     InitializeComponent();
     Initialize();
 }
Beispiel #21
0
        public void CheckFieldValue(IFormController form, string field, string value)
        {
            string actualValue = form.GetElementValue(field);

            Assert.AreEqual(value, actualValue, "В поле '{0}' ожидалось значение '{1}', получено - '{2}'", field, value, actualValue);
        }
 public SkylineSettingsManagerForm(Form parent, IFormController _controller) : base(_controller)
 {
     InitializeComponent();
     this.Owner = parent;
     SetBindings();
 }
 public void UnregisterFormController(IFormController formController)
 {
     formController.BeforeSave -= OnBeforeSave;
 }
 public void RegisterFormController(IFormController formController)
 {
     this.formController        = formController;
     formController.BeforeSave += OnBeforeSave;
 }
        private InfoPanel(Form parent, IFormController _controller) : base(_controller)
        {
            Init(parent);

            Initialize();
        }
Beispiel #26
0
 public void EnqueueTask(IFormController controller)
 {
     lock (m_locker)
         m_tasks.Enqueue(controller);
     m_waitHandle.Set();
 }
Beispiel #27
0
 public void SetController(IFormController controller)
 {
     this.controller = controller;
 }