Beispiel #1
0
        private void cbxDisk_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxDisk.SelectedIndex != -1)
            {
                chartDisk.Series[0].Points.Clear();
                chartDisk.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;

                chartDisk.Series[0].Points.AddXY("Free Space(GB)", diskList[cbxDisk.SelectedIndex].FreeSpace);
                chartDisk.Series[0].Points.AddXY("Used Space(GB)", diskList[cbxDisk.SelectedIndex].UsedSpace);
                chartDisk.Series[0].IsValueShownAsLabel = true;

                //alter
                var diskAlter = DataCache.CmnDict.Where(s => s.DICTID == "3022" && cbxDisk.Text.Contains(s.REMARK.ToUpper())).Select(s => s.VALUE).FirstOrDefault();

                if (!string.IsNullOrEmpty(diskAlter))
                {
                    var percent = Convert.ToInt32(diskList[cbxDisk.SelectedIndex].FreeSpace * 100 / diskList[cbxDisk.SelectedIndex].TotalSize);

                    if (percent < int.Parse(diskAlter))
                    {
                        MsgBoxEx.Warn("Disk remaining space is less than alert value, please clean up");
                    }
                }
            }
        }
Beispiel #2
0
        private void frm_main_Load(object sender, EventArgs e)
        {
            timer1.Enabled        = true;
            cbxLang.SelectedIndex = 0;
            label4.Text           = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            pnlLeft.Enabled       = false;
            pnlLeft.Width         = 1;
            lblArrow.Image        = global::WR.Client.UI.Properties.Resources.pright;

            ShowForm("");

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    try
                    {
                        System.Threading.Thread.Sleep(60000); //20s

                        IsysService service = sysService.GetService();

                        var deviceArray = service.GetHeartBeatInterval().Select(s => s.REMARK).ToArray();

                        if (deviceArray.Length > 0)
                        {
                            var msg = string.Format("The {0} has stopped uploading, please check its status.", string.Join(",", deviceArray));

                            if (this.InvokeRequired)
                            {
                                this.BeginInvoke(new Action(() =>
                                {
                                    MsgBoxEx.Warn(msg);
                                }));
                            }
                            else
                            {
                                MsgBoxEx.Warn(msg);
                            }

                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            });
        }