Robert 3 жил өмнө
parent
commit
c5fcc5d10a

+ 3 - 0
Bellwether/App.config

@@ -16,6 +16,9 @@
             <setting name="SocketIP" serializeAs="String">
                 <value>127.0.0.1</value>
             </setting>
+            <setting name="Screensaver" serializeAs="String">
+                <value>D:\RobertProject\Bellwether\Project\Bellwether\bin\Debug\Ribbons.scr</value>
+            </setting>
         </Bellwether.Properties.Settings>
     </userSettings>
 </configuration>

+ 59 - 13
Bellwether/Pages/ucFrontPage.xaml

@@ -249,12 +249,13 @@
                     VerticalAlignment="Bottom"
                     Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon4.png" />
                 <Image
-                    Width="488"
+                    Width="436"
                     Height="60"
-                    Margin="1289,0,-376,662"
+                    Margin="1289,0,0,662"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_l.png" />
+                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_l.png"
+                    Stretch="Fill" />
                 <Image
                     Width="263"
                     Height="60"
@@ -304,15 +305,40 @@
                     Margin="183,0,0,331"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="今日造林效益值"
+                    Text="棵樹日減碳量"
+                    FontSize="34"
+                    FontFamily="Microsoft JhengHei UI"
+                    Spaceing="-10" />
+
+                <uicomponent:SpacedLabel
+                    Margin="1082,0,0,482"
+                    HorizontalAlignment="Left"
+                    VerticalAlignment="Bottom"
+                    Text="今年發電量"
+                    FontSize="34"
+                    FontFamily="Microsoft JhengHei UI"
+                    Spaceing="-10" />
+                <uicomponent:SpacedLabel
+                    Margin="1082,0,0,381"
+                    HorizontalAlignment="Left"
+                    VerticalAlignment="Bottom"
+                    Text="今年減碳量"
+                    FontSize="34"
+                    FontFamily="Microsoft JhengHei UI"
+                    Spaceing="-10" />
+                <uicomponent:SpacedLabel
+                    Margin="1082,0,0,284"
+                    HorizontalAlignment="Left"
+                    VerticalAlignment="Bottom"
+                    Text="千棵樹年減碳量"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
                 <uicomponent:SpacedLabel
-                    Margin="1787,0,-858,660"
+                    Margin="1741,0,0,660"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="度"
+                    Text="kWp"
                     FontSize="44"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -320,7 +346,7 @@
                     Margin="736,0,0,428"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="公斤"
+                    Text="kg"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -328,7 +354,7 @@
                     Margin="736,0,0,529"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text=""
+                    Text="kWh"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -336,7 +362,7 @@
                     Margin="736,0,0,330"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="平方公尺"
+                    Text="trees"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -344,7 +370,7 @@
                     Margin="1635,0,-730,381"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="公斤"
+                    Text="kg"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -352,7 +378,7 @@
                     Margin="1635,0,-696,482"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text=""
+                    Text="kWh"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -360,7 +386,7 @@
                     Margin="1635,0,-798,283"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Bottom"
-                    Text="平方公尺"
+                    Text="ktrees"
                     FontSize="34"
                     FontFamily="Microsoft JhengHei UI"
                     Spaceing="-10" />
@@ -386,7 +412,7 @@
                     VerticalAlignment="Bottom"
                     Source="/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
                 <Grid
-                    Width="488"
+                    Width="436"
                     Height="60"
                     Margin="1289,0,-376,662"
                     HorizontalAlignment="Left"
@@ -665,6 +691,26 @@
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                 IsHitTestVisible="False" />
+            <Grid>
+                <Grid
+                    Width="100"
+                    Height="100"
+                    Margin="78,282,0,0"
+                    HorizontalAlignment="Left"
+                    VerticalAlignment="Top"
+                    Background="Transparent"
+                    MouseUp="HiddeenButton_Click"
+                    Tag="0" />
+                <Grid
+                    Width="100"
+                    Height="100"
+                    Margin="207,280,0,0"
+                    HorizontalAlignment="Left"
+                    VerticalAlignment="Top"
+                    Background="Transparent"
+                    MouseUp="HiddeenButton_Click"
+                    Tag="1" />
+            </Grid>
         </Grid>
     </UserControl.Content>
 </UserControl>

+ 72 - 0
Bellwether/Pages/ucFrontPage.xaml.cs

@@ -1,6 +1,7 @@
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -176,6 +177,77 @@ namespace Bellwether.Pages
             }
             return null;
         }
+
+        int hiddenStage = 0;
+        private void HiddeenButton_Click(object sender, MouseButtonEventArgs e)
+        {
+            if(!(sender is Grid grid))
+            {
+                return;
+            }
+            var tag = grid.Tag as string;
+            if (string.IsNullOrEmpty(tag))
+            {
+                hiddenStage = 0;
+                return;
+            }
+
+            if (hiddenStage == 0)
+            {
+                if (tag == "0")
+                {
+                    hiddenStage++;
+                }
+                else
+                {
+                    hiddenStage = 0;
+                }
+            }
+            else if (hiddenStage == 1)
+            {
+                if (tag == "0")
+                {
+                    hiddenStage++;
+                }
+                else
+                {
+                    hiddenStage = 0;
+                }
+            }
+            else if(hiddenStage == 2)
+            {
+                if (tag == "1")
+                {
+                    hiddenStage = 0;
+                    ExecuteExternal();
+                }
+                else
+                {
+                    hiddenStage = 0;
+                }
+            }
+            else
+            {
+                hiddenStage = 0;
+            }
+        }
+
+        private async void ExecuteExternal()
+        {
+            //uxMediaViewer.Stop();
+            try
+            {
+                uxMediaViewer.Stop();
+                await Task.Delay(100);
+                var p = Process.Start(Properties.Settings.Default.Screensaver);
+                p.WaitForExit();
+                uxMediaViewer.Play();
+            }
+            catch(Exception e)
+            {
+                MessageBox.Show("螢幕保護程式啟動失敗,請確認程式存在且路徑非C:\\Windows\\System32");
+            }
+        }
     }
 
     public class SolarInfoModel

+ 12 - 0
Bellwether/Properties/Settings.Designer.cs

@@ -46,5 +46,17 @@ namespace Bellwether.Properties {
                 this["SocketIP"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("D:\\RobertProject\\Bellwether\\Project\\Bellwether\\bin\\Debug\\Ribbons.scr")]
+        public string Screensaver {
+            get {
+                return ((string)(this["Screensaver"]));
+            }
+            set {
+                this["Screensaver"] = value;
+            }
+        }
     }
 }

+ 3 - 0
Bellwether/Properties/Settings.settings

@@ -8,5 +8,8 @@
     <Setting Name="SocketIP" Type="System.String" Scope="User">
       <Value Profile="(Default)">127.0.0.1</Value>
     </Setting>
+    <Setting Name="Screensaver" Type="System.String" Scope="User">
+      <Value Profile="(Default)">D:\RobertProject\Bellwether\Project\Bellwether\bin\Debug\Ribbons.scr</Value>
+    </Setting>
   </Settings>
 </SettingsFile>

+ 20 - 0
Bellwether/UIComponent/MediaViewer.xaml.cs

@@ -232,6 +232,26 @@ namespace Bellwether.UIComponent
                 currentVideoPlayer.Stop();
         }
 
+        public void Stop()
+        {
+            currentIndex = -1;
+
+            if (CurrentFramework is VideoPlayer.VideoPlayer currentVideoPlayer)
+                TryStopVideo();
+            else
+                AutoPlayTimer.Stop();
+        }
+
+        public void Play()
+        {
+            Stop();
+
+            if (CurrentFramework is VideoPlayer.VideoPlayer currentVideoPlayer)
+                TryPlayVideo();
+            else
+                AutoPlayTimer.Start();
+        }
+
         private void AutoPlayTimer_Elapsed(object sender, ElapsedEventArgs e)
         {
             if (CurrentFramework is BufferedMediaLoad)

+ 8 - 6
HistoryDLL/DetailViewer.xaml

@@ -59,12 +59,14 @@
                     Orientation="Horizontal" />
             </Grid>
             <!--  文字  -->
-            <StackPanel
-                x:Name="uxTextblockContainer"
-                Grid.Column="3"
-                Orientation="Vertical">
+            <Grid x:Name="uxTextblockContainer" Grid.Column="3">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto" />
+                    <RowDefinition Height="*" />
+                </Grid.RowDefinitions>
                 <TextBlock
                     Name="uxTitleText"
+                    Grid.Row="0"
                     Width="275"
                     MaxHeight="130"
                     FontSize="26"
@@ -77,7 +79,7 @@
                     TextWrapping="Wrap" />
                 <ScrollViewer
                     x:Name="uxStrMainScroll"
-                    Height="307"
+                    Grid.Row="1"
                     Background="Transparent"
                     BorderThickness="0"
                     HorizontalScrollBarVisibility="Hidden"
@@ -105,7 +107,7 @@
                             TextWrapping="Wrap" />
                     </StackPanel>
                 </ScrollViewer>
-            </StackPanel>
+            </Grid>
         </Grid>
 
         <Grid