Esempio n. 1
0
        public static LoadingView Instance(Form f)
        {
            if (instance == null)
            {
                instance = new LoadingView();
                instance.init(f);
            }

            return(instance);
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            LoadingView.Instance(this).show();

            this.listView1.Columns.Add("디바이스 이름", 200);
            //this.listView1.Columns.Add("UUID", 200);
            this.listView1.Columns.Add("User", 120);
            this.listView1.Columns.Add("상태", 200);

            this.listView2.Columns.Add("동영상 리스트", this.listView2.Width - 3);

            FileInfo protFile = new FileInfo(Common.SETTING_PATH);

            if (protFile.Exists)
            {
                string  settingStr = File.ReadAllText(Common.SETTING_PATH);
                JObject obj        = JObject.Parse(settingStr);

                Console.WriteLine("json : {0}", obj);

                JToken ftpToken  = obj.GetValue(Common.KEY_FTP_PATH);
                JToken ipToken   = obj.GetValue(Common.KEY_IP);
                JToken portToken = obj.GetValue(Common.KEY_PORT);

                bool isIP   = false;
                bool isPort = false;
                bool isFTP  = false;

                if (ipToken != null)
                {
                    this.ip          = ipToken.ToString(); //obj[Common.KEY_IP].ToString();
                    textBox3.Text    = this.ip;
                    textBox3.Enabled = false;
                    isIP             = true;
                }
                else
                {
                    //MessageBox.Show("IP 설정이 필요합니다.");
                    //return;
                    isIP = false;
                }

                if (portToken != null)
                {
                    this.port        = portToken.ToString();//obj[Common.KEY_PORT].ToString();
                    textBox2.Text    = this.port;
                    textBox2.Enabled = false;
                    isPort           = true;
                }
                else
                {
                    //MessageBox.Show("PORT 설정이 필요합니다.");
                    //return;
                    isPort = false;
                }

                if (ftpToken != null)
                {
                    Common.FTP_PATH  = ftpToken.ToString(); //obj[Common.KEY_FTP_PATH].ToString();
                    label4.Text      = Common.FTP_PATH;
                    button13.Enabled = false;
                    isFTP            = true;
                }
                else
                {
                    isFTP = false;
                    //MessageBox.Show("FTP 파일 저장경로 설정이 필요합니다.");
                }

                if (isIP && isPort)
                {
                    if (!openSocket())
                    {
                        removeIPPORT();
                        textBox2.Text    = "";
                        textBox2.Enabled = true;
                        textBox3.Text    = "";
                        textBox3.Enabled = true;
                        button6.Enabled  = true;
                    }
                    else
                    {
                        button6.Enabled = false;
                    }
                }

                if (isIP && isPort && isFTP)
                {
                }
                else
                {
                    string ipStr   = isIP == true ? "" : "IP ";
                    string portStr = isPort ? "" : "PORT ";
                    string ftpStr  = isFTP ? "" : "FTP ";

                    MessageBox.Show(ipStr + portStr + ftpStr + "설정이 필요합니다.");
                }
            }
            else
            {
                MessageBox.Show("기본 설정이 필요합니다.");
            }

            backgroundWorker1 = new BackgroundWorker();
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.DoWork             += new DoWorkEventHandler(this.worker_DoWork);


            panel1.AutoScroll = true;
        }