コード例 #1
0
        private void btnSetNtp_Click(object sender, EventArgs e)
        {
            if (this.tbNtpServerip.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input the ip address of ntp server");
                return;
            }
            NtpSetting ntp = new NtpSetting();

            if (this.rbntptrue.Checked)
            {
                ntp.IsEnableNtp = true;
            }
            else
            {
                ntp.IsEnableNtp = false;
            }

            ntp.NtpServerIp = this.tbNtpServerip.Text.Trim();
            try
            {
                rdr.ParamSet("NtpSetting", ntp);
                MessageBox.Show("setting success");
            }
            catch
            {
                MessageBox.Show("operation failed");
                return;
            }
        }
コード例 #2
0
ファイル: Client.Site.cs プロジェクト: schwoi/UnifiClient
        /// <summary>
        /// set site NTP.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <param name="siteName">Name of the site.</param>
        /// <returns>returns <c>true</c> on success</returns>
        public async Task <BoolResponse> SetSiteNtpAsync(NtpSetting setting, string siteName = null)
        {
            //TODO: Create Test
            var path        = $"api/s/{(siteName ?? Site)}/set/setting/ntp";
            var oJsonObject = JObject.FromObject(setting);

            return(await ExecuteBoolCommandAsync(path, oJsonObject, "PUT"));
        }
コード例 #3
0
 private void btngetntp_Click(object sender, EventArgs e)
 {
     try
     {
         NtpSetting ntp = (NtpSetting)rdr.ParamGet("NtpSetting");
         if (ntp.IsEnableNtp)
         {
             this.rbntptrue.Checked = true;
         }
         else
         {
             this.rbisntpfalse.Checked = true;
         }
         this.tbNtpServerip.Text = ntp.NtpServerIp;
     }
     catch
     {
         MessageBox.Show("operation failed");
         return;
     }
 }