mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added LUA GUI module
This commit is contained in:
parent
96afd7bbb7
commit
0cf9b3547e
@ -568,10 +568,20 @@
|
||||
<Compile Include="Profiles\Lua\Modules\Events\LuaKeyPressEventArgs.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceDrawingEventArgs.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceUpdatingEventArgs.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaButton.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaCheckBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaComboBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaLabel.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaTextBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaWindowView.xaml.cs">
|
||||
<DependentUpon>LuaWindowView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaWindowViewModel.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaEventsModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaBrushesModule.cs" />
|
||||
<Compile Include="Profiles\Lua\LuaModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Brushes\LuaSolidColorBrush.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaGuiModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaKeybindModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaKeyboardModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaLayerModule.cs" />
|
||||
@ -935,6 +945,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Profiles\Lua\Modules\Gui\LuaWindowView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Resources\Icons.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@ -6,6 +6,7 @@ using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
||||
using Artemis.Profiles.Lua;
|
||||
using Artemis.Profiles.Lua.Modules.Gui;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Artemis.Utilities.GameState;
|
||||
@ -116,6 +117,8 @@ namespace Artemis.InjectionModules
|
||||
.InheritedFrom<LuaModule>()
|
||||
.BindAllBaseClasses());
|
||||
|
||||
Bind<LuaWindowViewModel>().ToSelf();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Artemis.Models
|
||||
new ConstructorArgument("dataModel", dataModel),
|
||||
new ConstructorArgument("layer", layer)
|
||||
};
|
||||
_windowService.ShowDialog<LayerEditorViewModel>("Artemis | Edit layer", args);
|
||||
_windowService.ShowDialog<LayerEditorViewModel>("Artemis | Edit layer", null, args);
|
||||
|
||||
// If the layer was a folder, but isn't anymore, assign it's children to it's parent.
|
||||
if (layer.LayerType is FolderType || !layer.Children.Any())
|
||||
|
||||
49
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaButton.cs
Normal file
49
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaButton.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Managers;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaButton
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaButton(LuaManager luaManager, string text, double x, double y, double? width, double? height)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
Button = new Button {Content = text};
|
||||
if (width != null)
|
||||
Button.Width = width.Value;
|
||||
if (height != null)
|
||||
Button.Height = height.Value;
|
||||
|
||||
Button.Click += ButtonOnClick;
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
public Button Button { get; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => Button.Dispatcher.Invoke(() => (string) Button.Content);
|
||||
set => Button.Dispatcher.Invoke(() => Button.Content = value);
|
||||
}
|
||||
|
||||
private void ButtonOnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
_luaManager.EventsModule.LuaInvoke(_luaManager.ProfileModel, () => OnClick(this));
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> Click;
|
||||
|
||||
protected virtual void OnClick(LuaButton button)
|
||||
{
|
||||
Click?.Invoke(button, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaCheckBox.cs
Normal file
55
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaCheckBox.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Managers;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaCheckBox
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaCheckBox(LuaManager luaManager, string text, bool isChecked, double x, double y, double? width, double? height)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
CheckBox = new CheckBox {Content = text, IsChecked = isChecked};
|
||||
if (width != null)
|
||||
CheckBox.Width = width.Value;
|
||||
if (height != null)
|
||||
CheckBox.Height = height.Value;
|
||||
|
||||
CheckBox.Click += CheckBoxOnClick;
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
public CheckBox CheckBox { get; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => CheckBox.Dispatcher.Invoke(() => (string) CheckBox.Content);
|
||||
set => CheckBox.Dispatcher.Invoke(() => CheckBox.Content = value);
|
||||
}
|
||||
|
||||
public bool IsChecked
|
||||
{
|
||||
get => CheckBox.Dispatcher.Invoke(() => CheckBox.IsChecked != null && (bool) CheckBox.IsChecked);
|
||||
set => CheckBox.Dispatcher.Invoke(() => CheckBox.IsChecked = value);
|
||||
}
|
||||
|
||||
private void CheckBoxOnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
_luaManager.EventsModule.LuaInvoke(_luaManager.ProfileModel, () => OnClick(this));
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> Click;
|
||||
|
||||
protected virtual void OnClick(LuaCheckBox checkBox)
|
||||
{
|
||||
Click?.Invoke(checkBox, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaComboBox.cs
Normal file
70
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaComboBox.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Managers;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaComboBox
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaComboBox(LuaManager luaManager, string value, List<string> values, double x, double y, double? width, double? height)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
ComboBox = new ComboBox {ItemsSource = new ObservableCollection<string>(values), SelectedItem = value};
|
||||
if (width != null)
|
||||
ComboBox.Width = (double) width;
|
||||
if (height != null)
|
||||
ComboBox.Height = (double) height;
|
||||
|
||||
ComboBox.SelectionChanged += ComboBoxOnSelectionChanged;
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
public ComboBox ComboBox { get; }
|
||||
|
||||
public string Value
|
||||
{
|
||||
get => ComboBox.Dispatcher.Invoke(() => (string) ComboBox.SelectedItem);
|
||||
set => ComboBox.Dispatcher.Invoke(() => ComboBox.SelectedItem = value);
|
||||
}
|
||||
|
||||
public void SetValues(string[] values)
|
||||
{
|
||||
var collection = (ObservableCollection<string>) ComboBox.ItemsSource;
|
||||
collection.Clear();
|
||||
foreach (var value in values)
|
||||
collection.Add(value);
|
||||
}
|
||||
|
||||
public void AddValue(string value)
|
||||
{
|
||||
((ObservableCollection<string>) ComboBox.ItemsSource).Add(value);
|
||||
}
|
||||
|
||||
public void RemoveValue(string value)
|
||||
{
|
||||
var collection = (ObservableCollection<string>) ComboBox.ItemsSource;
|
||||
if (collection.Contains(value))
|
||||
collection.Remove(value);
|
||||
}
|
||||
|
||||
private void ComboBoxOnSelectionChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs)
|
||||
{
|
||||
_luaManager.EventsModule.LuaInvoke(_luaManager.ProfileModel, () => OnSelectionChanged(this));
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> SelectionChanged;
|
||||
|
||||
protected virtual void OnSelectionChanged(LuaComboBox comboBox)
|
||||
{
|
||||
SelectionChanged?.Invoke(comboBox, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaLabel.cs
Normal file
30
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaLabel.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaLabel
|
||||
{
|
||||
public LuaLabel(string text, double x, double y, double fontSize = 12, int fontWeight = 400)
|
||||
{
|
||||
Label = new Label
|
||||
{
|
||||
Content = text,
|
||||
FontSize = fontSize,
|
||||
FontWeight = FontWeight.FromOpenTypeWeight(fontWeight)
|
||||
};
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
public Label Label { get; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => Label.Dispatcher.Invoke(() => (string) Label.Content);
|
||||
set => Label.Dispatcher.Invoke(() => Label.Content = value);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaTextBox.cs
Normal file
48
Artemis/Artemis/Profiles/Lua/Modules/Gui/LuaTextBox.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Managers;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaTextBox
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaTextBox(LuaManager luaManager, string text, double x, double y, double? width, double? height)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
TextBox = new TextBox {Text = text};
|
||||
if (width != null)
|
||||
TextBox.Width = width.Value;
|
||||
if (height != null)
|
||||
TextBox.Height = height.Value;
|
||||
|
||||
TextBox.TextChanged += TextBoxOnTextChanged;
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
public TextBox TextBox { get; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => TextBox.Dispatcher.Invoke(() => TextBox.Text);
|
||||
set => TextBox.Dispatcher.Invoke(() => TextBox.Text = value);
|
||||
}
|
||||
|
||||
private void TextBoxOnTextChanged(object sender, TextChangedEventArgs textChangedEventArgs)
|
||||
{
|
||||
_luaManager.EventsModule.LuaInvoke(_luaManager.ProfileModel, () => OnTextChanged(this));
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> TextChanged;
|
||||
|
||||
protected virtual void OnTextChanged(LuaTextBox button)
|
||||
{
|
||||
TextChanged?.Invoke(button, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
<controls:MetroWindow x:Class="Artemis.Profiles.Lua.Modules.Gui.LuaWindowView" 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:Artemis.Profiles.Lua.Modules.Gui"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" mc:Ignorable="d" Title="LuaWindowView" Height="300" Width="300" WindowStartupLocation="CenterScreen"
|
||||
GlowBrush="{DynamicResource AccentColorBrush}">
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding Path=Content}" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</controls:MetroWindow>
|
||||
@ -0,0 +1,15 @@
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LuaWindowView.xaml
|
||||
/// </summary>
|
||||
public partial class LuaWindowView : MetroWindow
|
||||
{
|
||||
public LuaWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Managers;
|
||||
using Caliburn.Micro;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaWindowViewModel : Screen
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaWindowViewModel(LuaManager luaManager)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
Canvas = new Canvas();
|
||||
Content = new List<UIElement> {Canvas};
|
||||
}
|
||||
|
||||
public Canvas Canvas { get; set; }
|
||||
public List<UIElement> Content { get; set; }
|
||||
|
||||
public LuaLabel CreateLabel(string text, double x, double y, double fontSize = 12, int fontWeight = 400)
|
||||
{
|
||||
LuaLabel element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaLabel(text, x, y, fontSize, fontWeight);
|
||||
AddControl(element.Label, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public LuaButton CreateButton(string text, double x, double y, double? width, double? height)
|
||||
{
|
||||
LuaButton element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaButton(_luaManager, text, x, y, width, height);
|
||||
AddControl(element.Button, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public LuaTextBox CreateTextBox(string text, double x, double y, double? width, double? height)
|
||||
{
|
||||
LuaTextBox element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaTextBox(_luaManager, text, x, y, width, height);
|
||||
AddControl(element.TextBox, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public LuaComboBox CreateComboBox(string value, List<string> values, double x, double y, double? width, double? height)
|
||||
{
|
||||
LuaComboBox element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaComboBox(_luaManager, value, values, x, y, width, height);
|
||||
AddControl(element.ComboBox, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public LuaCheckBox CreateCheckBox(string text, bool isChecked, double x, double y, double? width, double? height)
|
||||
{
|
||||
LuaCheckBox element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaCheckBox(_luaManager, text, isChecked, x, y, width, height);
|
||||
AddControl(element.CheckBox, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
private void AddControl(UIElement uiElement, double x, double y)
|
||||
{
|
||||
Canvas.Children.Add(uiElement);
|
||||
Canvas.SetLeft(uiElement, x);
|
||||
Canvas.SetTop(uiElement, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ namespace Artemis.Profiles.Lua.Modules
|
||||
}
|
||||
}
|
||||
|
||||
private void LuaInvoke(ProfileModel profileModel, Action action)
|
||||
public void LuaInvoke(ProfileModel profileModel, Action action)
|
||||
{
|
||||
lock (InvokeLock)
|
||||
{
|
||||
|
||||
50
Artemis/Artemis/Profiles/Lua/Modules/LuaGuiModule.cs
Normal file
50
Artemis/Artemis/Profiles/Lua/Modules/LuaGuiModule.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Profiles.Lua.Modules.Gui;
|
||||
using Artemis.Services;
|
||||
using Caliburn.Micro;
|
||||
using MoonSharp.Interpreter;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaGuiModule : LuaModule
|
||||
{
|
||||
private readonly WindowService _windowService;
|
||||
private readonly List<LuaWindowViewModel> _windows;
|
||||
|
||||
public LuaGuiModule(LuaManager luaManager, WindowService windowService) : base(luaManager)
|
||||
{
|
||||
_windowService = windowService;
|
||||
_windows = new List<LuaWindowViewModel>();
|
||||
}
|
||||
|
||||
public override string ModuleName => "Gui";
|
||||
|
||||
public LuaWindowViewModel CreateWindow(string title, double width, double height)
|
||||
{
|
||||
lock (_windows)
|
||||
{
|
||||
dynamic settings = new ExpandoObject();
|
||||
settings.Width = width;
|
||||
settings.Height = height;
|
||||
IParameter[] args =
|
||||
{
|
||||
new ConstructorArgument("luaManager", LuaManager)
|
||||
};
|
||||
|
||||
Execute.OnUIThread(() => _windows.Add(_windowService.ShowWindow<LuaWindowViewModel>("Artemis | " + title, settings, args)));
|
||||
return _windows.Last();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
foreach (var window in _windows)
|
||||
window.TryClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ using System.Windows;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("1.9.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.9.0.1")]
|
||||
[assembly: AssemblyVersion("1.9.0.2")]
|
||||
[assembly: AssemblyFileVersion("1.9.0.2")]
|
||||
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
||||
|
||||
|
||||
@ -1,39 +1,41 @@
|
||||
using System.Dynamic;
|
||||
using Caliburn.Micro;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.Services
|
||||
{
|
||||
public class WindowService
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public WindowService(IKernel kernel)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public T ShowWindow<T>(string windowName, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
using System.Dynamic;
|
||||
using Caliburn.Micro;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.Services
|
||||
{
|
||||
public class WindowService
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public WindowService(IKernel kernel)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public T ShowWindow<T>(string windowName, dynamic settings = null, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
dynamic settings = new ExpandoObject();
|
||||
settings.Title = windowName;
|
||||
windowManager.ShowWindow(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public T ShowDialog<T>(string dialogName, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
dynamic settings = new ExpandoObject();
|
||||
settings.Title = dialogName;
|
||||
windowManager.ShowDialog(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
}
|
||||
if (settings == null)
|
||||
settings = new ExpandoObject();
|
||||
settings.Title = windowName;
|
||||
windowManager.ShowWindow(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public T ShowDialog<T>(string dialogName, dynamic settings = null, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
if (settings == null)
|
||||
settings = new ExpandoObject();
|
||||
settings.Title = dialogName;
|
||||
windowManager.ShowDialog(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@
|
||||
ItemsSource="{Binding AvailableBrushTypes, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Rows="1" Columns="4" />
|
||||
<UniformGrid Rows="1" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemContainerStyle>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user