コード例 #1
0
        /// <summary>
        /// Handler for button login click 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoginClick(object sender, System.EventArgs e)
        {
            Util.ShowWaitWindow();

            //create and start new user session to Monitis
            var userSession = new UserSession(tbxMonitisAPIKey.Text.Trim(), APIType.Live);
            ActionResult actionResult = userSession.Start();

            Util.CloseWaitWindow();
            if (actionResult.IsSuccessful)
            {
                MonitorsForm monitorsForm = new MonitorsForm(userSession, MdiParent);
                Close();
                monitorsForm.Show();
            }
            else
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (var error in actionResult.Errors)
                {
                    stringBuilder.AppendLine(error);
                }
                MessageBox.Show(stringBuilder.ToString(), "Error");
            }
        }
コード例 #2
0
        public MonitorsForm(UserSession userSession, Form mdiParent)
        {
            if (userSession == null)
            {
                throw new ArgumentNullException("userSession");
            }

            MdiParent = mdiParent;
            _userSession = userSession;
            InitializeComponent();
            CheckMonitorList();
        }
コード例 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="syncPeriod">Timespan period for sync data between Windows Azure and Monitis API</param>
        /// <param name="userSession">Current user session object</param>
        public Mediator(TimeSpan syncPeriod, UserSession userSession)
        {
            if (userSession == null)
            {
                throw new ArgumentNullException("userSession");
            }
            _syncPeriod = syncPeriod;
            _userSession = userSession;

            //TODO: need separate monitor for CPU and each counter
            _counterNameEventUpdateMap.Add(CounterNames.ProcessorTotalTime, InvokeCpuDataUpdated);
            _counterNameEventUpdateMap.Add(CounterNames.MemoryAvailableBytes, InvokeMemoryUpdated);
        }
コード例 #4
0
        /// <summary>
        /// Constructor form
        /// </summary>
        /// <param name="userSession"></param>
        /// <param name="mdiParent"></param>
        public MediatorForm(UserSession userSession, Form mdiParent)
        {
            InitializeComponent();
            lblStatus.Text = String.Empty;
            if (userSession == null)
            {
                throw new ArgumentNullException("userSession");
            }
            MdiParent = mdiParent;
            _userSession = userSession;

            chartControl.ChartAreas["CPUArea"].AxisY.Minimum = 0;
            chartControl.ChartAreas["CPUArea"].AxisY.Maximum = 100;
            btnStop.Enabled = false;
        }
コード例 #5
0
 public AzureTableServiceLogin(UserSession userSession, Form mdiParent)
 {
     MdiParent = mdiParent;
     _userSession = userSession;
     InitializeComponent();
 }