Exemplo n.º 1
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            HelpersGUI.PerformIQNCheck();

            if (direction == PageLoadedDirection.Forward)
            {
                textBoxIscsiHost.Focus();
                ResetAll();
            }
        }
Exemplo n.º 2
0
 private void RetrieveConfiguration()
 {
     // only get the config if there are no other pending wlb actions
     if (null == HelpersGUI.FindActiveWLBAction(_pool.Connection))
     {
         RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
         action.Completed += this.action_Completed;
         action.RunAsync();
     }
 }
Exemplo n.º 3
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.º 4
0
        private Dictionary <int, string> BuildDays()
        {
            Dictionary <int, string> days = new Dictionary <int, string>();

            foreach (var dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
            {
                days.Add((int)dayOfWeek, HelpersGUI.DayOfWeekToString((DayOfWeek)dayOfWeek, true));
            }
            return(days);
        }
 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.º 6
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            HelpersGUI.PerformIQNCheck();

            if (direction == PageLoadedDirection.Forward)
            {
                HelpersGUI.FocusFirstControl(Controls);
            }
        }
Exemplo n.º 7
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));
        }
            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.º 9
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.º 10
0
        public void ShowLocalValidationMessages()
        {
            decimal val;

            if (decimal.TryParse(nudAlertInterval.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out val) &&
                val % 5 != 0)
            {
                HelpersGUI.ShowBalloonMessage(nudAlertInterval,
                                              m_invalidParamToolTip, Messages.PERFORM_ALERT_EDIT_INTERVAL_WRONG_MULTIPLE);
            }
        }
Exemplo n.º 11
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.º 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);
        }
Exemplo n.º 13
0
 public override void PageLoaded(PageLoadedDirection direction)
 {
     base.PageLoaded(direction);
     if (direction == PageLoadedDirection.Forward)
     {
         HelpersGUI.FocusFirstControl(base.Controls);
         this.InitStorageGridList();
         this.SettingValue();
         this.InitNetworkListBox();
         this.InitCredentials();
     }
 }
Exemplo n.º 14
0
        public void ShowLocalValidationMessages()
        {
            double v;

            if (!(double.TryParse(ShadowMultiplierTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out v) &&
                  v > 0.1))
            {
                HelpersGUI.ShowBalloonMessage(ShadowMultiplierTextBox,
                                              Messages.SHADOW_MEMORY_MULTIPLIER_VALUE,
                                              m_invalidParamToolTip);
            }
        }
Exemplo n.º 15
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.º 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
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (newPoolDialog == null || newPoolDialog.IsDisposed)
     {
         newPoolDialog = new NewPoolDialog(selection.AsXenObjects <Host>());
         newPoolDialog.Show(Program.MainWindow);
     }
     else
     {
         HelpersGUI.BringFormToFront(newPoolDialog);
     }
 }
Exemplo n.º 18
0
        private void updateList()
        {
            PIFRow selected = null;

            if (dataGridView1.SelectedRows.Count > 0)
            {
                selected = dataGridView1.SelectedRows[0] as PIFRow;
            }

            try
            {
                dataGridView1.SuspendLayout();
                dataGridView1.Rows.Clear();

                if (host != null)
                {
                    foreach (PIF PIF in host.Connection.ResolveAll(host.PIFs))
                    {
                        if (!PIF.IsPhysical())
                        {
                            continue;
                        }

                        RegisterPIFEventHandlers(PIF);

                        PIFRow p = new PIFRow(PIF);
                        dataGridView1.Rows.Add(p);
                        if (selected != null && p.Pif == selected.Pif)
                        {
                            p.Selected = true;
                        }
                    }

                    //show the FCoE column for Dundee or higher hosts only
                    ColumnFCoECapable.Visible = Helpers.DundeeOrGreater(host);

                    //show the SR-IOV column for Kolkata or higher hosts only
                    ColumnSriovCapable.Visible = Helpers.KolkataOrGreater(host);

                    HelpersGUI.ResizeGridViewColumnToHeader(ColumnDeviceName);
                    HelpersGUI.ResizeGridViewColumnToHeader(ColumnSriovCapable);

                    if (dataGridView1.SortedColumn != null)
                    {
                        dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending);
                    }
                }
            }
            finally
            {
                dataGridView1.ResumeLayout();
            }
        }
Exemplo n.º 19
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.º 20
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.º 21
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.º 22
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.º 23
0
        public void ShowLocalValidationMessages()
        {
            if (!this.ValidToSave)
            {
                HelpersGUI.ShowBalloonMessage(textBoxSMTPServer, Messages.INVALID_PARAMETER, InvalidParamToolTip);
            }
            //BL: Disable it for now, will enable it after adding the port to WLB side

            /*
             * else if (!PerfmonAlertOptionsPage.IsValidPort(TextBoxSMTPServerPort.Text))
             * {
             *  Dialogs.EditVIFDialog.ShowBalloonMessage(TextBoxSMTPServerPort, Messages.INVALID_PARAMETER, InvalidParamToolTip);
             * }
             */
        }
Exemplo n.º 24
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.º 25
0
 protected override bool CanExecute(VM vm)
 {
     if (vm != null && !vm.is_a_template && !vm.Locked)
     {
         if (vm.power_state == vm_power_state.Running && HelpersGUI.HasRunningTasks(vm))
         {
             return(true);
         }
         else
         {
             return(vm.allowed_operations != null && vm.allowed_operations.Contains(vm_operations.hard_reboot) && EnabledTargetExists(vm.Home(), vm.Connection));
         }
     }
     return(false);
 }
Exemplo n.º 26
0
 public void ShowLocalValidationMessages()
 {
     if (!IsValidEmail(EmailAddressTextBox.Text))
     {
         HelpersGUI.ShowBalloonMessage(EmailAddressTextBox, Messages.INVALID_PARAMETER, InvalidParamToolTip);
     }
     else if (!IsValidSmtpAddress())
     {
         HelpersGUI.ShowBalloonMessage(SmtpServerAddrTextBox, Messages.INVALID_PARAMETER, InvalidParamToolTip);
     }
     else if (!Util.IsValidPort(SmtpServerPortTextBox.Text))
     {
         HelpersGUI.ShowBalloonMessage(SmtpServerPortTextBox, Messages.INVALID_PARAMETER, InvalidParamToolTip);
     }
 }
Exemplo n.º 27
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.º 28
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.º 29
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.º 30
0
        /// <summary>
        /// Apply optimization to a pool
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void ButtonApply_Click(object sender, EventArgs e)
        {
            if (this._pool == null)
            {
                return;
            }

            applyButton.Enabled = false;

            action = HelpersGUI.FindActiveOptAction(_xenObject.Connection);
            if ((action != null && action.GetType() != typeof(WlbOptimizePoolAction)) || action == null)
            {
                new WlbOptimizePoolAction(_pool, _vmOptList, _optId).RunAsync();
                Program.MainWindow.UpdateToolbars();
            }
        }