mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-05-15 09:52:18 +12:00
Added options for OCI window
This commit is contained in:
parent
eead2780e9
commit
7ff93ec823
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
|
@ -56,6 +56,9 @@
|
|||
<setting name="LanguageCode" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="OCIWindow" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</ModAssistant.Properties.Settings>
|
||||
<ModAssistant.Settings1>
|
||||
<setting name="InstallFolder" serializeAs="String">
|
||||
|
@ -66,4 +69,4 @@
|
|||
</setting>
|
||||
</ModAssistant.Settings1>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ModAssistant
|
|||
public static string Arguments;
|
||||
public static bool Update = true;
|
||||
public static bool GUI = true;
|
||||
|
||||
public static string OCIWindow;
|
||||
|
||||
private async void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
@ -43,6 +43,11 @@ namespace ModAssistant
|
|||
}
|
||||
|
||||
Version = Version.Substring(0, Version.Length - 2);
|
||||
OCIWindow = ModAssistant.Properties.Settings.Default.OCIWindow;
|
||||
if (string.IsNullOrEmpty(OCIWindow))
|
||||
{
|
||||
OCIWindow = "Yes";
|
||||
}
|
||||
Pages.Options options = Pages.Options.Instance;
|
||||
options.InstallDirectory =
|
||||
BeatSaberInstallDirectory = Utils.GetInstallDir();
|
||||
|
@ -79,6 +84,7 @@ namespace ModAssistant
|
|||
|
||||
await ArgumentHandler(e.Args);
|
||||
await Init();
|
||||
options.UpdateOCIWindow(OCIWindow);
|
||||
}
|
||||
|
||||
private async Task Init()
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace ModAssistant.API
|
|||
|
||||
public static async Task<BeatSaverMap> GetFromKey(string Key, bool showNotification = true)
|
||||
{
|
||||
if (showNotification) OneClickInstaller.Status.Show();
|
||||
if (showNotification && App.OCIWindow != "No") OneClickInstaller.Status.Show();
|
||||
return await GetMap(Key, "key", showNotification);
|
||||
}
|
||||
|
||||
public static async Task<BeatSaverMap> GetFromHash(string Hash, bool showNotification = true)
|
||||
{
|
||||
if (showNotification) OneClickInstaller.Status.Show();
|
||||
if (showNotification && App.OCIWindow != "No") OneClickInstaller.Status.Show();
|
||||
return await GetMap(Hash, "hash", showNotification);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,19 @@ namespace ModAssistant.API
|
|||
|
||||
public static void SetMessage(string message)
|
||||
{
|
||||
if (App.window == null)
|
||||
if (App.OCIWindow != "No")
|
||||
{
|
||||
OneClickStatus.Instance.MainText = message;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindow.Instance.MainText = message;
|
||||
if (App.window == null)
|
||||
{
|
||||
if (App.OCIWindow == "No") OneClickStatus.Instance = null;
|
||||
if (OneClickStatus.Instance == null) return;
|
||||
|
||||
OneClickStatus.Instance.MainText = message;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindow.Instance.MainText = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ namespace ModAssistant
|
|||
await Playlist(uri);
|
||||
break;
|
||||
}
|
||||
if (App.OCIWindow == "Close")
|
||||
{
|
||||
await Task.Delay(3000);
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task BeatSaver(Uri uri)
|
||||
|
@ -38,14 +43,14 @@ namespace ModAssistant
|
|||
|
||||
private static async Task ModelSaber(Uri uri)
|
||||
{
|
||||
Status.Show();
|
||||
if (App.OCIWindow != "No") Status.Show();
|
||||
API.Utils.SetMessage($"{string.Format((string)Application.Current.FindResource("OneClick:Installing"), System.Web.HttpUtility.UrlDecode(uri.Segments.Last()))}");
|
||||
await API.ModelSaber.GetModel(uri);
|
||||
}
|
||||
|
||||
private static async Task Playlist(Uri uri)
|
||||
{
|
||||
Status.Show();
|
||||
if (App.OCIWindow != "No") Status.Show();
|
||||
await API.Playlists.DownloadAll(uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,10 @@
|
|||
<sys:String x:Key="Options:InstallingPlaylist">Installing Playlist: {0}</sys:String>
|
||||
<sys:String x:Key="Options:FailedPlaylistSong">Failed song: {0}</sys:String>
|
||||
<sys:String x:Key="Options:FinishedPlaylist">[{0} fails] Finished Installing Playlist: {1}</sys:String>
|
||||
<sys:String x:Key="Options:ShowOCIWindow">Show OneClick Installer Window</sys:String>
|
||||
<sys:String x:Key="Options:OCIWindowYes">Yes</sys:String>
|
||||
<sys:String x:Key="Options:OCIWindowClose">Close</sys:String>
|
||||
<sys:String x:Key="Options:OCIWindowNo">No</sys:String>
|
||||
<sys:String x:Key="Options:Diagnostics">Diagnostics</sys:String>
|
||||
<sys:String x:Key="Options:OpenLogsButton">Open Logs</sys:String>
|
||||
<sys:String x:Key="Options:OpenAppDataButton">Open AppData</sys:String>
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace ModAssistant
|
|||
public OneClickStatus()
|
||||
{
|
||||
InitializeComponent();
|
||||
Instance = this;
|
||||
Instance = App.OCIWindow != "No" ? this : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
Checked="SelectInstalled_Checked"
|
||||
IsChecked="{Binding SelectInstalledMods, Mode=TwoWay}"
|
||||
Unchecked="SelectInstalled_Unchecked" />
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="6"
|
||||
Margin="50,5,5,5"
|
||||
|
@ -224,6 +224,30 @@
|
|||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="9"
|
||||
Grid.ColumnSpan="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,5,10,5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Text="{DynamicResource Options:ShowOCIWindow}" />
|
||||
<ComboBox
|
||||
Margin="0,0,0,5"
|
||||
MinWidth="80"
|
||||
Name="ShowOCIWindowComboBox"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom"
|
||||
SelectionChanged="ShowOCIWindowComboBox_SelectionChanged">
|
||||
<ComboBoxItem Tag="Yes" Content="{DynamicResource Options:OCIWindowYes}" />
|
||||
<ComboBoxItem Tag="Close" Content="{DynamicResource Options:OCIWindowClose}" />
|
||||
<ComboBoxItem Tag="No" Content="{DynamicResource Options:OCIWindowNo}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="12"
|
||||
Margin="5"
|
||||
|
@ -305,7 +329,7 @@
|
|||
Click="InstallPlaylistButton_Click"
|
||||
Content="{DynamicResource Options:InstallPlaylist}" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="16"
|
||||
Margin="15,5,5,5"
|
||||
|
|
|
@ -30,11 +30,17 @@ namespace ModAssistant.Pages
|
|||
public bool PlaylistsProtocolHandlerEnabled { get; set; }
|
||||
public bool CloseWindowOnFinish { get; set; }
|
||||
public string LogURL { get; private set; }
|
||||
public string OCIWindow { get; set; }
|
||||
|
||||
public Options()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
OCIWindow = App.OCIWindow;
|
||||
if (!string.IsNullOrEmpty(OCIWindow))
|
||||
{
|
||||
UpdateOCIWindow(OCIWindow);
|
||||
}
|
||||
if (!CheckInstalledMods)
|
||||
{
|
||||
SelectInstalled.IsEnabled = false;
|
||||
|
@ -380,5 +386,32 @@ namespace ModAssistant.Pages
|
|||
Task.Run(() => { API.Playlists.DownloadFrom(playlistFile).Wait(); });
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowOCIWindowComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ComboBox comboBox = sender as ComboBox;
|
||||
if (comboBox.SelectedItem != null)
|
||||
{
|
||||
ComboBoxItem comboBoxItem = (ComboBoxItem)comboBox.SelectedItem;
|
||||
UpdateOCIWindow(comboBoxItem.Tag.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateOCIWindow(string state)
|
||||
{
|
||||
ComboBox comboBox = ShowOCIWindowComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
if (state == "Yes") comboBox.SelectedIndex = 0;
|
||||
else if (state == "Close") comboBox.SelectedIndex = 1;
|
||||
else if (state == "No") comboBox.SelectedIndex = 2;
|
||||
else return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(state))
|
||||
{
|
||||
OCIWindow = App.OCIWindow = Properties.Settings.Default.OCIWindow = state;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
ModAssistant/Properties/Settings.Designer.cs
generated
12
ModAssistant/Properties/Settings.Designer.cs
generated
|
@ -202,5 +202,17 @@ namespace ModAssistant.Properties {
|
|||
this["LanguageCode"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string OCIWindow {
|
||||
get {
|
||||
return ((string)(this["OCIWindow"]));
|
||||
}
|
||||
set {
|
||||
this["OCIWindow"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,5 +47,8 @@
|
|||
<Setting Name="LanguageCode" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="OCIWindow" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
Loading…
Reference in a new issue