Browse Source

修复 开启窗口动画,启动项目后无法显示主界面bug

liufei 4 years ago
parent
commit
f11056c469
3 changed files with 7 additions and 5 deletions
  1. 4 4
      Control/UserControls/PannelCard/RightCardControl.xaml.cs
  2. 1 0
      GeekDesk.csproj
  3. 2 1
      Util/HttpUtil.cs

+ 4 - 4
Control/UserControls/PannelCard/RightCardControl.xaml.cs

@@ -135,12 +135,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
                                 {
                                     if (!MainWindow.hide.IsMargin())
                                     {
-                                        MainWindow.mainWindow.Visibility = Visibility.Collapsed;
+                                        MainWindow.HideApp();
                                     }
                                 }
                                 else
                                 {
-                                    MainWindow.mainWindow.Visibility = Visibility.Collapsed;
+                                    MainWindow.HideApp();
                                 }
 
                             }
@@ -153,11 +153,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
                                 {
                                     if (!MainWindow.hide.IsMargin())
                                     {
-                                        MainWindow.mainWindow.Visibility = Visibility.Collapsed;
+                                        MainWindow.HideApp();
                                     }
                                 } else
                                 {
-                                    MainWindow.mainWindow.Visibility = Visibility.Collapsed;
+                                    MainWindow.HideApp();
                                 }
                             }
                             break;

+ 1 - 0
GeekDesk.csproj

@@ -70,6 +70,7 @@
     <Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>packages\System.Drawing.Common.6.0.0-preview.6.21352.12\lib\net461\System.Drawing.Common.dll</HintPath>
     </Reference>
+    <Reference Include="System.Web" />
     <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />

+ 2 - 1
Util/HttpUtil.cs

@@ -17,11 +17,12 @@ namespace GeekDesk.Util
             ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
             //创建Web访问对  象
             HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
+            myRequest.ContentType = "text/plain; charset=gbk";
             //通过Web访问对象获取响应内容
             HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
 
             //通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
-            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
+            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("gbk"));
             string returnStr = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾
             reader.Close();
             myResponse.Close();