Пример #1
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            int alwaysRestartHighPriority = 0, alwaysRestart = 0, bestEffort = 0, doNotRestart = 0;

            foreach (VM.HA_Restart_Priority priority in RestartPriorities)
            {
                switch (priority)
                {
                case VM.HA_Restart_Priority.AlwaysRestartHighPriority:
                    alwaysRestartHighPriority++;
                    break;

                case VM.HA_Restart_Priority.AlwaysRestart:
                case VM.HA_Restart_Priority.Restart:
                    alwaysRestart++;
                    break;

                case VM.HA_Restart_Priority.BestEffort:
                    bestEffort++;
                    break;

                case VM.HA_Restart_Priority.DoNotRestart:
                    doNotRestart++;
                    break;
                }
            }
            if (Helpers.BostonOrGreater(Connection))
            {
                labelSummary.Text = String.Format(Messages.HAWIZ_SUMMARY_NEW,
                                                  HeartbeatSrName.Ellipsise(50),
                                                  Ntol,
                                                  GetVmNumber(alwaysRestart),
                                                  GetVmNumber(bestEffort),
                                                  GetVmNumber(doNotRestart));
            }
            else
            {
                labelSummary.Text = String.Format(Messages.HAWIZ_SUMMARY,
                                                  HeartbeatSrName.Ellipsise(50),
                                                  Ntol,
                                                  GetVmNumber(alwaysRestartHighPriority),
                                                  GetVmNumber(alwaysRestart),
                                                  GetVmNumber(bestEffort),
                                                  GetVmNumber(doNotRestart));
            }

            // If the user hasn't protected any VMs, show a warning.
            labelNoVmsProtected.Visible = (bestEffort + alwaysRestart + alwaysRestartHighPriority == 0) && doNotRestart > 0;
            labelNoHaGuaranteed.Visible = Ntol == 0;
            pictureBox1.Visible         = labelNoVmsProtected.Visible || labelNoHaGuaranteed.Visible;
        }
Пример #2
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            labelSr.Text           = HeartbeatSrName.Ellipsise(50);
            labelNtol.Text         = Ntol.ToString();
            labelRestart.Text      = GetVmNumber(AlwaysRestart);
            labelBestEffort.Text   = GetVmNumber(BestEffort);
            labelDoNotRestart.Text = GetVmNumber(DoNotRestart);

            // If the user hasn't protected any VMs, show a warning.
            labelNoVmsProtected.Visible = (BestEffort + AlwaysRestart + AlwaysRestartHighPriority == 0) && DoNotRestart > 0;
            labelNoHaGuaranteed.Visible = Ntol == 0;
            pictureBox1.Visible         = labelNoVmsProtected.Visible || labelNoHaGuaranteed.Visible;
        }