From 924bdf1c9fb74babf2438d5545db3594756625d1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 22 六月 2020 20:06:39 +0800
Subject: [PATCH] '完善信息'

---
 WindowsFormsApp1/Main.cs |  154 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 138 insertions(+), 16 deletions(-)

diff --git a/WindowsFormsApp1/Main.cs b/WindowsFormsApp1/Main.cs
index d11bb9d..7a9d2ea 100644
--- a/WindowsFormsApp1/Main.cs
+++ b/WindowsFormsApp1/Main.cs
@@ -38,6 +38,10 @@
         //鍒濆鍖栫毊鑲ら鑹�
         private void InitSkin()
         {
+            ButtonFactory.CreatePrimary(this.button10);
+            ButtonFactory.CreatePrimary(this.button30);
+            ButtonFactory.CreateDefault(this.button12);
+            ButtonFactory.CreateDefault(this.button9);
             //this.textBox
         }
         private void InitData()
@@ -78,10 +82,38 @@
                             SQLiteDataBaseUtil.getInstance().AddConfig(cf);
                         }
                 }
-
             });
             //鍒濆鍖栨ā鏉跨紪杈�
             setDocTemplateState(false);
+
+            //鍒濆鍖栭噰闆嗚缃�
+            CollectSettings timeSettings= CollectSettingUtil.GetCollectTime();
+            //閲囬泦鏃堕棿璁剧疆
+            if (timeSettings.Open) {
+                this.ucSwitch1.Checked = true;
+            }else
+                this.ucSwitch1.Checked = false;
+            this.numericUpDown1.Value = timeSettings.TimeSpan;
+            this.dateTimePicker1.Value = DateTime.Parse(timeSettings.StartTime);
+            this.dateTimePicker2.Value = DateTime.Parse(timeSettings.EndTime);
+
+            
+            UpDownBase up = (UpDownBase)this.numericUpDown1;
+            up.TextChanged += new EventHandler(this.numbericUpAndDown_TextChanged);
+
+        }
+
+        //璁剧疆鏀惰棌鏃堕棿
+        private void setCollectTimeSetting() {
+         
+            CollectSettings settings = new CollectSettings();
+            settings.TimeSpan =Convert.ToInt32( this.numericUpDown1.Value);
+            settings.TimeValid = this.checkBox3.Checked;
+            settings.Open = this.ucSwitch1.Checked;
+            settings.StartTime =TimeUtil.GetGeneralTime(this.dateTimePicker1.Value ,"HH:mm");
+            settings.EndTime = TimeUtil.GetGeneralTime(this.dateTimePicker2.Value, "HH:mm");
+
+            CollectSettingUtil.setCollectTime(settings);
         }
 
         //楠岃瘉鐧诲綍
@@ -240,11 +272,11 @@
             this.dataGridView1.Columns[2].Width = 70;
             this.dataGridView1.Columns[3].Width = 70;
             this.dataGridView1.Columns[4].Width = 75;
-            this.dataGridView1.Columns[5].Width = 70;
-            this.dataGridView1.Columns[6].Width = 55;
-            this.dataGridView1.Columns[7].Width = 65;
-            this.dataGridView1.Columns[8].Width = 75;
-            this.dataGridView1.Columns[9].Width = 75;
+            this.dataGridView1.Columns[5].Width = 75;
+            this.dataGridView1.Columns[6].Width = 100;
+            this.dataGridView1.Columns[7].Width = 100;
+            this.dataGridView1.Columns[8].Width = 65;
+            this.dataGridView1.Columns[9].Width = 40;
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
             dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Menu;
@@ -254,6 +286,7 @@
             dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
             dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
             this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
+
         }
 
 
@@ -296,16 +329,16 @@
         {
             if (!IsLogin())
                 return;
+            button5_Click_2(sender,e);
+        //    InputDialog input = new InputDialog("搴旂敤绛涢�夊懡鍚�", "搴旂敤绛涢�夋槸鑷姩鐢熸垚鏂囨浜戝彂鍗曞繀瑕佽缃�", new OnSuccess((String result)=> {
 
-            InputDialog input = new InputDialog("搴旂敤绛涢�夊懡鍚�", "搴旂敤绛涢�夋槸鑷姩鐢熸垚鏂囨浜戝彂鍗曞繀瑕佽缃�", new OnSuccess((String result)=> {
-
-                //TODO 鎻掑叆寮曞崟缁勫悎
-                FormUtil.ShowDialog(new YingDanSelect());
+            //TODO 鎻掑叆寮曞崟缁勫悎
+            //        FormUtil.ShowDialog(new YingDanSelect());
 
 
-            }));
+            //   }));
 
-            FormUtil.ShowDialog(input);
+            //    FormUtil.ShowDialog(input);
         }
 
 
@@ -348,14 +381,45 @@
         private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
         {
             int index= e.RowIndex;
-            if (index > -1&& this.infoList!=null)
+            if (index == -1)//澶撮儴鎺掑簭
             {
-                if (this.infoList.Count > index)
-                {
+                    clearSort(e.ColumnIndex);
+                    DataGridViewColumn sortColumn = this.dataGridView1.Columns[e.ColumnIndex];
+        
+                        if (sortColumn.SortMode == DataGridViewColumnSortMode.Programmatic)
+                        {
+                            if (sortColumn.HeaderCell.SortGlyphDirection == SortOrder.Descending)
+                            {
+                                sortColumn.HeaderCell.SortGlyphDirection = SortOrder.None;
+                            }
+                            else if (sortColumn.HeaderCell.SortGlyphDirection == SortOrder.Ascending)
+                            {
+                                sortColumn.HeaderCell.SortGlyphDirection = SortOrder.Descending;
+                            }
+                            else if (sortColumn.HeaderCell.SortGlyphDirection == SortOrder.None)
+                            {
+                                sortColumn.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
+                            }
+                            //鎺掑簭
 
+                            //TODO 鎺掑簭
+                            /
+
+                        }
+            }
+        }
+
+        //娓呯┖鎺掑簭
+        private void clearSort(int index) {
+            for(int i=0;i<this.dataGridView1.Columns.Count;i++){
+                DataGridViewColumn sortColumn = this.dataGridView1.Columns[i];
+                if (sortColumn.SortMode == DataGridViewColumnSortMode.Programmatic) {
+                    if(i!=index)
+                    sortColumn.HeaderCell.SortGlyphDirection = SortOrder.None;
                 }
             }
         }
+
         //鍏ㄩ��
         private void checkBox20_CheckedChanged(object sender, EventArgs e)
         {
@@ -779,6 +843,14 @@
         private void logTimer_Tick(object sender, EventArgs e)
         {
             ShowLog();
+            //鍒ゆ柇鏄惁鏈夋窐瀹濊处鍙峰け鏁�
+            if (TBAccountManager.IsHaveOffLine())
+            {
+                this.label38.Visible = true;
+            }
+            else {
+                this.label38.Visible = false;
+            }
         }
 
         private void Main_FormClosed(object sender, FormClosedEventArgs e)
@@ -795,7 +867,8 @@
 
         private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
         {
-            MessageBox.Show("鍙屽嚮");
+            if(e.RowIndex>-1)
+                MessageBox.Show("鍙屽嚮");
         }
 
         /**
@@ -989,6 +1062,8 @@
                 this.button9.Enabled = false;
                 this.button16.Enabled = true;
                 this.syncFaDanKu_checkBox.Enabled = true;
+                this.label5.Enabled = true;
+
                 this.textBox13.Text = "";
                 String txt = DocUtil.BuildDoc();
                 this.textBox13.Text = txt;
@@ -1006,12 +1081,59 @@
                 this.button9.Enabled = true;
                 this.button16.Enabled = false;
                 this.syncFaDanKu_checkBox.Enabled = false;
+                this.label5.Enabled = false;
                 //杞藉叆妯℃澘
                 initTemplateParams(false);
             }
         }
 
+        //娓呯┖鏂囨
+        private void label5_Click(object sender, EventArgs e)
+        {
+            DocUtil.Clear();
+            initTemplateParams(false);
+        }
+        //閲囬泦鏄惁寮�鍚�
+        private bool parseOpen = true;
+        //閲囬泦寮�鍏�
+        private void ucSwitch1_CheckedChanged(object sender, EventArgs e)
+        {
+            if (this.ucSwitch1.Checked)
+            {
+                Constant.parseSDLJOPen = true;
+            }
+            else {
+                Constant.parseSDLJOPen = false;
+            }
 
+            setCollectTimeSetting();
+        }
+
+        private void numbericUpAndDown_TextChanged(object sender, EventArgs e)
+        {
+            setCollectTimeSetting();
+        }
+
+        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
+        {
+            setCollectTimeSetting();
+        }
+
+        private void checkBox3_CheckedChanged(object sender, EventArgs e)
+        {
+            setCollectTimeSetting();
+        }
+
+        private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
+        {
+            setCollectTimeSetting();
+        }
+
+        //娓呯┖鎺掑簭
+        private void button14_Click(object sender, EventArgs e)
+        {
+            clearSort(-1);
+        }
 
         /**
         * 

--
Gitblit v1.8.0