Newer
Older
laserPTZ_CS / DialogLineEdit.cs
wangxitong on 11 Sep 1 KB first commit
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace laserPTZ
{
    public partial class DialogLineEdit : Form
    {
        string selectValue = "";
        string selectIP = "";
        public DialogLineEdit(string ip, string value, string name)
        {
            InitializeComponent();
            txt_name.Text = "";
            txt_oldName.Text = name;
            selectValue = value;
            selectIP = ip;
        }
        public static bool IsInteger(string s)
        {
            try
            {
                int var1 = Convert.ToInt32(s);
                return true;
            }
            catch
            {
                return false;
            }
        }
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_name.Text.Trim() == "")
                {
                    MessageBox.Show("请输入新巡航号");
                    return;
                }
                string query = "?deviceIp=" + selectIP + "&command=cruiseEdit&cruiseValue=" + selectValue + "&cruiseName=" + txt_name.Text;
                string result = Http.http("http://" + ConfigHelper.GetAppConfig("server").ToString().Trim() + "/HCNet/cruiseRoute" + query, "POST", null);
                if (result == "")
                {
                    MessageBox.Show("服务器异常");
                    return;
                }
                MessageBox.Show("修改成功");
                this.Close();
                CtrlRealTime.ctrlRealTime.getLineList();
            }
            catch { }
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}