-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The temperature at which the fan automatically operates can be set.
- Loading branch information
Showing
17 changed files
with
308 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Window x:Class="PocketFanController.ConfigWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:PocketFanController" | ||
mc:Ignorable="d" | ||
Title="Config | Pocket Fan Controller" Height="240" Width="380" Icon="Icon.ico" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> | ||
<Window.DataContext> | ||
<local:ConfigWindowViewModel /> | ||
</Window.DataContext> | ||
<StackPanel Orientation="Vertical" Margin="5,5,5,5"> | ||
<Label Content="Config of the CPU temperature at which the fan operates.
This setting is applied in the case of Auto (Manual)."/> | ||
<GroupBox Header="Config" Margin="3,1,3,0"> | ||
<StackPanel Orientation="Vertical"> | ||
<StackPanel Orientation="Horizontal" Margin="0,2,2,2"> | ||
<Label Content="Margin"/> | ||
<TextBox x:Name="Margin" Width="24" Margin="2" Text="{Binding Margin, Mode=TwoWay,UpdateSourceTrigger=LostFocus}" HorizontalContentAlignment="Right"/> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="0,2,2,2"> | ||
<Label Content="Slowest ≧ 0℃"/> | ||
|
||
<Label Content="Slow ≧" Margin="3,0,0,0"/> | ||
<TextBox x:Name="BorderOfSlow" Width="24" Margin="0,2,3,2" Text="{Binding BorderOfSlow, Mode=TwoWay,UpdateSourceTrigger=LostFocus}" HorizontalContentAlignment="Right"/> | ||
|
||
<Label Content="Fast ≧" Margin="3,0,0,0"/> | ||
<TextBox x:Name="BorderOfFast" Width="24" Margin="0,2,3,2" Text="{Binding BorderOfFast, Mode=TwoWay,UpdateSourceTrigger=LostFocus}" HorizontalContentAlignment="Right"/> | ||
|
||
<Label Content="Fastest ≧" Margin="3,0,0,0"/> | ||
<TextBox x:Name="BorderOfFastest" Width="24" Margin="0,2,2,2" Text="{Binding BorderOfFastest, Mode=TwoWay,UpdateSourceTrigger=LostFocus}" HorizontalContentAlignment="Right"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</GroupBox> | ||
<StackPanel Orientation="Horizontal" Margin="0,10,3,1" HorizontalAlignment="Right"> | ||
<Button Content="Load default" Width="90" Command="{Binding LoadDefaultButton}"/> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="0,10,3,5" HorizontalAlignment="Right"> | ||
<Button Content="OK" Width="55" Command="{Binding OkButton}"/> | ||
<Button Content="Cancel" Width="55" Margin="8,0,0,0" IsCancel="True" Command="{Binding CancelButton}"/> | ||
<Button Content="Apply" Width="55" Margin="8,0,0,0" Command="{Binding ApplyButton}"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace PocketFanController | ||
{ | ||
/// <summary> | ||
/// ConfigWindow.xaml の相互作用ロジック | ||
/// </summary> | ||
public partial class ConfigWindow : Window | ||
{ | ||
public ConfigWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
|
||
namespace PocketFanController | ||
{ | ||
public class ConfigWindowViewModel : ViewModelBase | ||
{ | ||
private Model Model = Model.Instance; | ||
|
||
public ICommand LoadDefaultButton { get; } | ||
public ICommand OkButton { get; } | ||
public ICommand CancelButton { get; } | ||
public ICommand ApplyButton { get; } | ||
|
||
public int Margin | ||
{ | ||
get => Model.ManualMargin; | ||
set | ||
{ | ||
Model.ManualMargin = value; | ||
OnPropertyChanged("Margin"); | ||
} | ||
} | ||
|
||
public int BorderOfSlow | ||
{ | ||
get => Model.ManualT0; | ||
set | ||
{ | ||
Model.ManualT0 =value; | ||
OnPropertyChanged("BorderOfSlow"); | ||
} | ||
} | ||
public int BorderOfFast | ||
{ | ||
get => Model.ManualT1; | ||
set | ||
{ | ||
Model.ManualT1 = value; | ||
OnPropertyChanged("BorderOfFast"); | ||
} | ||
} | ||
public int BorderOfFastest | ||
{ | ||
get => Model.ManualT2; | ||
set | ||
{ | ||
Model.ManualT2 = value; | ||
OnPropertyChanged("BorderOfFastest"); | ||
} | ||
} | ||
|
||
public ConfigWindowViewModel() | ||
{ | ||
LoadDefaultButton = new RelayCommand(() => | ||
{ | ||
Margin = 5; | ||
BorderOfSlow = 40; | ||
BorderOfFast = 60; | ||
BorderOfFastest = 75; | ||
}); | ||
|
||
OkButton = new RelayCommand(() => | ||
{ | ||
Model.SaveManualConfig(Margin,BorderOfSlow,BorderOfFast,BorderOfFastest); | ||
Application.Current.MainWindow.Close(); | ||
}); | ||
|
||
ApplyButton = new RelayCommand(() => | ||
{ | ||
Model.SaveManualConfig(Margin, BorderOfSlow, BorderOfFast, BorderOfFastest); | ||
MessageBox.Show("Apply completed."); | ||
}); | ||
|
||
CancelButton = new RelayCommand(() => | ||
{ | ||
Application.Current.MainWindow.Close(); | ||
}); | ||
|
||
Model.GetManualConfigs(); | ||
UpdateStatus(); | ||
} | ||
|
||
private void UpdateStatus() | ||
{ | ||
OnPropertyChanged("Margin"); | ||
OnPropertyChanged("BorderOfSlow"); | ||
OnPropertyChanged("BorderOfFast"); | ||
OnPropertyChanged("BorderOfFastest"); | ||
} | ||
} | ||
} |
9 changes: 5 additions & 4 deletions
9
PocketFanController/MainWindow.xaml → PocketFanController/ControllerWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.