Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RickDB authored and RickDB committed Dec 29, 2016
2 parents ac21262 + 1242b2e commit a5a3445
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 2 deletions.
11 changes: 9 additions & 2 deletions JMMServer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,15 @@
</StackPanel>
</Button>



<!-- Launch Web UI -->
<Button Margin="2,10,2,2" Style="{DynamicResource FlatButtonStyle}" Name="btnLaunchWebUI"
HorizontalAlignment="Left" IsEnabled="True" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock VerticalAlignment="Center"
Text="{Resx ResxName=JMMServer.Properties.Resources, Key=Settings_WebUI}"
Margin="0,0,5,0" />
</StackPanel>
</Button>

</StackPanel>
</TabItem>
Expand Down
49 changes: 49 additions & 0 deletions JMMServer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using Microsoft.Win32.TaskScheduler;
using Nancy.Hosting.Self;
using Action = System.Action;
using System.Net.NetworkInformation;

namespace JMMServer
{
Expand Down Expand Up @@ -253,6 +254,7 @@ public MainWindow()
btnSyncTrakt.Click += new RoutedEventHandler(btnSyncTrakt_Click);
btnImportManualLinks.Click += new RoutedEventHandler(btnImportManualLinks_Click);
btnUpdateAniDBInfo.Click += new RoutedEventHandler(btnUpdateAniDBInfo_Click);
btnLaunchWebUI.Click += new RoutedEventHandler(btnLaunchWebUI_Click);
btnUpdateImages.Click += new RoutedEventHandler(btnUpdateImages_Click);
btnUploadAzureCache.Click += new RoutedEventHandler(btnUploadAzureCache_Click);
btnUpdateTraktInfo.Click += BtnUpdateTraktInfo_Click;
Expand Down Expand Up @@ -2077,6 +2079,53 @@ private void CommandBinding_ScanFolder(object sender, ExecutedRoutedEventArgs e)
}
}

void btnLaunchWebUI_Click(object sender, RoutedEventArgs e)
{
try
{
string IP = GetLocalIPv4(NetworkInterfaceType.Ethernet);
if (string.IsNullOrEmpty(IP))
IP = "127.0.0.1";

string url = $"http://{IP}:{ServerSettings.JMMServerPort}";
Process.Start(url);
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
}
}

internal static string GetLocalIPv4(NetworkInterfaceType _type)
{
string output = "";
foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
{
if (item.NetworkInterfaceType == _type && item.OperationalStatus == OperationalStatus.Up)
{
IPInterfaceProperties adapterProperties = item.GetIPProperties();

if (adapterProperties.GatewayAddresses.FirstOrDefault() != null)
{
foreach (UnicastIPAddressInformation ip in adapterProperties.UnicastAddresses)
{
if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
output = ip.Address.ToString();
}
}
}
}
}

return output;
}

private void MsgBox(Func<NetworkInterfaceType, string> getLocalIPv4)
{
throw new NotImplementedException();
}

void btnUpdateAniDBInfo_Click(object sender, RoutedEventArgs e)
{
try
Expand Down
9 changes: 9 additions & 0 deletions JMMServer/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ Du kannst nur einen Ordner aufgeführt als Drop-Ziel haben.</value>
<data name="Update_Available" xml:space="preserve">
<value>Update verfügbar für Shoko Server!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Starten Sie WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.en-GB.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ You can only have one folder listed as a Drop Destination.</value>
<data name="Update_Available" xml:space="preserve">
<value>Update Available For Shoko Server!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Launch WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ Sólo puede tener una carpeta que aparece como un destino de la gota.</value>
<data name="Update_Available" xml:space="preserve">
<value>¡Actualización disponible para el servidor de Shoko!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Lanzamiento de WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ Vous ne pouvez avoir qu'un seul dossier répertorié comme une Destination de Dr
<data name="Update_Available" xml:space="preserve">
<value>Mise à disposition pour serveur Shoko !</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Lancer le WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ Si può avere solo una cartella elencata come una destinazione di Drop.</value>
<data name="Update_Available" xml:space="preserve">
<value>Aggiornamento disponibile per Server di Shoko!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Lanciare la WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.nl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ U kunt slechts één map vermeld als een Drop bestemming hebben.</value>
<data name="Update_Available" xml:space="preserve">
<value>Update beschikbaar voor Shoko Server!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Lancering WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@ Możesz skonfigurować tylko jeden folder docelowym.</value>
<data name="Update_Available" xml:space="preserve">
<value>Aktualizacja dla serwera Shoko!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Uruchom WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.pt.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@
<data name="Update_Available" xml:space="preserve">
<value>Atualização disponível para o servidor de Shoko!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Lançar o WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1232,4 +1232,7 @@ You can only have one folder listed as a Drop Destination.</value>
<data name="Update_Available" xml:space="preserve">
<value>Update Available For Shoko Server!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Launch WebUI</value>
</data>
</root>
3 changes: 3 additions & 0 deletions JMMServer/Properties/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,7 @@
<data name="Update_Available" xml:space="preserve">
<value>Доступно обновление для сервера Сёко!</value>
</data>
<data name="Settings_WebUI" xml:space="preserve">
<value>Запуск WebUI</value>
</data>
</root>

0 comments on commit a5a3445

Please sign in to comment.