示例#1
0
        public MySqlView(MySql mysql, DataSource dataSource)
        {
            InitializeComponent();

            this.mysql      = mysql;
            this.dataSource = dataSource;

            builder = new DetailPageDataBuilder();
            builder.Build("监控名称", mysql.Description);
            builder.Build("主机", mysql.Host);
            builder.Build("端口", mysql.Port);
            builder.Build("用户", mysql.User);
            builder.Build("密码", "●●●●●●", mysql.Password);
            builder.Build("数据库", mysql.Database);
            builder.Build("延时", mysql.Delay + " ms");

            var noticeTargetTask = Common.GetNoticeTargetNamesAsync(dataSource, mysql.NoticeTarget);
            var statusTask       = Common.GetStatusAsync(delegate {
                return(dataSource.GetMySqlStatus());
            }, mysql.ID);

            builder.Build("通知人员", noticeTargetTask.Result);
            builder.Build("状态", statusTask.Result);
            builder.Build("访问源", dataSource.ListenServerItem.Host);
            ContentList.DataContext = builder.DataSource;
        }
        public ProcessView(Process process, DataSource dataSource)
        {
            InitializeComponent();

            this.process    = process;
            this.dataSource = dataSource;

            builder = new DetailPageDataBuilder();
            builder.Build("进程名称", process.ProcessName);


            var noticeTargetTask = Common.GetNoticeTargetNamesAsync(dataSource, process.NoticeTarget);
            var statusTask       = Common.GetStatusAsync(delegate {
                return(dataSource.GetProcessStatus());
            }, process.ID);

            builder.Build("通知人员", noticeTargetTask.Result);
            builder.Build("状态", statusTask.Result);
            ContentList.DataContext = builder.DataSource;
        }
        public HttpUrlView(HttpUrl httpUrl, DataSource dataSource)
        {
            this.dataSource = dataSource;
            this.httpUrl    = httpUrl;

            InitializeComponent();

            builder = new DetailPageDataBuilder();
            builder.Build("监控名称", httpUrl.Description);
            builder.Build("监控链接", httpUrl.Url);
            builder.Build("请求方法", httpUrl.Method);
            builder.Build("请求延时", httpUrl.Delay + " ms");

            var noticeTargetTask = Common.GetNoticeTargetNamesAsync(dataSource, httpUrl.NoticeTarget);
            var statusTask       = Common.GetStatusAsync(delegate {
                return(dataSource.GetUrlStatus());
            }, httpUrl.ID);

            builder.Build("通知人员", noticeTargetTask.Result);
            builder.Build("状态", statusTask.Result);
            builder.Build("访问源", dataSource.ListenServerItem.Host);
            ContentList.DataContext = builder.DataSource;
        }