Ejemplo n.º 1
0
 static void Main()
 {
     try
     {
         bool createdNew = true;
         using (Mutex mutex = new Mutex(true, Assembly.GetExecutingAssembly().GetName().Name, out createdNew))
         {
             if (createdNew)
             {
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 Application.Run(new AppMainForm());
             }
             else
             {
                 AppUtility.ShowKryptonMessageBox("Application Already Running", string.Format("{0} is already running!", Assembly.GetExecutingAssembly().GetName().Name), "",
                                                  TaskDialogButtons.OK, MessageBoxIcon.Error, null);
             }
         }
     }
     catch (Exception ex)
     {
         AppUtility.ShowKryptonMessageBox("Application Exception", "", string.Format("{0}\n{1}", ex.Message, ex.StackTrace), TaskDialogButtons.OK, MessageBoxIcon.Error, null);
     }
 }
Ejemplo n.º 2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = AppUtility.ShowKryptonMessageBox("Confirm Closing", String.Format("Are you sure to Close?"), "", TaskDialogButtons.Yes | TaskDialogButtons.No, MessageBoxIcon.Question, this);

            if (result == DialogResult.Yes)
            {
                _autoLockoutTimer.Enabled = false;
                DestroyAll();
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 3
0
        private void VerifyCriticalSimulateComponent()
        {
            #region Standard Pattern
            AppMachine.Comp.AppMachine machine = AppMachine.Comp.AppMachine.This;
            #endregion

            //Critical Component define

            /* Add Critical Component name to verify Here (Example in Below)
             * machine.CriticalCompList.Add(U.GetComponent(AppConstStaticName.ALLWAGOIO));
             * machine.CriticalCompList.Add(U.GetComponent(AppConstStaticName.FEEDMOTIONSYSTEM));
             * machine.CriticalCompList.Add(U.GetComponent(AppConstStaticName.LIFT1MOTIONSYSTEM));
             * machine.CriticalCompList.Add(U.GetComponent(AppConstStaticName.LIFT2MOTIONSYSTEM));
             * machine.CriticalCompList.Add(U.GetComponent(AppConstStaticName.VISIONSYSTEM));
             */

            #region Standard Pattern
            string simulatedCompList = "";
            bool   anySimulated      = false;
            foreach (CompBase comp in machine.CriticalCompList)
            {
                if (comp.Simulate != CompBase.eSimulate.None)
                {
                    simulatedCompList += String.Format("Component \"{0}\" is simulted" + Environment.NewLine, comp.Nickname);
                    anySimulated       = true;
                }
            }

            if (anySimulated)
            {
                this.BackColor              = Color.Red;
                simulatedCompList          += "Machine Unable to Start.";
                btnRun.Visible              = false;
                btnPause.Visible            = false;
                mcbStopWhenFinished.Visible = false;
                btnEStop.Visible            = false;
                btnHomeAll.Visible          = false;
                machine.Simulate            = CompBase.eSimulate.SimulateDontAsk;

                AppUtility.ShowKryptonMessageBox("Machine Unable to Start", "Some Component are Simulated", simulatedCompList, TaskDialogButtons.OK, MessageBoxIcon.Information, this);
            }
            #endregion
        }