-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,386 additions
and
5 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
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,3 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
</configuration> |
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,31 @@ | ||
<prism:PrismApplication x:Class="SagiriApp.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:SagiriApp" | ||
xmlns:prism="http://prismlibrary.com/" | ||
ShutdownMode="OnMainWindowClose" > | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<!-- MahApps --> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Blue.xaml" /> | ||
|
||
<!-- Material Design --> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.teal.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.teal.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<Style BasedOn="{StaticResource MaterialDesignRaisedButton}" TargetType="{x:Type Button}"> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
</Style> | ||
|
||
<Style BasedOn="{StaticResource MahApps.Styles.Label}" TargetType="{x:Type Label}"> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
</Style> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</prism:PrismApplication> |
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.Windows; | ||
|
||
using Prism.Ioc; | ||
using Prism.Mvvm; | ||
using Prism.Unity; | ||
|
||
using SagiriApp.ViewModel; | ||
using SagiriApp.Views; | ||
|
||
namespace SagiriApp | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : PrismApplication | ||
{ | ||
protected override Window CreateShell() => Container.Resolve<MainWindow>(); | ||
|
||
protected override void RegisterTypes(IContainerRegistry containerRegistry) => | ||
containerRegistry.RegisterForNavigation<MainWindow>(); | ||
|
||
protected override void ConfigureViewModelLocator() | ||
{ | ||
base.ConfigureViewModelLocator(); | ||
ViewModelLocationProvider.Register<MainWindow, SagiriViewModel>(); | ||
} | ||
} | ||
} |
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,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,82 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
using Microsoft.Xaml.Behaviors; | ||
|
||
using Sagiri.Services.Spotify.Track; | ||
using Sagiri.Util.Common; | ||
using SagiriApp.Interop; | ||
using SagiriApp.Views; | ||
|
||
namespace SagiriApp.Behavior | ||
{ | ||
class PostingFormatTextBehavior : Behavior<TextBox> | ||
{ | ||
private Logger _Logger { get; set; } = Logger.GetInstance; | ||
public string PostingFormat | ||
{ | ||
get => (string)GetValue(PostingFormatProperty); | ||
set => SetValue(PostingFormatProperty, value); | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for PostingFormat. This enables binding. | ||
public static readonly DependencyProperty PostingFormatProperty = | ||
DependencyProperty.Register( | ||
"PostingFormat", | ||
typeof(string), | ||
typeof(PostingFormatTextBehavior), | ||
new PropertyMetadata(default(string) | ||
) | ||
); | ||
|
||
protected override void OnAttached() | ||
{ | ||
base.OnAttached(); | ||
this.AssociatedObject.TextChanged += _OnTextChanged; | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
base.OnDetaching(); | ||
this.AssociatedObject.TextChanged -= this._OnTextChanged; | ||
} | ||
|
||
private void _OnTextChanged(object sender, EventArgs e) | ||
{ | ||
var activeWindow = Application.Current.Windows | ||
.OfType<Window>() | ||
.SingleOrDefault(x => x.IsActive); | ||
|
||
if (activeWindow is SettingWindow sw) | ||
{ | ||
try | ||
{ | ||
PostingFormat = sw.PostingFormatText.Text; | ||
sw.PreviewText.Text = _RenderPreview(sw); | ||
sw.SettingSave.IsEnabled = true; | ||
} | ||
catch | ||
{ | ||
sw.PreviewText.Text = "(!)投稿フォーマットが無効です"; | ||
sw.SettingSave.IsEnabled = false; | ||
} | ||
} | ||
} | ||
|
||
private string _RenderPreview(SettingWindow sw) | ||
{ | ||
CurrentTrackInfo trackInfo = new() | ||
{ | ||
Album = "メルト 10th ANNIVERSARY MIX", | ||
Artist = "ryo (supercell) - やなぎなぎ", | ||
TrackTitle = "メルト 10th ANNIVERSARY MIX", | ||
TrackNumber = "1", | ||
ReleaseDate = "2017/12/24", | ||
}; | ||
|
||
return Helper.GenerateTrackText(sw.PostingFormatText.Text, trackInfo); | ||
} | ||
} | ||
} |
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,26 @@ | ||
using System; | ||
using System.Windows.Controls; | ||
|
||
using Microsoft.Xaml.Behaviors; | ||
|
||
using SagiriApp.Views; | ||
|
||
namespace SagiriApp.Behavior | ||
{ | ||
class SettingButtonBehavior : Behavior<Button> | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
base.OnAttached(); | ||
this.AssociatedObject.Click += _OnClick; | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
base.OnDetaching(); | ||
this.AssociatedObject.Click -= this._OnClick; | ||
} | ||
|
||
private void _OnClick(object sender, EventArgs e) => SettingWindow.GetInstance?.Show(); | ||
} | ||
} |
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,26 @@ | ||
using System; | ||
using System.Windows.Controls; | ||
|
||
using Microsoft.Xaml.Behaviors; | ||
|
||
using SagiriApp.Views; | ||
|
||
namespace SagiriApp.Behavior | ||
{ | ||
class TrackInfoButtonBehavior : Behavior<Button> | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
base.OnAttached(); | ||
this.AssociatedObject.Click += _OnClick; | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
base.OnDetaching(); | ||
this.AssociatedObject.Click -= this._OnClick; | ||
} | ||
|
||
private void _OnClick(object sender, EventArgs e) => TrackInfoWindow.GetInstance?.Show(); | ||
} | ||
} |
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,83 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
using System.Windows.Forms; | ||
|
||
namespace SagiriApp.Controls | ||
{ | ||
internal class MessageBoxEx : IDisposable | ||
{ | ||
#region Property | ||
|
||
private System.Threading.Timer _Timer { get; set; } | ||
|
||
private string _Text = default!; | ||
private string _Caption = default!; | ||
private int _Interval = default!; | ||
private bool disposedValue; | ||
|
||
#endregion Property | ||
|
||
#region DLL's | ||
|
||
[DllImport("user32.dll", SetLastError = true)] | ||
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); | ||
|
||
[DllImport("user32.dll", CharSet = CharSet.Auto)] | ||
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); | ||
|
||
#endregion DLL's | ||
|
||
#region Constructor | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
/// <param name="text"> body message </param> | ||
/// <param name="caption"> window title </param> | ||
/// <param name="interval"> closing time </param> | ||
public MessageBoxEx(string text, string caption, int interval) | ||
{ | ||
_Text = text; | ||
_Caption = caption; | ||
_Interval = interval; | ||
} | ||
|
||
~MessageBoxEx() => Dispose(disposing: false); | ||
|
||
#endregion Constructor | ||
|
||
public void Show() | ||
{ | ||
this._Timer = new System.Threading.Timer((state) => | ||
{ | ||
var window = FindWindow(null, _Caption); | ||
|
||
if (window != IntPtr.Zero) | ||
SendMessage(window, 0x0010, IntPtr.Zero, IntPtr.Zero); | ||
|
||
this._Timer.Dispose(); | ||
}, null, _Interval, Timeout.Infinite); | ||
|
||
MessageBox.Show(_Text, _Caption); | ||
} | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (!disposedValue) | ||
{ | ||
if (disposing) | ||
{ | ||
_Timer = null; | ||
} | ||
disposedValue = true; | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(disposing: true); | ||
GC.SuppressFinalize(this); | ||
} | ||
} | ||
} |
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
Oops, something went wrong.