Example #1
0
            private void RefreshRow()
            {
                _name.Value   = _policy.Name;
                _numVMs.Value = _policy.VMs.FindAll(vm => _policy.Connection.Resolve(vm).is_a_real_vm).Count;
                _status.Value = _policy.enabled ? Messages.ENABLED : Messages.DISABLED;
                if (_policy.is_running)
                {
                    _status.Value = Messages.RUNNING_SNAPSHOTS;
                }
                _lastResult.Value = _policy.LastResult;
                if (_policy.LastResult == Messages.FAILED)
                {
                    _lastResult.Image = Properties.Resources._075_WarningRound_h32bit_16;
                }
                else if (_policy.LastResult == Messages.NOT_YET_RUN)
                {
                    _lastResult.Image = null;
                }
                else
                {
                    _lastResult.Image = Properties.Resources._075_TickRound_h32bit_16;
                }

                DateTime?nextRunTime = GetVMPPDateTime(() => _policy.GetNextRunTime());

                _nextRunTime.Value = nextRunTime.HasValue
                                         ? HelpersGUI.DateTimeToString(nextRunTime.Value, Messages.DATEFORMAT_DMY_HM,
                                                                       true)
                                         : Messages.VMSS_HOST_NOT_LIVE;
            }
Example #2
0
        private void PopulateTab()
        {
            try
            {
                updating = true;

                if (_policyCopy == null || !_serverTimeInfo.HasValue)
                {
                    return;
                }

                var nextRunOnServer = _policyCopy.GetNextRunTime(_serverTimeInfo.Value.ServerLocalTime);
                if (!nextRunOnServer.HasValue)
                {
                    return;
                }

                var nextRunOnClient = HelpersGUI.RoundToNearestQuarter(nextRunOnServer.Value + _serverTimeInfo.Value.ServerClientTimeZoneDiff);

                switch (_policyCopy.frequency)
                {
                case vmss_frequency.hourly:
                    SetHourlyMinutes(nextRunOnClient.Minute);
                    radioButtonHourly.Checked = true;
                    break;

                case vmss_frequency.daily:
                    dateTimePickerDaily.Value = new DateTime(1970, 1, 1, nextRunOnClient.Hour, nextRunOnClient.Minute, 0);
                    radioButtonDaily.Checked  = true;
                    break;

                case vmss_frequency.weekly:
                    dateTimePickerWeekly.Value      = new DateTime(1970, 1, 1, nextRunOnClient.Hour, nextRunOnClient.Minute, 0);
                    daysWeekCheckboxes.SelectedDays = VMSS.BackUpScheduleDays(_policyCopy.schedule);
                    radioButtonWeekly.Checked       = true;
                    break;
                }

                numericUpDownRetention.Value = _policyCopy.retained_snapshots;
            }
            finally
            {
                updating = false;
                RecalculateSchedule();
            }
        }
            private void RefreshRow()
            {
                PolicyName    = _policy.Name();
                PolicyVmCount = _policy.VMs.FindAll(vm => _policy.Connection.Resolve(vm).is_a_real_vm()).Count;
                PolicyStatus  = _policy.enabled ? Messages.ENABLED : Messages.DISABLED;

                if (_serverLocalTime.HasValue)
                {
                    PolicyNextRunTime = _policy.GetNextRunTime(_serverLocalTime.Value);
                }
                else
                {
                    PolicyNextRunTime = null;
                }

                if (_alertMessages.Count > 0)
                {
                    if (_alertMessages[0].priority == PolicyAlert.INFO_PRIORITY)
                    {
                        PolicyLastResult      = Messages.VMSS_SUCCEEDED;
                        PolicyLastResultImage = Resources._075_TickRound_h32bit_16;
                    }
                    else
                    {
                        PolicyLastResult      = Messages.FAILED;
                        PolicyLastResultImage = Resources._075_WarningRound_h32bit_16;
                    }
                }
                else
                {
                    PolicyLastResult      = Messages.NOT_YET_RUN;
                    PolicyLastResultImage = null;
                }

                _name.Value        = PolicyName;
                _numVMs.Value      = PolicyVmCount;
                _status.Value      = PolicyStatus;
                _lastResult.Value  = PolicyLastResult;
                _lastResult.Image  = PolicyLastResultImage;
                _nextRunTime.Value = PolicyNextRunTime.HasValue
                    ? HelpersGUI.DateTimeToString(PolicyNextRunTime.Value, Messages.DATEFORMAT_DMY_HM, true)
                    : Messages.VMSS_HOST_NOT_LIVE;
            }