Exemplo n.º 1
0
        /// <summary>
        /// Shows the license summary dialog to the user as their license has expired.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="now"></param>
        /// <param name="expiryDate">Should be expressed in local time.</param>
        private void showLicenseSummaryExpired(Host host, DateTime now, DateTime expiryDate, bool createAlert, bool popupLicenseMgr)
        {
            Program.AssertOnEventThread();

            log.InfoFormat("Server {0} has expired ({1}). Show License Summary if needed",
                           host.Name(),
                           HelpersGUI.DateTimeToString(expiryDate, Messages.DATEFORMAT_DMY_HMS, true));

            if (createAlert)
            {
                var alert = new LicenseAlert(host.Name(), now, expiryDate)
                {
                    LicenseManagerLauncher = licenseManagerLauncher
                };
                Alert.AddAlert(alert);
            }

            if (!popupLicenseMgr)
            {
                return;
            }

            if (Program.RunInAutomatedTestMode)
            {
                log.Debug("In automated test mode: quashing license expiry warning");
            }
            else
            {
                licenseManagerLauncher.LaunchIfRequired(true, ConnectionsManager.XenConnections);
            }
        }
Exemplo n.º 2
0
        private DataGridViewRow NewUpdateRow(Alert alert)
        {
            var expanderCell = new DataGridViewImageCell();
            var appliesCell  = new DataGridViewTextBoxCell();
            var detailCell   = new DataGridViewTextBoxCell();
            var dateCell     = new DataGridViewTextBoxCell();

            var actionItems = GetAlertActionItems(alert);
            var actionCell  = new DataGridViewDropDownSplitButtonCell(actionItems.ToArray());
            var newRow      = new DataGridViewRow {
                Tag = alert, MinimumHeight = DataGridViewDropDownSplitButtonCell.MIN_ROW_HEIGHT
            };

            // Set the detail cell content and expanding arrow
            if (expandedState.ContainsKey(alert.uuid))
            {
                // show the expanded arrow and the body detail
                expanderCell.Value = Properties.Resources.expanded_triangle;
                detailCell.Value   = String.Format("{0}\n\n{1}", alert.Title, alert.Description);
            }
            else
            {
                // show the expand arrow and just the title
                expanderCell.Value = Properties.Resources.contracted_triangle;
                detailCell.Value   = alert.Title;
            }

            appliesCell.Value = alert.AppliesTo;
            dateCell.Value    = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY, true);
            newRow.Cells.AddRange(expanderCell, detailCell, appliesCell, dateCell, actionCell);

            return(newRow);
        }
Exemplo n.º 3
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;
            }
Exemplo n.º 4
0
        protected virtual void OnPaintInternal(ItemPaintArgs itemPaintArgs, Font localFont, Brush localForeBrush)
        {
            if (data == null)
            {
                return;
            }

            string output = (data is DateTime ? HelpersGUI.DateTimeToString((DateTime)data, Messages.DATEFORMAT_DMY_HM, true) : data.ToString());  // exception for DateTime: CA-46983

            // Replace either form of line ending with a space
            output = output.Replace("\n", " ").Replace("\r", "");
            Point  loc  = new Point();
            string text = Ellipsise(itemPaintArgs.Graphics, output, itemPaintArgs.Rectangle, localFont, out loc);

            if (!string.IsNullOrEmpty(text))
            {
                // Change text and background colour for selected rows
                bool selected = (respondToSelect && (itemPaintArgs.State & ItemState.Selected) > 0);
                if (selected)
                {
                    Size      textSize = Drawing.MeasureText(text, localFont);
                    Rectangle textRect;
                    textRect = new Rectangle(loc, textSize);
                    itemPaintArgs.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), textRect);
                    localForeBrush = new SolidBrush(SystemColors.HighlightText);
                }

                itemPaintArgs.Graphics.DrawString(text, localFont, localForeBrush, loc);
            }
        }
        public override StringBuilder BuildSummary()
        {
            StringBuilder sb = base.BuildSummary();

            if (Helpers.ClearwaterOrGreater(Row.XenObject.Connection) && Row.CurrentLicenseState == LicenseStatus.HostState.Free)
            {
                return(sb);
            }

            sb.AppendLine(Messages.LICENSE_MANAGER_SUMMARY_LICENSE_EXPIRES);

            if (Row.LicenseExpires.HasValue)
            {
                if (LicenseStatus.IsInfinite(Row.LicenseExpiresIn))
                {
                    sb.AppendLine(Messages.NEVER);
                }
                else
                {
                    string date = HelpersGUI.DateTimeToString(Row.LicenseExpires.Value, Messages.DATEFORMAT_DMY_LONG, true);
                    sb.AppendLine(date);
                }
            }
            else
            {
                sb.AppendLine(Messages.GENERAL_UNKNOWN);
            }

            return(sb.AppendLine());
        }
Exemplo n.º 6
0
            public IAcceptGroups Add(Grouping grouping, Object group, int indent)
            {
                if (group == null)
                {
                    return(null);
                }

                VirtualTreeNode node;

                if (group is Pool)
                {
                    node = AddPoolNode((Pool)group);
                }
                else if (group is Host)
                {
                    node = AddHostNode((Host)group);
                }
                else if (group is VM)
                {
                    node = AddVMNode((VM)group);
                }
                else if (group is DockerContainer)
                {
                    node = AddDockerContainerNode((DockerContainer)group);
                }
                else if (group is VM_appliance)
                {
                    node = AddVmApplianceNode((VM_appliance)group);
                }
                else if (group is SR)
                {
                    node = AddSRNode((SR)group);
                }
                else if (group is XenAPI.Network)
                {
                    node = AddNetworkNode((XenAPI.Network)group);
                }
                else if (group is VDI)
                {
                    node = AddVDINode((VDI)group);
                }
                else if (group is Folder)
                {
                    node = AddFolderNode((Folder)group);
                }
                else
                {
                    node = AddNode(grouping.GetGroupName(group), grouping.GetGroupIcon(group),
                                   false, new GroupingTag(grouping, GetGroupingTagFromNode(_parent), group));

                    if (group is DateTime)
                    {
                        Program.BeginInvoke(Program.MainWindow, () => { node.Text = HelpersGUI.DateTimeToString((DateTime)group, Messages.DATEFORMAT_DMY_HMS, true); }); // annoying: has to be on the event thread because of CA-46983
                    }
                }

                return(new MainWindowTreeNodeGroupAcceptor(_highlightedDragTarget, _treeViewForeColor, _treeViewBackColor, node));
            }
Exemplo n.º 7
0
        public string GetString(long value)
        {
            DateTime dt     = new DateTime(value - FIVE_SECONDS_TICKS);
            string   format = Resolution > -ONE_HOUR.Ticks
                                ? Messages.DATEFORMAT_HMS
                                : Messages.DATEFORMAT_DMY;

            return(HelpersGUI.DateTimeToString(dt, format, true));
        }
Exemplo n.º 8
0
        private void UpdateList(string xmlResult)
        {
            // Parse the XML result
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.LoadXml(xmlResult);

                string   pid     = "";
                string   command = "";
                string   cpuTime = "";
                string[] row     = { "", "", "" };

                listView1.SuspendLayout();
                listView1.Items.Clear();
                XmlNodeList processList = xmlDoc.GetElementsByTagName("Process");
                foreach (XmlNode process in processList)
                {
                    if (process.HasChildNodes)
                    {
                        foreach (XmlNode child in process.ChildNodes)
                        {
                            XmlNode v = child.FirstChild;
                            if (child.Name.Equals("PID"))
                            {
                                pid = v.Value;
                            }
                            else if (child.Name.Equals("CMD"))
                            {
                                command = v.Value;
                            }
                            else if (child.Name.Equals("TIME"))
                            {
                                cpuTime = v.Value;
                            }
                        }

                        row[0] = pid;
                        row[1] = command;
                        row[2] = cpuTime;
                    }
                    listView1.Items.Add(new ListViewItem(row));
                }
                labelRefresh.Text = string.Format(Messages.LAST_REFRESH_SUCCESS,
                                                  HelpersGUI.DateTimeToString(DateTime.Now, Messages.DATEFORMAT_HMS, true));
            }
            catch (Exception)
            {
                ShowInvalidInfo();
            }
            finally
            {
                listView1.ResumeLayout();
            }
        }
Exemplo n.º 9
0
 public string GetScheduleDescription(CallHomeSettings callHomeSettings)
 {
     {
         var time = new DateTime(1900, 1, 1, callHomeSettings.TimeOfDay, 0, 0);
         return(callHomeSettings.Status == CallHomeStatus.Enabled
             ? string.Format(Messages.CALLHOME_SCHEDULE_DESCRIPTION, callHomeSettings.IntervalInWeeks,
                             callHomeSettings.DayOfWeek, HelpersGUI.DateTimeToString(time, Messages.DATEFORMAT_HM, true))
             : string.Empty);
     }
 }
Exemplo n.º 10
0
        public string GetRelativeString(long value, DateTime serverTime)
        {
            DateTime dt     = new DateTime(value);
            TimeSpan diff   = serverTime - new DateTime(Max);
            string   format = diff < TWO_DAYS
                                ? Messages.DATEFORMAT_HM
                                : Messages.DATEFORMAT_DM;

            return(HelpersGUI.DateTimeToString(dt, format, true));
        }
Exemplo n.º 11
0
 public string GetScheduleDescription(HealthCheckSettings healthCheckSettings)
 {
     {
         var time = new DateTime(1900, 1, 1, healthCheckSettings.TimeOfDay, 0, 0);
         return(healthCheckSettings.Status == HealthCheckStatus.Enabled
             ? string.Format(Messages.HEALTHCHECK_SCHEDULE_DESCRIPTION, healthCheckSettings.IntervalInWeeks,
                             healthCheckSettings.DayOfWeek, HelpersGUI.DateTimeToString(time, Messages.DATEFORMAT_HM, true))
             : string.Empty);
     }
 }
Exemplo n.º 12
0
        private string GetEolDate()
        {
            string date = string.Empty;

            Program.Invoke(Program.MainWindow, () =>
            {
                date = HelpersGUI.DateTimeToString(Version.EolDate.ToLocalTime(), Messages.DATEFORMAT_DMY, true);
            });

            return(date);
        }
            public PatchGridViewRow(XenServerPatchAlert alert)
            {
                _alert = alert;
                Cells.AddRange(_nameCell, _descriptionCell, _dateCell, _webPageCell);

                _nameCell.Value        = String.Format(alert.Name);
                _descriptionCell.Value = String.Format(alert.Description);
                _dateCell.Value        = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY,
                                                                     true);
                _webPageCell.Value = Messages.PATCHING_WIZARD_WEBPAGE_CELL;
            }
Exemplo n.º 14
0
        /// <summary>
        /// Rebuilds the panel contents
        /// </summary>
        public void BuildPanel()
        {
            // Subscription section
            if (_subscription != null)
            {
                // General
                pdSectionGeneral.ClearData();
                pdSectionGeneral.AddEntry(Messages.NAME, _subscription.Description);
                pdSectionGeneral.AddEntry(Messages.WLB_SUBSCRIPTION_EDITED_ON, _subscription.LastTouched == DateTime.MinValue ? String.Empty : HelpersGUI.DateTimeToString(_subscription.LastTouched.ToLocalTime(), Messages.DATEFORMAT_DMY_LONG, true));
                pdSectionGeneral.AddEntry(Messages.WLB_SUBSCRIPTION_EDITED_BY, _subscription.LastTouchedBy);
                pdSectionGeneral.Expand();

                // Report Parameters
                pdSectionParameters.ClearData();
                pdSectionParameters.AddEntry(Messages.WLB_SUBSCRIPTION_DATARANGE, GetSubscriptionRange());
                //pdSectionParameters.Expand();

                // Delivery Options
                pdSectionDelivery.ClearData();
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_TO, _subscription.EmailTo);
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_CC, _subscription.EmailCc);
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_BCC, _subscription.EmailBcc);
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_REPLYTO, _subscription.EmailReplyTo);
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_SUBJECT, _subscription.EmailSubject);
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_FORMAT, Enum.GetName(typeof(WlbReportSubscription.WlbReportRenderFormat), _subscription.ReportRenderFormat));
                pdSectionDelivery.AddEntry(Messages.WLB_SUBSCRIPTION_COMMENT, _subscription.EmailComment);
                //pdSectionDelivery.Expand();

                // Schedule Options
                pdSectionSchedule.ClearData();

                DateTime localExecuteTime;
                WlbScheduledTask.WlbTaskDaysOfWeek localDaysOfWeek;
                WlbScheduledTask.GetLocalTaskTimes(this._subscription.DaysOfWeek, this._subscription.ExecuteTimeOfDay, out localDaysOfWeek, out localExecuteTime);
                if (_subscription.DaysOfWeek == WlbScheduledTask.WlbTaskDaysOfWeek.All)
                {
                    pdSectionSchedule.AddEntry(Messages.WLB_SUBSCRIPTION_DELIVERON, Messages.WLB_REPORT_EVERYDAY);
                }
                else
                {
                    pdSectionSchedule.AddEntry(Messages.WLB_SUBSCRIPTION_DELIVERON, WlbScheduledTask.DaysOfWeekL10N(localDaysOfWeek));
                }

                pdSectionSchedule.AddEntry(Messages.WLB_SUBSCRIPTION_RUNAT, HelpersGUI.DateTimeToString(localExecuteTime, Messages.DATEFORMAT_HMS, true));
                pdSectionSchedule.AddEntry(Messages.WLB_SUBSCRIPTION_STARTING, HelpersGUI.DateTimeToString(_subscription.EnableDate.ToLocalTime(), Messages.DATEFORMAT_DMY_LONG, true));
                pdSectionSchedule.AddEntry(Messages.WLB_SUBSCRIPTION_ENDING, (_subscription.DisableDate == DateTime.MinValue ? Messages.WLB_REPORT_NEVER : HelpersGUI.DateTimeToString(_subscription.DisableDate.ToLocalTime(), Messages.DATEFORMAT_DMY_LONG, true)));
                //pdSectionSchedule.Expand();

                // History
                pdSectionHistory.ClearData();
                pdSectionHistory.AddEntry(Messages.WLB_SUBSCRIPTION_LASTSENT, (_subscription.LastRun == DateTime.MinValue ? Messages.WLB_REPORT_NEVER : String.Format(Messages.WLB_SUBSCRIPTION_LASTSENT_TIME, HelpersGUI.DateTimeToString(_subscription.LastRun.ToLocalTime(), Messages.DATEFORMAT_DMY_LONG, true), HelpersGUI.DateTimeToString(_subscription.LastRun.ToLocalTime(), Messages.DATEFORMAT_HM, true))));
                //pdSectionHistory.Expand();
            }
        }
Exemplo n.º 15
0
        private SortedDictionary <int, string> BuildHours()
        {
            SortedDictionary <int, string> hours = new SortedDictionary <int, string>();

            for (int hour = 0; hour <= 23; hour++)
            {
                DateTime time = new DateTime(1900, 1, 1, hour, 0, 0);
                hours.Add(hour, HelpersGUI.DateTimeToString(time, Messages.DATEFORMAT_HM, true));
            }
            return(hours);
        }
Exemplo n.º 16
0
 public string GetLastUploadDescription(HealthCheckSettings healthCheckSettings)
 {
     if (!string.IsNullOrEmpty(healthCheckSettings.LastSuccessfulUpload))
     {
         DateTime lastSuccessfulUpload;
         if (HealthCheckSettings.TryParseStringToDateTime(healthCheckSettings.LastSuccessfulUpload, out lastSuccessfulUpload))
         {
             return(HelpersGUI.DateTimeToString(lastSuccessfulUpload.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true));
         }
     }
     return(string.Empty);
 }
Exemplo n.º 17
0
        /// <summary>
        /// Format the value of a custom field for a XenObject for display to the user (localised if necessary).
        /// </summary>
        public override string ToString()
        {
            // Must be run on the event thread, otherwise dates won't be formatted correctly (CA-46983).
            Program.AssertOnEventThread();
            object value = CustomFieldsManager.GetCustomFieldValue(o, customFieldDefinition);

            return((value == null)
                       ? ""
                       : (customFieldDefinition.Type == CustomFieldDefinition.Types.Date)
                             ? HelpersGUI.DateTimeToString((DateTime)value, Messages.DATEFORMAT_DMY_HM, true)
                             : value.ToString());
        }
Exemplo n.º 18
0
        private string DateConverter(string dateString)
        {
            string date = string.Empty;

            if (!Util.TryParseIso8601DateTime(dateString, out DateTime result))
            {
                return(dateString);
            }

            Program.Invoke(this, () => { date = HelpersGUI.DateTimeToString(result.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true); });

            return(date);
        }
Exemplo n.º 19
0
        private void RefreshTime(DateTime?nextRunOnServer = null, DateTime?nextRunOnClient = null)
        {
            var localRun = nextRunOnClient.HasValue
                ? HelpersGUI.DateTimeToString(nextRunOnClient.Value, Messages.DATEFORMAT_WDMY_HM_LONG, true)
                : Messages.UNKNOWN;

            var serverRun = nextRunOnServer.HasValue
                ? HelpersGUI.DateTimeToString(nextRunOnServer.Value, Messages.DATEFORMAT_WDMY_HM_LONG, true)
                : Messages.UNKNOWN;

            labelClientNextRun.Text = string.Format(Messages.VMSS_NEXT_CLIENT_LOCAL_RUN, localRun);
            labelServerNextRun.Text = string.Format(Messages.VMSS_NEXT_SERVER_LOCAL_RUN, serverRun);
        }
Exemplo n.º 20
0
            public void RefreshRow(Conversion conversion)
            {
                Conversion             = conversion;
                cellSourceVm.Value     = conversion.Configuration.SourceVmName;
                cellsourceServer.Value = conversion.Configuration.SourceServer.Hostname;

                cellStartTime.Value = HelpersGUI.DateTimeToString(conversion.StartTime.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true);

                cellFinishTime.Value = conversion.CompletedTime >= conversion.StartTime
                    ? HelpersGUI.DateTimeToString(conversion.CompletedTime.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true)
                    : Messages.HYPHEN;

                cellStatus.Value = Images.GetImageFor(conversion);
            }
Exemplo n.º 21
0
            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;

                //the policy is in server's local time zone
                if (serverTimeInfo.HasValue)
                {
                    NextRunLocalToServer = Policy.GetNextRunTime(serverTimeInfo.Value.ServerLocalTime);
                }

                if (serverTimeInfo.HasValue && NextRunLocalToServer.HasValue)
                {
                    NextRunLocalToClient = HelpersGUI.RoundToNearestQuarter(NextRunLocalToServer.Value + serverTimeInfo.Value.ServerClientTimeZoneDiff);
                }

                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;

                _nextRunClientLocal.Value = NextRunLocalToClient.HasValue
                    ? HelpersGUI.DateTimeToString(NextRunLocalToClient.Value, Messages.DATEFORMAT_DMY_HM, true)
                    : Messages.VMSS_HOST_NOT_LIVE;

                _nextRunServerLocal.Value = NextRunLocalToServer.HasValue
                    ? HelpersGUI.DateTimeToString(NextRunLocalToServer.Value, Messages.DATEFORMAT_DMY_HM, true)
                    : Messages.VMSS_HOST_NOT_LIVE;
            }
Exemplo n.º 22
0
 public void UpdateUploadRequestDescription(HealthCheckSettings healthCheckSettings)
 {
     {
         if (!healthCheckSettings.CanRequestNewUpload)
         {
             uploadRequestLinkLabel.Text = string.Format(Messages.HEALTHCHECK_ON_DEMAND_REQUESTED_AT,
                                                         HelpersGUI.DateTimeToString(healthCheckSettings.NewUploadRequestTime.ToLocalTime(),
                                                                                     Messages.DATEFORMAT_HM, true));
             uploadRequestLinkLabel.LinkArea = new LinkArea(0, 0);
             return;
         }
         uploadRequestLinkLabel.Text     = Messages.HEALTHCHECK_ON_DEMAND_REQUEST;
         uploadRequestLinkLabel.LinkArea = new LinkArea(0, uploadRequestLinkLabel.Text.Length);
     }
 }
Exemplo n.º 23
0
        private string GetExpiryDate()
        {
            string date = string.Empty;

            Program.Invoke(Program.MainWindow,
                           () =>
            {
                if (_certificateExpiryDate.HasValue)
                {
                    date = HelpersGUI.DateTimeToString(_certificateExpiryDate.Value.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true);
                }
            });

            return(date);
        }
Exemplo n.º 24
0
        void action_CompletedTimeServer(ActionBase sender)
        {
            GetServerTimeAction action = (GetServerTimeAction)sender;

            Program.Invoke(Program.MainWindow, () =>
            {
                string serverLocalTimeString = action.Result;
                if (serverLocalTimeString != "")
                {
                    DateTime serverLocalTime = DateTime.Parse(serverLocalTimeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
                    serverLocalTimeString    = HelpersGUI.DateTimeToString(serverLocalTime, Messages.DATEFORMAT_WDMY_HM_LONG, true);
                }
                labelServerTime.Text = string.Format(Messages.SERVER_TIME, serverLocalTimeString);
            });
        }
Exemplo n.º 25
0
        public ActionRow(ActionBase action)
        {
            AppliesTo            = action.AppliesTo;
            Action               = action;
            Image                = action.GetImage();
            TimeOccurred         = HelpersGUI.DateTimeToString(Action.Started, Messages.DATEFORMAT_DMY_HMS, true);
            CancelButtonClicked += CancelAction;
            setupRowDetails();

            if (!Action.IsCompleted)
            {
                Action.Changed   += Action_Changed;
                Action.Completed += Action_Completed;
            }
        }
Exemplo n.º 26
0
        public void UpdateAnalysisResult(HealthCheckSettings healthCheckSettings)
        {
            issuesLabel.Text = healthCheckSettings.StatusDescription;
            ReportAnalysisLinkLabel.Visible = healthCheckSettings.HasAnalysisResult;

            if (healthCheckSettings.HasAnalysisResult)
            {
                switch (healthCheckSettings.ReportAnalysisSeverity)
                {
                case DiagnosticAlertSeverity.Error:
                    issuesLabel.ForeColor = Color.Red;
                    break;

                case DiagnosticAlertSeverity.Warning:
                    issuesLabel.ForeColor = Color.OrangeRed;
                    break;

                default:
                    issuesLabel.ForeColor =
                        healthCheckSettings.ReportAnalysisIssuesDetected > 0 ? SystemColors.ControlText : Color.Green;
                    break;
                }
            }
            else
            {
                issuesLabel.ForeColor = SystemColors.ControlText;
            }

            refreshLinkLabel.Visible = healthCheckSettings.HasUpload && !healthCheckSettings.HasAnalysisResult;

            if (healthCheckSettings.HasOldAnalysisResult)
            {
                previousUploadPanel.Visible = healthCheckSettings.HasOldAnalysisResult;

                DateTime previousUpload;
                if (HealthCheckSettings.TryParseStringToDateTime(healthCheckSettings.ReportAnalysisUploadTime,
                                                                 out previousUpload))
                {
                    previousUploadDateLabel.Text = HelpersGUI.DateTimeToString(previousUpload.ToLocalTime(),
                                                                               Messages.DATEFORMAT_DMY_HM, true);
                }
            }
            else
            {
                previousUploadPanel.Visible = false;
            }
        }
Exemplo n.º 27
0
        public void Rebuild(string currentResult)
        {
            Program.AssertOnEventThread();
            RefreshTime.Text = string.Format(Messages.LAST_REFRESH_SUCCESS,
                                             HelpersGUI.DateTimeToString(DateTime.Now, Messages.DATEFORMAT_HMS, true));
            try
            {
                if (cachedResult == currentResult)
                {
                    return;
                }

                cachedResult = currentResult;
                DetailtreeView.Nodes.Clear();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(currentResult);

                IEnumerator firstEnum = doc.GetEnumerator();
                XmlNode     node;
                while (firstEnum.MoveNext())
                {
                    node = (XmlNode)firstEnum.Current;

                    if (node.NodeType != XmlNodeType.XmlDeclaration)
                    {
                        //we are on the root element now (docker_inspect)
                        //using the following enumerator to iterate through the children nodes and to build related sub-trees
                        //note that we are intentionally not adding the root node to the tree (UX decision)
                        var secondEnum = node.GetEnumerator();
                        while (secondEnum.MoveNext())
                        {
                            //recursively building the tree
                            TreeNode rootNode = new TreeNode();
                            CreateTree((XmlNode)secondEnum.Current, rootNode);

                            //adding the current sub-tree to the TreeView
                            DetailtreeView.Nodes.Add(rootNode);
                        }
                    }
                }
            }
            catch (Failure)
            {
                ShowInvalidInfo();
            }
        }
Exemplo n.º 28
0
            public void RefreshSelf()
            {
                statusCell.Value = Action.GetImage();

                if (Expanded)
                {
                    expanderCell.Value = Properties.Resources.expanded_triangle;
                    messageCell.Value  = Action.GetDetails();
                }
                else
                {
                    expanderCell.Value = Properties.Resources.contracted_triangle;
                    messageCell.Value  = Action.GetTitle();
                }
                locationCell.Value = Action.GetLocation();
                dateCell.Value     = HelpersGUI.DateTimeToString(Action.Started.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true);
            }
Exemplo n.º 29
0
            public void RefreshSelf()
            {
                var actionItems = new List <ToolStripItem>();

                if (!Action.IsCompleted && Action.CanCancel)
                {
                    actionItems.Add(cancelItem);
                }

                if (Action.IsCompleted)
                {
                    actionItems.Add(dismissItem);
                }

                var obj = Action.GetRelevantXenObject();

                if (obj != null)
                {
                    actionItems.Add(goToItem);
                }

                if (actionItems.Count > 0)
                {
                    actionItems.Add(separatorItem);
                }

                actionItems.Add(copyItem);

                actionCell.RefreshItems(actionItems.ToArray());

                statusCell.Value = Action.GetImage();

                if (Expanded)
                {
                    expanderCell.Value = Properties.Resources.expanded_triangle;
                    messageCell.Value  = Action.GetDetails();
                }
                else
                {
                    expanderCell.Value = Properties.Resources.contracted_triangle;
                    messageCell.Value  = Action.GetTitle();
                }
                locationCell.Value = Action.GetLocation();
                dateCell.Value     = HelpersGUI.DateTimeToString(Action.Started.ToLocalTime(), Messages.DATEFORMAT_DMY_HM, true);
            }
Exemplo n.º 30
0
            public PatchGridViewRow(Alert alert)
            {
                _alert           = alert;
                _nameCell        = new DataGridViewTextBoxCell();
                _descriptionCell = new DataGridViewTextBoxCell();
                _dateCell        = new DataGridViewTextBoxCell();
                _webPageCell     = new DataGridViewLinkCell();

                Cells.Add(_nameCell);
                Cells.Add(_descriptionCell);
                Cells.Add(_dateCell);
                Cells.Add(_webPageCell);

                _nameCell.Value        = String.Format(alert.Name);
                _descriptionCell.Value = String.Format(alert.Description);
                _dateCell.Value        = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY, true);
                _webPageCell.Value     = Messages.PATCHING_WIZARD_WEBPAGE_CELL;
            }