2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-02 17:03:41 -04:00

Initial overhaul work

This commit is contained in:
Xjph
2023-01-04 09:26:48 -03:30
parent f73227f02f
commit 5c3474dc0e
5 changed files with 93 additions and 30 deletions

View File

@ -9,38 +9,73 @@ using Observatory.UI.Models;
using ReactiveUI;
using System.Reactive.Linq;
using Observatory.Framework;
using System.Collections.Specialized;
namespace Observatory.UI.ViewModels
{
public class BasicUIViewModel : ViewModelBase
{
private ObservableCollection<object> basicUIGrid;
private ObservableCollection<string> _headers;
private ObservableCollection<string> _formats;
private ObservableCollection<ObservableCollection<object>> _items;
public System.Collections.IList SelectedItems { get; set; }
public ObservableCollection<object> BasicUIGrid
public ObservableCollection<string> Headers
{
get => basicUIGrid;
get => _headers;
set
{
basicUIGrid = value;
this.RaisePropertyChanged(nameof(BasicUIGrid));
_headers = value;
_headers.CollectionChanged += (o, e) => this.RaisePropertyChanged(nameof(Headers));
this.RaisePropertyChanged(nameof(Headers));
}
}
public BasicUIViewModel(ObservableCollection<object> BasicUIGrid)
public ObservableCollection<string> Formats
{
this.BasicUIGrid = BasicUIGrid;
get => _formats;
set
{
_formats = value;
_formats.CollectionChanged += (o, e) => this.RaisePropertyChanged(nameof(Formats));
this.RaisePropertyChanged(nameof(Formats));
}
}
private PluginUI.UIType uiType;
public ObservableCollection<ObservableCollection<object>> Items
{
get => _items;
set
{
void raiseItemChanged(object o, NotifyCollectionChangedEventArgs e) { this.RaisePropertyChanged(nameof(Items)); }
_items = value;
_items.CollectionChanged += raiseItemChanged;
this.RaisePropertyChanged(nameof(Items));
foreach (var itemColumn in value)
{
itemColumn.CollectionChanged += raiseItemChanged;
}
}
}
public BasicUIViewModel(ObservableCollection<string> headers, ObservableCollection<string> formats)
{
Headers = headers;
Formats = formats;
}
private PluginUI.UIType _uiType;
public PluginUI.UIType UIType
{
get => uiType;
get => _uiType;
set
{
uiType = value;
_uiType = value;
this.RaisePropertyChanged(nameof(UIType));
}
}

View File

@ -47,8 +47,8 @@ namespace Observatory.UI.ViewModels
foreach(var notifier in notifiers.Select(p => p.plugin))
{
Panel notifierPanel = new Panel();
TextBlock notifierTextBlock = new TextBlock();
Panel notifierPanel = new();
TextBlock notifierTextBlock = new();
notifierTextBlock.Text = notifier.Name;
notifierPanel.Children.Add(notifierTextBlock);
//tabs.Add(new CoreModel() { Name = notifier.ShortName, UI = (ViewModelBase)notifier.UI });
@ -65,7 +65,7 @@ namespace Observatory.UI.ViewModels
}
public void ReadAll()
public static void ReadAll()
{
LogMonitor.GetInstance.ReadAllJournals();
}
@ -86,21 +86,21 @@ namespace Observatory.UI.ViewModels
}
}
public void OpenGithub()
public static void OpenGithub()
{
ProcessStartInfo githubOpen = new("https://github.com/Xjph/ObservatoryCore");
githubOpen.UseShellExecute = true;
Process.Start(githubOpen);
}
public void OpenDonate()
public static void OpenDonate()
{
ProcessStartInfo donateOpen = new("https://paypal.me/eliteobservatory");
donateOpen.UseShellExecute = true;
Process.Start(donateOpen);
}
public void GetUpdate()
public static void GetUpdate()
{
ProcessStartInfo githubOpen = new("https://github.com/Xjph/ObservatoryCore/releases");
githubOpen.UseShellExecute = true;