mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 10:13:30 +00:00
FINALLY fixed dissapearing views after debugging all day
This commit is contained in:
parent
4c766f29b4
commit
917bb88241
@ -116,7 +116,7 @@ namespace Artemis
|
|||||||
|
|
||||||
protected override void OnStartup(object sender, StartupEventArgs e)
|
protected override void OnStartup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
DisplayRootViewFor<SystemTrayViewModel>();
|
DisplayRootViewFor<ShellViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,7 +14,8 @@ namespace Artemis.InjectionModules
|
|||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
// ViewModels
|
// ViewModels
|
||||||
Bind<ShellViewModel>().ToSelf();
|
Bind<ShellViewModel>().ToSelf().InSingletonScope();
|
||||||
|
Bind<SystemTrayViewModel>().ToSelf().InSingletonScope();
|
||||||
Bind<ProfileViewModel>().ToSelf();
|
Bind<ProfileViewModel>().ToSelf();
|
||||||
Bind<ProfileEditorViewModel>().ToSelf();
|
Bind<ProfileEditorViewModel>().ToSelf();
|
||||||
Bind<DebugViewModel>().ToSelf().InSingletonScope();
|
Bind<DebugViewModel>().ToSelf().InSingletonScope();
|
||||||
|
|||||||
@ -59,17 +59,17 @@ namespace Artemis.Modules.Games.GtaV
|
|||||||
|
|
||||||
private void PipeServerOnPipeMessage(string reply)
|
private void PipeServerOnPipeMessage(string reply)
|
||||||
{
|
{
|
||||||
// if (!Initialized)
|
if (!Initialized)
|
||||||
// return;
|
return;
|
||||||
//
|
|
||||||
// // Convert the given string to a list of ints
|
// Convert the given string to a list of ints
|
||||||
// var stringParts = reply.Split(' ');
|
var stringParts = reply.Split(' ');
|
||||||
// var parts = new string[stringParts.Length];
|
var parts = new string[stringParts.Length];
|
||||||
// for (var i = 0; i < stringParts.Length; i++)
|
for (var i = 0; i < stringParts.Length; i++)
|
||||||
// parts[i] = stringParts[i];
|
parts[i] = stringParts[i];
|
||||||
//
|
|
||||||
// if (parts[0] == "0")
|
if (parts[0] == "0")
|
||||||
// InterpertrateLighting(parts);
|
InterpertrateLighting(parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InterpertrateLighting(string[] parts)
|
private void InterpertrateLighting(string[] parts)
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using Artemis.Managers;
|
||||||
|
using Artemis.Services;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Artemis.ViewModels.Flyouts;
|
using Artemis.ViewModels.Flyouts;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
using MahApps.Metro.Controls;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
|
|
||||||
namespace Artemis.ViewModels
|
namespace Artemis.ViewModels
|
||||||
@ -11,10 +15,12 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly IKernel _kernel;
|
private readonly IKernel _kernel;
|
||||||
|
|
||||||
public ShellViewModel(IKernel kernel, FlyoutSettingsViewModel flyoutSettings)
|
public ShellViewModel(IKernel kernel, MainManager mainManager, MetroDialogService metroDialogService,
|
||||||
|
FlyoutSettingsViewModel flyoutSettings)
|
||||||
{
|
{
|
||||||
_kernel = kernel;
|
_kernel = kernel;
|
||||||
|
|
||||||
|
|
||||||
// Setup UI
|
// Setup UI
|
||||||
DisplayName = "Artemis";
|
DisplayName = "Artemis";
|
||||||
|
|
||||||
@ -22,10 +28,52 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
flyoutSettings
|
flyoutSettings
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
MainManager = mainManager;
|
||||||
|
MetroDialogService = metroDialogService;
|
||||||
|
MainManager.EnableProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SystemTrayViewModel SystemTrayViewModel { get; set; }
|
||||||
|
public MainManager MainManager { get; set; }
|
||||||
|
public MetroDialogService MetroDialogService { get; set; }
|
||||||
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; }
|
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; }
|
||||||
|
|
||||||
|
private MetroWindow Window => (MetroWindow) GetView();
|
||||||
|
|
||||||
|
public override void CanClose(Action<bool> callback)
|
||||||
|
{
|
||||||
|
if (Window.IsVisible)
|
||||||
|
HideWindow();
|
||||||
|
else
|
||||||
|
ShowWindow();
|
||||||
|
|
||||||
|
// ShellView is a strong and independent view who won't let herself get closed by the likes of anyone!
|
||||||
|
callback(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanShowWindow => !Window.IsVisible;
|
||||||
|
public bool CanHideWindow => Window.IsVisible;
|
||||||
|
|
||||||
|
public void ShowWindow()
|
||||||
|
{
|
||||||
|
if (!Window.IsVisible)
|
||||||
|
Window.Show();
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(() => CanShowWindow);
|
||||||
|
NotifyOfPropertyChange(() => CanHideWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideWindow()
|
||||||
|
{
|
||||||
|
if (Window.IsVisible)
|
||||||
|
Window.Hide();
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(() => CanShowWindow);
|
||||||
|
NotifyOfPropertyChange(() => CanHideWindow);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
base.OnActivate();
|
base.OnActivate();
|
||||||
|
|||||||
@ -6,11 +6,14 @@
|
|||||||
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||||
xmlns:cal="http://www.caliburnproject.org"
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
|
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
|
||||||
|
xmlns:viewModels="clr-namespace:Artemis.ViewModels"
|
||||||
|
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||||
dialogs:DialogParticipation.Register="{Binding RelativeSource={RelativeSource Self}, Path=DataContext}"
|
dialogs:DialogParticipation.Register="{Binding RelativeSource={RelativeSource Self}, Path=DataContext}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Artemis" Height="800" Width="1210"
|
Title="Artemis" Height="800" Width="1210"
|
||||||
MinHeight="800" MinWidth="1210"
|
MinHeight="800" MinWidth="1210"
|
||||||
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../logo.ico">
|
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../logo.ico"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:ShellViewModel}">
|
||||||
<!-- Bit of extra code to use a different icon than in the taskbar -->
|
<!-- Bit of extra code to use a different icon than in the taskbar -->
|
||||||
<Controls:MetroWindow.Resources>
|
<Controls:MetroWindow.Resources>
|
||||||
<DrawingImage x:Key="BowIcon">
|
<DrawingImage x:Key="BowIcon">
|
||||||
@ -45,6 +48,22 @@
|
|||||||
</DrawingGroup>
|
</DrawingGroup>
|
||||||
</DrawingImage.Drawing>
|
</DrawingImage.Drawing>
|
||||||
</DrawingImage>
|
</DrawingImage>
|
||||||
|
|
||||||
|
<!-- Tray icon -->
|
||||||
|
<ContextMenu x:Shared="false" x:Key="MainSysTrayMenu">
|
||||||
|
<MenuItem Header="Show Artemis" cal:Message.Attach="ShowWindow" />
|
||||||
|
<MenuItem Header="Hide Artemis" cal:Message.Attach="HideWindow" />
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Header="{Binding Path=ToggleText, Mode=OneWay}" cal:Message.Attach="ToggleEnabled" />
|
||||||
|
<MenuItem Header="Exit" cal:Message.Attach="ExitApplication" />
|
||||||
|
</ContextMenu>
|
||||||
|
|
||||||
|
<!-- the application main system tray icon -->
|
||||||
|
<tb:TaskbarIcon x:Key="SystemTrayIcon"
|
||||||
|
IconSource="{Binding Path=ActiveIcon, Mode=OneWay}"
|
||||||
|
ToolTipText="Artemis"
|
||||||
|
cal:Message.Attach="[Event TrayMouseDoubleClick] = [Action ShowWindow]"
|
||||||
|
ContextMenu="{StaticResource MainSysTrayMenu}" />
|
||||||
</Controls:MetroWindow.Resources>
|
</Controls:MetroWindow.Resources>
|
||||||
<Controls:MetroWindow.IconTemplate>
|
<Controls:MetroWindow.IconTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@ -105,5 +124,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</TabControl.ItemTemplate>
|
</TabControl.ItemTemplate>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|
||||||
|
<ContentControl Content="{StaticResource SystemTrayIcon}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Controls:MetroWindow>
|
</Controls:MetroWindow>
|
||||||
Loading…
x
Reference in New Issue
Block a user