-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from TheHeadmaster/0.4.3-alpha
0.4.3-alpha
- Loading branch information
Showing
34 changed files
with
708 additions
and
29 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
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,28 @@ | ||
using Horizon.ViewModel.Panes; | ||
using ReactiveUI; | ||
|
||
namespace Horizon.Converters; | ||
|
||
/// <summary> | ||
/// Converts an <see cref="object" /> to an active document binding. | ||
/// </summary> | ||
public sealed class ActiveDocumentConverter : IBindingTypeConverter | ||
{ | ||
/// <inheritdoc /> | ||
public int GetAffinityForObjects(Type fromType, Type toType) => 0; | ||
|
||
/// <inheritdoc /> | ||
public bool TryConvert(object? from, Type toType, object? conversionHint, out object? result) | ||
{ | ||
if (from is PageViewModel) | ||
{ | ||
result = from; | ||
return true; | ||
} | ||
else | ||
{ | ||
result = null; | ||
return false; | ||
} | ||
} | ||
} |
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,29 @@ | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace Horizon.Converters; | ||
|
||
/// <summary> | ||
/// Converts a <see cref="bool" /> to a <see cref="Visibility" /> and back. | ||
/// </summary> | ||
public sealed class BoolToVisibilityConverter : IValueConverter | ||
{ | ||
/// <inheritdoc /> | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
try | ||
{ | ||
Visibility boolVisibility = (bool)value ? Visibility.Visible : Visibility.Collapsed; | ||
return boolVisibility; | ||
} | ||
catch | ||
{ | ||
return Visibility.Collapsed; | ||
} | ||
} | ||
|
||
// No need to implement converting back on a one-way binding | ||
/// <inheritdoc /> | ||
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => null; | ||
} |
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,28 @@ | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace Horizon.Converters; | ||
|
||
/// <summary> | ||
/// Converts an <see cref="enum" /> to a <see cref="string" /> and back. | ||
/// </summary> | ||
public sealed class EnumToStringConverter : IValueConverter | ||
{ | ||
/// <inheritdoc /> | ||
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
try | ||
{ | ||
string EnumString = Enum.GetName(value.GetType(), value) ?? string.Empty; | ||
return EnumString; | ||
} | ||
catch | ||
{ | ||
return string.Empty; | ||
} | ||
} | ||
|
||
// No need to implement converting back on a one-way binding | ||
/// <inheritdoc /> | ||
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => null; | ||
} |
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,40 @@ | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using System.Windows.Media.Imaging; | ||
|
||
namespace Horizon.Converters; | ||
|
||
/// <summary> | ||
/// Converts a <see cref="string" /> path to an <see cref="BitmapImage" /> Source and back. | ||
/// </summary> | ||
public class StringToImageSourceConverter : IValueConverter | ||
{ | ||
/// <inheritdoc /> | ||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) | ||
{ | ||
string? path = value as string; | ||
if (string.IsNullOrWhiteSpace(path)) | ||
{ | ||
return null; | ||
} | ||
|
||
BitmapImage src = new(); | ||
|
||
try | ||
{ | ||
src.BeginInit(); | ||
src.UriSource = new Uri(path); | ||
src.EndInit(); | ||
} | ||
catch (UriFormatException) | ||
{ | ||
return null; | ||
} | ||
|
||
return src; | ||
} | ||
|
||
// No need to implement converting back on a one-way binding | ||
/// <inheritdoc /> | ||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => null; | ||
} |
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,2 @@ | ||
// This file is used by Code Analysis to maintain SuppressMessage attributes that are applied to this project. Project-level | ||
// suppressions either have no target or are given a specific target and scoped to a namespace, type, member, etc. |
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
namespace Horizon.ObjectModel; | ||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
|
||
public class ProjectTemplate | ||
namespace Horizon.ObjectModel; | ||
|
||
public class ProjectTemplate : ReactiveObject | ||
{ | ||
public string Name { get; set; } | ||
[Reactive] | ||
public string Name { get; set; } = string.Empty; | ||
|
||
public string Description { get; set; } | ||
[Reactive] | ||
public string Description { get; set; } = string.Empty; | ||
|
||
[Reactive] | ||
public List<string> Tags { get; set; } = []; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:converters="clr-namespace:Horizon.Converters"> | ||
<converters:EnumToStringConverter x:Key="DefaultEnumToStringConverter" /> | ||
<converters:BoolToVisibilityConverter x:Key="DefaultBoolToVisibilityConverter" /> | ||
<converters:StringToImageSourceConverter x:Key="StringToImageSourceConverter" /> | ||
<converters:ActiveDocumentConverter x:Key="ActiveDocumentConverter" /> | ||
</ResourceDictionary> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Horizon.ViewModel.Panes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace Horizon.View.Panes; | ||
|
||
public sealed class PanesStyleSelector : StyleSelector | ||
{ | ||
public Style? ToolStyle { get; set; } | ||
public Style? PageStyle { get; set; } | ||
|
||
public override Style SelectStyle(object item, DependencyObject container) => item switch | ||
{ | ||
ToolViewModel => this.ToolStyle ?? base.SelectStyle(item, container), | ||
PageViewModel => this.PageStyle ?? base.SelectStyle(item, container), | ||
_ => base.SelectStyle(item, container) | ||
}; | ||
} |
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,17 @@ | ||
using Horizon.ViewModel.Panes; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace Horizon.View.Panes; | ||
|
||
public sealed class PanesTemplateSelector : DataTemplateSelector | ||
{ | ||
public DataTemplate? ProjectExplorerViewTemplate { get; set; } | ||
|
||
public override DataTemplate? SelectTemplate(object item, DependencyObject container) => | ||
item switch | ||
{ | ||
ProjectExplorerViewModel => this.ProjectExplorerViewTemplate, | ||
_ => base.SelectTemplate(item, container) | ||
}; | ||
} |
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,13 @@ | ||
<rui:ReactiveUserControl x:Class="Horizon.View.Panes.ProjectExplorerPane" x:TypeArguments="panes:ProjectExplorerViewModel" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Horizon.View.Panes" | ||
xmlns:rui="http://reactiveui.net" | ||
xmlns:panes="clr-namespace:Horizon.ViewModel.Panes" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
</Grid> | ||
</rui:ReactiveUserControl> |
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,21 @@ | ||
using Horizon.ViewModel.Panes; | ||
using ReactiveUI; | ||
|
||
namespace Horizon.View.Panes; | ||
|
||
/// <summary> | ||
/// Interaction logic for ProjectExplorerPane.xaml | ||
/// </summary> | ||
public partial class ProjectExplorerPane | ||
{ | ||
public ProjectExplorerPane() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
this.ViewModel = new ProjectExplorerViewModel(); | ||
|
||
this.WhenActivated(dispose => | ||
{ | ||
}); | ||
} | ||
} |
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.