Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
IMXNOOBX committed Jul 17, 2024
1 parent 9a37957 commit a4388e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Ghost/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" Margin="10" Text="Update Rate" Style="{StaticResource TextBlockSubTitleBold}"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<RadioButton x:Name="rbFast" Margin="16,0,16,0" Content="Fast (1/1s)" Checked="updaterate_checked"/>
<RadioButton x:Name="rbNormal" Margin="16,0,16,0" Content="Normal (1/5s)" Checked="updaterate_checked" IsChecked="True"/>
<RadioButton x:Name="rbSlow" Margin="16,0,16,0" Content="Slow (1/10s)" Checked="updaterate_checked"/>
<RadioButton x:Name="rbFast" Margin="16,0,16,0" Content="Fast (1/1s)" Checked="update_rate_checked"/>
<RadioButton x:Name="rbNormal" Margin="16,0,16,0" Content="Normal (1/5s)" Checked="update_rate_checked" IsChecked="True"/>
<RadioButton x:Name="rbSlow" Margin="16,0,16,0" Content="Slow (1/10s)" Checked="update_rate_checked"/>
</StackPanel>
</Grid>
<Grid Grid.Row="3">
Expand Down
20 changes: 16 additions & 4 deletions Ghost/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,20 @@ public MainWindow()
Config.read();

// Hide self. startup setter & event
bHideSelf.IsChecked = Config.settings.self_hide;
bHideSelf.IsChecked = Config.settings.self_hide;

if (Config.settings.self_hide)
Utilities.setVisibility(0, 1);

bHideSelf.Click += (s, e) => {
Config.settings.self_hide = (bool)bHideSelf.IsChecked;
Utilities.setVisibility(0, (uint)(Config.settings.self_hide ? 1 : 0)); // Hell this types
};

// Overlay type. startup setter & event
i2OverlayType.SelectedIndex = Config.settings.overlay_type;
i2OverlayType.SelectionChanged += (s, e) => { Config.settings.overlay_type = i2OverlayType.SelectedIndex; };

// Auto run on startup. startup setter & event
bAutoRunOnStartup.IsChecked = Startup.is_registered();
bAutoRunOnStartup.Click += (s, e) => {
Expand All @@ -131,15 +137,19 @@ public MainWindow()
else
Startup.unregister();
};

// Save on exit. startup setter & event
bSaveOnExit.IsChecked = Config.settings.save_on_exit;
bSaveOnExit.Click += (s, e) => { Config.settings.save_on_exit = (bool)bSaveOnExit.IsChecked; };

// Show hidden indicator. startup setter & event
bHiddenIndicator.IsChecked = Config.settings.show_hidden_indicator;
bHiddenIndicator.Click += (s, e) => { Config.settings.show_hidden_indicator = (bool)bHiddenIndicator.IsChecked; };

// Only hide top window. startup setter & event
bOnlyTopWindow.IsChecked = Config.settings.only_hide_top_window;
bOnlyTopWindow.Click += (s, e) => { Config.settings.only_hide_top_window = (bool)bOnlyTopWindow.IsChecked; };

// Update rate. startup setter
switch (Config.settings.ui_update_interval) {
case 1000:
Expand All @@ -160,6 +170,7 @@ public MainWindow()
}

check_loading();

// Make it asyncronous
Task.Run(() => update_ui_processes());
Task.Run(update_processes);
Expand Down Expand Up @@ -202,7 +213,6 @@ public void update_processes() {
update_processes();
}


public void update_ui_processes(bool recursive = true) {
processes = ProcessHandler.get_processes();

Expand Down Expand Up @@ -331,7 +341,9 @@ private void drag_window(object sender, MouseButtonEventArgs e) {
}

private void minimize_window(object sender, RoutedEventArgs e) {
this.WindowState = WindowState.Minimized;
//this.WindowState = WindowState.Minimized;
this.Visibility = Visibility.Hidden; // Just hide it to tray
trayIcon.notify("Minimized To Tray", "I have been minimized to tray, the little menu in your taskbar with the ^ simbol");
}

private void misc_button_click(object sender, RoutedEventArgs e){
Expand All @@ -343,7 +355,7 @@ private void misc_button_click(object sender, RoutedEventArgs e){
Process.Start(new ProcessStartInfo { FileName = $"{Globals.repository}/issues", UseShellExecute = true });
}

private void updaterate_checked(object sender, RoutedEventArgs e) {
private void update_rate_checked(object sender, RoutedEventArgs e) {
if (rbFast.IsChecked == true) {
Config.settings.ui_update_interval = 1000;
Config.settings.scanner_update_interval = 100;
Expand Down
2 changes: 2 additions & 0 deletions Ghost/classes/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public static void setVisibility(IntPtr hwnd = 0, uint type = 0) {
if (hwnd == 0)
hwnd = Process.GetCurrentProcess().MainWindowHandle;

//logger.log($"Window handle is {hwnd}");

SetWindowDisplayAffinity(hwnd, type);
}

Expand Down

0 comments on commit a4388e7

Please sign in to comment.