Browse Source

修改BUG

章政 7 years ago
parent
commit
be8f4a6ed9

+ 104 - 0
UAS_KanBan/AutoSizeControl.cs

@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace UAS_KanBan
+{
+    class AutoSizeControl
+    {
+        /// <summary>
+        /// 记录所有控件
+        /// </summary>
+        List<Control> ctl = new List<Control>();
+        /// <summary>
+        /// 记录控件的初始化位置
+        /// </summary>
+        Dictionary<string, Point> CtlPoint = new Dictionary<string, Point>();
+        /// <summary>
+        /// 记录控件的初始化大小
+        /// </summary>
+        Dictionary<string, Size> CtlSize = new Dictionary<string, Size>();
+        /// <summary>
+        /// 初始化的窗体宽度
+        /// </summary>
+        int InitFormWidth = 0;
+        /// <summary>
+        /// 初始化的窗体高度
+        /// </summary>
+        int InitFormHeight = 0;
+        /// <summary>
+        /// 窗体调整时的宽度
+        /// </summary>
+        int AutoSizeFormWidth = 0;
+        /// <summary>
+        /// 窗体调整时的高度
+        /// </summary>
+        int AutoSizeFormHeight = 0;
+        /// <summary>
+        /// 自适应宽度比例
+        /// </summary>
+        float AutoSizeWidthRate;
+        /// <summary>
+        /// 
+        /// </summary>
+        float AutoSizeHeigthRate;
+
+        public void InitControl(Control control)
+        {
+            InitFormWidth = control.Width;
+            InitFormHeight = control.Height;
+            foreach (Control item in control.Controls)
+            {
+                ctl.Add(item);
+                CtlPoint.Add(item.Name, item.Location);
+                CtlSize.Add(item.Name, item.Size);
+                if (item.Controls.Count > 0)
+                {
+                    AddControl(item);
+                }
+            }
+        }
+
+        public void AddControl(Control control)
+        {
+            foreach (Control item in control.Controls)
+            {
+                ctl.Add(item);
+                if (!CtlPoint.ContainsKey(item.Name))
+                    CtlPoint.Add(item.Name, item.Location);
+                if (!CtlSize.ContainsKey(item.Name))
+                    CtlSize.Add(item.Name, item.Size);
+                if (item.Controls.Count > 0)
+                {
+                    AddControl(item);
+                }
+            }
+        }
+
+        public void AutoSize(Control control)
+        {
+            AutoSizeFormHeight = control.Height;
+            AutoSizeFormWidth = control.Width;
+            AutoSizeWidthRate = (float)(AutoSizeFormWidth * 1.0 / InitFormWidth);
+            AutoSizeHeigthRate = (float)(AutoSizeFormHeight * 1.0 / InitFormHeight);
+            for (int i = 0; i < ctl.Count; i++)
+            {
+                //AutoSizeWidthRate = (float)(CtlPoint[ctl[i].Name].X * 1.0 / InitFormWidth* AutoSizeFormWidth);
+                //AutoSizeHeigthRate = (float)(CtlPoint[ctl[i].Name].Y* 1.0 / InitFormHeight);
+                ctl[i].Location = new Point((int)(CtlPoint[ctl[i].Name].X * AutoSizeWidthRate), (int)(CtlPoint[ctl[i].Name].Y * AutoSizeHeigthRate));
+                if (CtlPoint.ContainsKey(ctl[i].Name + "_label"))
+                {
+                    for (int j = 0; j < ctl.Count; j++)
+                    {
+                        if (ctl[j].Name == ctl[i].Name + "_label")
+                        {
+                            ctl[i].Location = new Point((int)(CtlPoint[ctl[i].Name + "_label"].X* AutoSizeWidthRate + ctl[j].Width +(CtlPoint[ctl[i].Name].X- CtlPoint[ctl[i].Name + "_label"].X- CtlSize[ctl[i].Name + "_label"].Width)), (int)(CtlPoint[ctl[i].Name + "_label"].Y * AutoSizeHeigthRate));
+                        }
+                    }
+                }
+                ctl[i].Size = new Size((int)(CtlSize[ctl[i].Name].Width * AutoSizeWidthRate), (int)(CtlSize[ctl[i].Name].Height * AutoSizeHeigthRate));
+            }
+        }
+    }
+}

+ 37 - 43
UAS_KanBan/Process.Designer.cs

@@ -48,7 +48,6 @@
             this.Logo = new CCWin.SkinControl.SkinPictureBox();
             this.投入 = new CCWin.SkinControl.SkinLabel();
             this.产出 = new CCWin.SkinControl.SkinLabel();
-            this.机型 = new CCWin.SkinControl.SkinLabel();
             this.收益率 = new CCWin.SkinControl.SkinLabel();
             this.故障数 = new CCWin.SkinControl.SkinLabel();
             this.直通率 = new CCWin.SkinControl.SkinLabel();
@@ -56,6 +55,7 @@
             this.Line = new CCWin.SkinControl.SkinLabel();
             this.Title2 = new CCWin.SkinControl.SkinLabel();
             this.Refresh = new System.Windows.Forms.Timer(this.components);
+            this.机型 = new CCWin.SkinControl.SkinLabel();
             ((System.ComponentModel.ISupportInitialize)(this.Logo)).BeginInit();
             this.SuspendLayout();
             // 
@@ -82,7 +82,7 @@
             this.BottomLine.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
             this.BottomLine.ControlState = CCWin.SkinClass.ControlState.Normal;
             this.BottomLine.DownBack = null;
-            this.BottomLine.Location = new System.Drawing.Point(3, 146);
+            this.BottomLine.Location = new System.Drawing.Point(3, 143);
             this.BottomLine.MouseBack = null;
             this.BottomLine.Name = "BottomLine";
             this.BottomLine.NormlBack = null;
@@ -289,13 +289,12 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.投入.AutoSize = true;
             this.投入.BackColor = System.Drawing.Color.Transparent;
-            this.投入.BorderColor = System.Drawing.Color.White;
-            this.投入.BorderSize = 0;
-            this.投入.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
+            this.投入.BorderColor = System.Drawing.Color.Red;
+            this.投入.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.投入.ForeColor = System.Drawing.Color.Red;
-            this.投入.Location = new System.Drawing.Point(353, 370);
+            this.投入.Location = new System.Drawing.Point(377, 376);
             this.投入.Name = "投入";
-            this.投入.Size = new System.Drawing.Size(0, 93);
+            this.投入.Size = new System.Drawing.Size(0, 69);
             this.投入.TabIndex = 19;
             // 
             // 产出
@@ -304,43 +303,26 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.产出.AutoSize = true;
             this.产出.BackColor = System.Drawing.Color.Transparent;
-            this.产出.BorderColor = System.Drawing.Color.White;
-            this.产出.BorderSize = 0;
-            this.产出.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
+            this.产出.BorderColor = System.Drawing.Color.Red;
+            this.产出.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.产出.ForeColor = System.Drawing.Color.Red;
-            this.产出.Location = new System.Drawing.Point(353, 482);
+            this.产出.Location = new System.Drawing.Point(377, 488);
             this.产出.Name = "产出";
-            this.产出.Size = new System.Drawing.Size(0, 93);
+            this.产出.Size = new System.Drawing.Size(0, 69);
             this.产出.TabIndex = 18;
             // 
-            // 机型
-            // 
-            this.机型.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left)));
-            this.机型.AutoSize = true;
-            this.机型.BackColor = System.Drawing.Color.Transparent;
-            this.机型.BorderColor = System.Drawing.Color.White;
-            this.机型.BorderSize = 0;
-            this.机型.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
-            this.机型.ForeColor = System.Drawing.Color.Red;
-            this.机型.Location = new System.Drawing.Point(353, 259);
-            this.机型.Name = "机型";
-            this.机型.Size = new System.Drawing.Size(0, 93);
-            this.机型.TabIndex = 17;
-            // 
             // 收益率
             // 
             this.收益率.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.收益率.AutoSize = true;
             this.收益率.BackColor = System.Drawing.Color.Transparent;
-            this.收益率.BorderColor = System.Drawing.Color.White;
-            this.收益率.BorderSize = 0;
-            this.收益率.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
+            this.收益率.BorderColor = System.Drawing.Color.Red;
+            this.收益率.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.收益率.ForeColor = System.Drawing.Color.Red;
-            this.收益率.Location = new System.Drawing.Point(932, 370);
+            this.收益率.Location = new System.Drawing.Point(959, 376);
             this.收益率.Name = "收益率";
-            this.收益率.Size = new System.Drawing.Size(0, 93);
+            this.收益率.Size = new System.Drawing.Size(0, 69);
             this.收益率.TabIndex = 22;
             // 
             // 故障数
@@ -349,13 +331,12 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.故障数.AutoSize = true;
             this.故障数.BackColor = System.Drawing.Color.Transparent;
-            this.故障数.BorderColor = System.Drawing.Color.White;
-            this.故障数.BorderSize = 0;
-            this.故障数.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
+            this.故障数.BorderColor = System.Drawing.Color.Red;
+            this.故障数.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.故障数.ForeColor = System.Drawing.Color.Red;
-            this.故障数.Location = new System.Drawing.Point(932, 482);
+            this.故障数.Location = new System.Drawing.Point(959, 488);
             this.故障数.Name = "故障数";
-            this.故障数.Size = new System.Drawing.Size(0, 93);
+            this.故障数.Size = new System.Drawing.Size(0, 69);
             this.故障数.TabIndex = 21;
             // 
             // 直通率
@@ -364,13 +345,12 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.直通率.AutoSize = true;
             this.直通率.BackColor = System.Drawing.Color.Transparent;
-            this.直通率.BorderColor = System.Drawing.Color.White;
-            this.直通率.BorderSize = 0;
-            this.直通率.Font = new System.Drawing.Font("微软雅黑", 52F, System.Drawing.FontStyle.Bold);
+            this.直通率.BorderColor = System.Drawing.Color.Red;
+            this.直通率.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.直通率.ForeColor = System.Drawing.Color.Red;
-            this.直通率.Location = new System.Drawing.Point(932, 259);
+            this.直通率.Location = new System.Drawing.Point(959, 265);
             this.直通率.Name = "直通率";
-            this.直通率.Size = new System.Drawing.Size(0, 93);
+            this.直通率.Size = new System.Drawing.Size(0, 69);
             this.直通率.TabIndex = 20;
             // 
             // 班制
@@ -414,6 +394,20 @@
             this.Title2.TabIndex = 25;
             this.Title2.Text = "投入\\产出实时统计";
             // 
+            // 机型
+            // 
+            this.机型.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.机型.AutoSize = true;
+            this.机型.BackColor = System.Drawing.Color.Transparent;
+            this.机型.BorderColor = System.Drawing.Color.Red;
+            this.机型.Font = new System.Drawing.Font("宋体", 51.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.机型.ForeColor = System.Drawing.Color.Red;
+            this.机型.Location = new System.Drawing.Point(377, 265);
+            this.机型.Name = "机型";
+            this.机型.Size = new System.Drawing.Size(0, 69);
+            this.机型.TabIndex = 17;
+            // 
             // Process
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -482,7 +476,6 @@
         private CCWin.SkinControl.SkinPictureBox Logo;
         private CCWin.SkinControl.SkinLabel 投入;
         private CCWin.SkinControl.SkinLabel 产出;
-        private CCWin.SkinControl.SkinLabel 机型;
         private CCWin.SkinControl.SkinLabel 收益率;
         private CCWin.SkinControl.SkinLabel 故障数;
         private CCWin.SkinControl.SkinLabel 直通率;
@@ -490,5 +483,6 @@
         private CCWin.SkinControl.SkinLabel Line;
         private CCWin.SkinControl.SkinLabel Title2;
         private System.Windows.Forms.Timer Refresh;
+        private CCWin.SkinControl.SkinLabel 机型;
     }
 }

+ 9 - 13
UAS_KanBan/Process.cs

@@ -13,7 +13,7 @@ namespace UAS_KanBan
     public partial class Process : BaseForm
     {
 
-        AutoSizeFormClass asc = new AutoSizeFormClass();
+        AutoSizeControl asc = new AutoSizeControl();
 
         DataHelper dh = new DataHelper();
 
@@ -32,7 +32,7 @@ namespace UAS_KanBan
 
         private void Process_Load(object sender, EventArgs e)
         {
-            asc.controllInitializeSize(this);
+            asc.InitControl(this);
             Refresh_Tick(sender, e);
             Refresh.Tick += Refresh_Tick;
             Refresh.Interval = Setting.RefreshRate * 1000;
@@ -66,23 +66,19 @@ namespace UAS_KanBan
 
         private void Process_SizeChanged(object sender, EventArgs e)
         {
-            asc.controlAutoSize(this);
-            Line1.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
-            Line2.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
-            Line3.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
+            asc.AutoSize(this);
             Title.Location = new Point(Line1.Location.X + (Line2.Location.X - Line1.Location.X - Title.Size.Width) / 2, TopLine.Location.Y + (BottomLine.Location.Y - TopLine.Location.Y - Title.Size.Height) / 2);
             Title2.Location = new Point(Title.Location.X, Title2.Location.Y);
-            Logo.Size = new Size(Line1.Location.X - 20, BottomLine.Location.Y - TopLine.Location.Y - 20);
             WorkShift_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - WorkShift_label.Size.Width) / 2, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2);
             LineCode_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - LineCode_label.Size.Width) / 2, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2);
             Line.Location = new Point(Line.Location.X, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2);
             班制.Location = new Point(班制.Location.X, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2);
-            机型.Location = new Point(机型_label.Location.X + 机型_label.Width + 20, 机型_label.Location.Y-10);
-            投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 20, 投入_label.Location.Y-10);
-            产出.Location = new Point(产出_label.Location.X + 机型_label.Width + 20, 产出_label.Location.Y-10);
-            直通率.Location = new Point(直通率_label.Location.X + 直通率_label.Width + 20, 直通率_label.Location.Y-10);
-            收益率.Location = new Point(收益率_label.Location.X + 收益率_label.Width + 20, 收益率_label.Location.Y-10);
-            故障数.Location = new Point(故障数_label.Location.X + 故障数_label.Width + 20, 故障数_label.Location.Y-10);
+            机型.Location = new Point(机型_label.Location.X + 机型_label.Width + 30, 机型_label.Location.Y);
+            投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 30, 投入_label.Location.Y);
+            产出.Location = new Point(产出_label.Location.X + 机型_label.Width + 30, 产出_label.Location.Y);
+            直通率.Location = new Point(直通率_label.Location.X + 直通率_label.Width + 30, 直通率_label.Location.Y);
+            收益率.Location = new Point(收益率_label.Location.X + 收益率_label.Width + 30, 收益率_label.Location.Y);
+            故障数.Location = new Point(故障数_label.Location.X + 故障数_label.Width + 30, 故障数_label.Location.Y);
         }
 
         private void Process_FormClosing(object sender, FormClosingEventArgs e)

+ 16 - 1
UAS_KanBan/Program.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Security.Principal;
 using System.Windows.Forms;
 
 namespace UAS_KanBan
@@ -11,9 +12,23 @@ namespace UAS_KanBan
         [STAThread]
         static void Main()
         {
+            WindowsIdentity identity = WindowsIdentity.GetCurrent();
+            WindowsPrincipal principal = new WindowsPrincipal(identity);
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new Setting());
+            if (principal.IsInRole(WindowsBuiltInRole.Administrator))
+                Application.Run(new Setting());
+            else
+            {
+                //创建启动对象
+                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
+                // 设置运行文件
+                startInfo.FileName = Application.ExecutablePath;
+                //设置启动动作,确保以管理员身份运行
+                startInfo.Verb = "runas";
+                //如果不是管理员,则启动UAC
+                System.Diagnostics.Process.Start(startInfo);
+            }
         }
     }
 }

+ 2 - 1
UAS_KanBan/UAS_KanBan.csproj

@@ -30,7 +30,6 @@
     <SuiteName>UAS看板</SuiteName>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
-    <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
     <ApplicationRevision>9</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
@@ -81,6 +80,7 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -92,6 +92,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AutoSizeControl.cs" />
     <Compile Include="AutoSizeFormClass.cs" />
     <Compile Include="BaseForm.cs">
       <SubType>Form</SubType>

+ 1 - 1
UAS_XmlAnalysor/App.config

@@ -11,7 +11,7 @@
     <userSettings>
         <UAS_XmlAnalysor.Properties.Settings>
             <setting name="MES" serializeAs="String">
-                <value>Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</value>
+                <value>Data Source=117.25.180.218/orcl;User ID=MES;PassWord=select!#%*(</value>
             </setting>
             <setting name="FolderPath" serializeAs="String">
                 <value />

+ 1 - 0
UAS_XmlAnalysor/Form1.cs

@@ -38,6 +38,7 @@ namespace UAS_XmlAnalysor
                 if (Master.Text == dt.Rows[i]["ma_user"].ToString())
                 {
                     DataHelper.DBConnectionString = "Data Source=" + dt.Rows[i]["ma_address"] + ";User ID=" + dt.Rows[i]["ma_user"] + ";PassWord=" + dt.Rows[i]["ms_pwd"]; ;
+                    Console.WriteLine(DataHelper.DBConnectionString);
                     dh = new DataHelper();
                 }
             }

+ 0 - 32
UAS_XmlAnalysor/Login.cs

@@ -1,32 +0,0 @@
-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 UAS_XmlAnalysor
-{
-    public partial class Login : Form
-    {
-        public Login()
-        {
-            InitializeComponent();
-        }
-
-        private void LoginButton_Click(object sender, EventArgs e)
-        {
-            string ErrorMessage = "";
-            if (LogicHandler.CheckUserLogin(UserName.Text, PassWord.Text, out ErrorMessage))
-            {
-
-            }
-            else
-            {
-                MessageBox.Show(ErrorMessage);
-            }
-        }
-    }
-}

+ 0 - 120
UAS_XmlAnalysor/Login.resx

@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-</root>

+ 25 - 5
UAS_XmlAnalysor/Program.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Security.Principal;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -15,10 +16,30 @@ namespace UAS_XmlAnalysor
         [STAThread]
         static void Main()
         {
-            Application.EnableVisualStyles();
-            Application.SetCompatibleTextRenderingDefault(false);
-            SetAutoRun(Application.StartupPath+@"\"+ "UAS_XML解析器.exe", true);
-            Application.Run(new Form1());
+            try
+            {
+                WindowsIdentity identity = WindowsIdentity.GetCurrent();
+                WindowsPrincipal principal = new WindowsPrincipal(identity);
+                Application.EnableVisualStyles();
+                Application.SetCompatibleTextRenderingDefault(false);
+                if (principal.IsInRole(WindowsBuiltInRole.Administrator))
+                    Application.Run(new Form1());
+                else
+                {
+                    //创建启动对象
+                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
+                    // 设置运行文件
+                    startInfo.FileName = Application.ExecutablePath;
+                    //设置启动动作,确保以管理员身份运行
+                    startInfo.Verb = "runas";
+                    //如果不是管理员,则启动UAC
+                    System.Diagnostics.Process.Start(startInfo);
+                }
+            }
+            catch (Exception)
+            {
+
+            }
         }
 
         public static void SetAutoRun(string fileName, bool isAutoRun)
@@ -46,7 +67,6 @@ namespace UAS_XmlAnalysor
                 if (reg != null)
                     reg.Close();
             }
-
         }
     }
 }

+ 1 - 3
UAS_XmlAnalysor/Properties/Settings.Designer.cs

@@ -25,9 +25,7 @@ namespace UAS_XmlAnalysor.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_" +
-            "LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SER" +
-            "VER=DEDICATED)(SERVICE_NAME=orcl)));")]
+        [global::System.Configuration.DefaultSettingValueAttribute("Data Source=117.25.180.218/orcl;User ID=MES;PassWord=select!#%*(")]
         public string MES {
             get {
                 return ((string)(this["MES"]));

+ 1 - 1
UAS_XmlAnalysor/Properties/Settings.settings

@@ -3,7 +3,7 @@
   <Profiles />
   <Settings>
     <Setting Name="MES" Type="System.String" Scope="User">
-      <Value Profile="(Default)">Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</Value>
+      <Value Profile="(Default)">Data Source=117.25.180.218/orcl;User ID=MES;PassWord=select!#%*(</Value>
     </Setting>
     <Setting Name="FolderPath" Type="System.String" Scope="User">
       <Value Profile="(Default)" />

+ 3 - 11
UAS_XmlAnalysor/UAS_XmlAnalysor.csproj

@@ -22,15 +22,16 @@
     <UpdateInterval>7</UpdateInterval>
     <UpdateIntervalUnits>Days</UpdateIntervalUnits>
     <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
+    <UpdateRequired>true</UpdateRequired>
     <MapFileExtensions>true</MapFileExtensions>
     <InstallUrl>http://218.17.158.219:8888/Xml/</InstallUrl>
     <ProductName>UAS_XML解析器</ProductName>
     <PublisherName>深圳市优软科技有限公司</PublisherName>
     <SuiteName>UAS_XML解析器</SuiteName>
+    <MinimumRequiredVersion>1.0.0.5</MinimumRequiredVersion>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>4</ApplicationRevision>
+    <ApplicationRevision>8</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>
@@ -96,20 +97,11 @@
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
     <Compile Include="LogicHandler.cs" />
-    <Compile Include="Login.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="Login.Designer.cs">
-      <DependentUpon>Login.cs</DependentUpon>
-    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Login.resx">
-      <DependentUpon>Login.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>