示例#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.is_enabled ? Messages.ENABLED : Messages.DISABLED;
                if (_policy.is_running)
                {
                    _status.Value = Messages.RUNNING_SNAPSHOTS;
                }
                if (this._policy.hasArchive)
                {
                    if (_policy.is_archiving)
                    {
                        _status.Value = Messages.RUNNING_ARCHIVE;
                    }
                }
                _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.VM_PROTECTION_POLICY_HOST_NOT_LIVE;
                if (this._policy.hasArchive)
                {
                    DateTime?nextArchiveRuntime = GetVMPPDateTime(() => _policy.GetNextArchiveRunTime());
                    _nextArchiveRuntime.Value = nextArchiveRuntime.HasValue
                                                    ? nextArchiveRuntime == DateTime.MinValue
                                                            ? Messages.NEVER
                                                            : HelpersGUI.DateTimeToString(nextArchiveRuntime.Value,
                                                                                          Messages.DATEFORMAT_DMY_HM, true)
                                                    : Messages.VM_PROTECTION_POLICY_HOST_NOT_LIVE;
                }
            }