mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-13 15:21:45 +01:00
Added: Open Wiki
This commit is contained in:
parent
79505ead2c
commit
e20e585426
@ -81,6 +81,7 @@
|
|||||||
<Compile Include="Services\APIService.cs" />
|
<Compile Include="Services\APIService.cs" />
|
||||||
<Compile Include="Services\APIService_New.cs" />
|
<Compile Include="Services\APIService_New.cs" />
|
||||||
<Compile Include="Services\APIServiceConnection.cs" />
|
<Compile Include="Services\APIServiceConnection.cs" />
|
||||||
|
<Compile Include="Services\BrowserService.cs" />
|
||||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||||
<Compile Include="Services\SecretStorage.cs" />
|
<Compile Include="Services\SecretStorage.cs" />
|
||||||
<Compile Include="Services\VersioningService.cs" />
|
<Compile Include="Services\VersioningService.cs" />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Borepin.Droid.Services;
|
using Borepin.Droid.Services;
|
||||||
using Borepin.Service;
|
using Borepin.Service;
|
||||||
|
using Borepin.Service.Browser;
|
||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using Borepin.Service.Versioning;
|
using Borepin.Service.Versioning;
|
||||||
using Prism;
|
using Prism;
|
||||||
@ -14,6 +15,7 @@ namespace Borepin.Droid
|
|||||||
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
||||||
containerRegistry.Register<ISecretStorageService, SecretStorage>();
|
containerRegistry.Register<ISecretStorageService, SecretStorage>();
|
||||||
containerRegistry.Register<IVersioningService, VersioningService>();
|
containerRegistry.Register<IVersioningService, VersioningService>();
|
||||||
|
containerRegistry.Register<IBrowserService, BrowserService>();
|
||||||
|
|
||||||
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
||||||
}
|
}
|
||||||
|
51
Borepin/Borepin.Android/Services/BrowserService.cs
Normal file
51
Borepin/Borepin.Android/Services/BrowserService.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Borepin.Service.Browser;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
|
namespace Borepin.Droid.Services
|
||||||
|
{
|
||||||
|
public class BrowserService : IBrowserService
|
||||||
|
{
|
||||||
|
private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
return new Xamarin.Essentials.BrowserLaunchOptions()
|
||||||
|
{
|
||||||
|
Flags = (Xamarin.Essentials.BrowserLaunchFlags)browserLaunchOptions.Flags,
|
||||||
|
LaunchMode = (Xamarin.Essentials.BrowserLaunchMode)browserLaunchOptions.LaunchMode,
|
||||||
|
PreferredControlColor = browserLaunchOptions.PreferredControlColor,
|
||||||
|
PreferredToolbarColor = browserLaunchOptions.PreferredToolbarColor,
|
||||||
|
TitleMode = (Xamarin.Essentials.BrowserTitleMode)browserLaunchOptions.TitleMode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public async Task OpenAsync(string uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -99,6 +99,7 @@
|
|||||||
<Compile Include="PlatformInitializer.cs" />
|
<Compile Include="PlatformInitializer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\APIService.cs" />
|
<Compile Include="Services\APIService.cs" />
|
||||||
|
<Compile Include="Services\BrowserService.cs" />
|
||||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||||
<Compile Include="Services\SecretStorageService.cs" />
|
<Compile Include="Services\SecretStorageService.cs" />
|
||||||
<Compile Include="Services\VersioningService.cs" />
|
<Compile Include="Services\VersioningService.cs" />
|
||||||
|
@ -4,6 +4,7 @@ using Prism.Ioc;
|
|||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using Borepin.Service.Versioning;
|
using Borepin.Service.Versioning;
|
||||||
using Borepin.Service;
|
using Borepin.Service;
|
||||||
|
using Borepin.Service.Browser;
|
||||||
|
|
||||||
namespace Borepin.UWP
|
namespace Borepin.UWP
|
||||||
{
|
{
|
||||||
@ -14,6 +15,7 @@ namespace Borepin.UWP
|
|||||||
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
||||||
containerRegistry.Register<ISecretStorageService, SecretStorageService>();
|
containerRegistry.Register<ISecretStorageService, SecretStorageService>();
|
||||||
containerRegistry.Register<IVersioningService, VersioningService>();
|
containerRegistry.Register<IVersioningService, VersioningService>();
|
||||||
|
containerRegistry.Register<IBrowserService, BrowserService>();
|
||||||
|
|
||||||
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
||||||
}
|
}
|
||||||
|
51
Borepin/Borepin.UWP/Services/BrowserService.cs
Normal file
51
Borepin/Borepin.UWP/Services/BrowserService.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Borepin.Service.Browser;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
|
namespace Borepin.UWP.Services
|
||||||
|
{
|
||||||
|
public class BrowserService : IBrowserService
|
||||||
|
{
|
||||||
|
private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
return new Xamarin.Essentials.BrowserLaunchOptions()
|
||||||
|
{
|
||||||
|
Flags = (Xamarin.Essentials.BrowserLaunchFlags)browserLaunchOptions.Flags,
|
||||||
|
LaunchMode = (Xamarin.Essentials.BrowserLaunchMode)browserLaunchOptions.LaunchMode,
|
||||||
|
PreferredControlColor = browserLaunchOptions.PreferredControlColor,
|
||||||
|
PreferredToolbarColor = browserLaunchOptions.PreferredToolbarColor,
|
||||||
|
TitleMode = (Xamarin.Essentials.BrowserTitleMode)browserLaunchOptions.TitleMode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public async Task OpenAsync(string uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -82,6 +82,7 @@
|
|||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<Compile Include="AppDelegate.cs" />
|
<Compile Include="AppDelegate.cs" />
|
||||||
<Compile Include="Services\APIService.cs" />
|
<Compile Include="Services\APIService.cs" />
|
||||||
|
<Compile Include="Services\BrowserService.cs" />
|
||||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||||
<Compile Include="Services\SecretStorageService.cs" />
|
<Compile Include="Services\SecretStorageService.cs" />
|
||||||
<Compile Include="Services\VersioningService.cs" />
|
<Compile Include="Services\VersioningService.cs" />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Borepin.iOS.Services;
|
using Borepin.iOS.Services;
|
||||||
using Borepin.Service;
|
using Borepin.Service;
|
||||||
|
using Borepin.Service.Browser;
|
||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using Borepin.Service.Versioning;
|
using Borepin.Service.Versioning;
|
||||||
using Prism;
|
using Prism;
|
||||||
@ -14,6 +15,7 @@ namespace Borepin.iOS
|
|||||||
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
containerRegistry.Register<IPreferenceStorageService, PreferenceStorageService>();
|
||||||
containerRegistry.Register<ISecretStorageService, SecretStorageService>();
|
containerRegistry.Register<ISecretStorageService, SecretStorageService>();
|
||||||
containerRegistry.Register<IVersioningService, VersioningService>();
|
containerRegistry.Register<IVersioningService, VersioningService>();
|
||||||
|
containerRegistry.Register<IBrowserService, BrowserService>();
|
||||||
|
|
||||||
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
containerRegistry.RegisterSingleton<IAPIService, APIService>();
|
||||||
}
|
}
|
||||||
|
51
Borepin/Borepin.iOS/Services/BrowserService.cs
Normal file
51
Borepin/Borepin.iOS/Services/BrowserService.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Borepin.Service.Browser;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
|
namespace Borepin.iOS.Services
|
||||||
|
{
|
||||||
|
public class BrowserService : IBrowserService
|
||||||
|
{
|
||||||
|
private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
return new Xamarin.Essentials.BrowserLaunchOptions()
|
||||||
|
{
|
||||||
|
Flags = (Xamarin.Essentials.BrowserLaunchFlags)browserLaunchOptions.Flags,
|
||||||
|
LaunchMode = (Xamarin.Essentials.BrowserLaunchMode)browserLaunchOptions.LaunchMode,
|
||||||
|
PreferredControlColor = browserLaunchOptions.PreferredControlColor,
|
||||||
|
PreferredToolbarColor = browserLaunchOptions.PreferredToolbarColor,
|
||||||
|
TitleMode = (Xamarin.Essentials.BrowserTitleMode)browserLaunchOptions.TitleMode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public async Task OpenAsync(string uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchMode browserLaunchMode)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, (Xamarin.Essentials.BrowserLaunchMode)browserLaunchMode).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions)
|
||||||
|
{
|
||||||
|
await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,6 +26,7 @@ namespace Borepin.Model
|
|||||||
//Space = new SpaceVisualize(_Machine.Space);
|
//Space = new SpaceVisualize(_Machine.Space);
|
||||||
Name = _Machine.Name;
|
Name = _Machine.Name;
|
||||||
Description = _Machine.Description;
|
Description = _Machine.Description;
|
||||||
|
Wiki = _Machine.Wiki;
|
||||||
State = _Machine.State;
|
State = _Machine.State;
|
||||||
|
|
||||||
if(_Machine.Manager.Just != null)
|
if(_Machine.Manager.Just != null)
|
||||||
@ -106,6 +107,13 @@ namespace Borepin.Model
|
|||||||
set => SetProperty(ref _Description, value);
|
set => SetProperty(ref _Description, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _Wiki;
|
||||||
|
public string Wiki
|
||||||
|
{
|
||||||
|
get => _Wiki;
|
||||||
|
set => SetProperty(ref _Wiki, value);
|
||||||
|
}
|
||||||
|
|
||||||
private MachineState _State;
|
private MachineState _State;
|
||||||
public MachineState State
|
public MachineState State
|
||||||
{
|
{
|
||||||
|
@ -22,31 +22,38 @@
|
|||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<Grid IsVisible="{Binding IsConnected}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackLayout Grid.Row="0">
|
||||||
<Label Text="{Binding MachineItem.Name}" Style="{StaticResource LabelStyle_Title}"/>
|
<Label Text="{Binding MachineItem.Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||||
<Label Text="{Binding MachineItem.Description}" Style="{StaticResource Style_Label_Text_Center}"/>
|
<Label Text="{Binding MachineItem.Description}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||||
<StackLayout IsVisible="{Binding MachineItem.CanUse}">
|
<StackLayout Orientation="Horizontal" IsVisible="{Binding MachineItem.CurrentUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
||||||
<Button Text="{x:Static resource_text:TextResource.MachinePage_Use}" Command="{Binding UseMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout IsVisible="{Binding MachineItem.CanNotUseByPermission}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_CanNotUseByPermission}" Style="{StaticResource Style_Label_Text_Center}"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout IsVisible="{Binding MachineItem.CanInUse}">
|
|
||||||
<Button Text="{x:Static resource_text:TextResource.MachinePage_GiveBack}" Command="{Binding GiveBackMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout IsVisible="{Binding MachineItem.CurrentUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_CurrentUser}" Style="{StaticResource Style_Label_Property_Title}"/>
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_CurrentUser}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||||
<Label Text="{Binding MachineItem.CurrentUser.Username}" Style="{StaticResource Style_Label_Property_Text}"/>
|
<Label Text="{Binding MachineItem.CurrentUser.Username}" Style="{StaticResource Style_Label_Property_Text}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding MachineItem.LastUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_LastUser}" Style="{StaticResource Style_Label_Property_Title}"/>
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_Use}" IsVisible="{Binding MachineItem.CanUse}" Command="{Binding UseMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
<Label Text="{Binding MachineItem.LastUser.Username}" Style="{StaticResource Style_Label_Property_Text}"/>
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_CanNotUseByPermission}" IsVisible="{Binding MachineItem.CanNotUseByPermission}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||||
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_GiveBack}" IsVisible="{Binding MachineItem.CanInUse}" Command="{Binding GiveBackMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding MachineItem.CanManage}">
|
<StackLayout Grid.Row="1" VerticalOptions="End">
|
||||||
|
<Button VerticalOptions="End" Text="{x:Static resource_text:TextResource.MachinePage_OpenWiki}" IsVisible="{Binding MachineItem.Wiki, Converter={StaticResource IsNotNullBoolConverter}}" Command="{Binding OpenWikiCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Grid.Row="2" VerticalOptions="End" IsVisible="{Binding MachineItem.CanManage}">
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_ManageMachine}" Style="{StaticResource Style_Label_Property_Title}"/>
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_ManageMachine}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||||
|
<StackLayout Margin="10, 0, 0, 20" Orientation="Horizontal" IsVisible="{Binding MachineItem.LastUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
||||||
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_LastUser}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||||
|
<Label Text="{Binding MachineItem.LastUser.Username}" Style="{StaticResource Style_Label_Property_Text}" Margin="10, 0, 0, 0"/>
|
||||||
|
</StackLayout>
|
||||||
<Button Text="{x:Static resource_text:TextResource.MachinePage_ForceFree}" Command="{Binding ForceFreeMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_ForceFree}" Command="{Binding ForceFreeMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_ForceBlock}" Command="{Binding ForceBlockMachineCommand}" Style="{StaticResource Style_Button_Admin}"/>
|
||||||
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_ForceDisable}" Command="{Binding ForceDisableMachineCommand}" Style="{StaticResource Style_Button_Admin}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</Grid>
|
||||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
|
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
@ -10,6 +10,7 @@ using Borepin.Service;
|
|||||||
using Borepin.Base.Exceptions;
|
using Borepin.Base.Exceptions;
|
||||||
using Capnp.Rpc;
|
using Capnp.Rpc;
|
||||||
using System;
|
using System;
|
||||||
|
using Borepin.Service.Browser;
|
||||||
|
|
||||||
namespace Borepin.PageModel
|
namespace Borepin.PageModel
|
||||||
{
|
{
|
||||||
@ -18,14 +19,20 @@ namespace Borepin.PageModel
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
private string _ID;
|
private string _ID;
|
||||||
private Machine _Machine;
|
private Machine _Machine;
|
||||||
|
private IBrowserService _BrowserService;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Contructors
|
#region Contructors
|
||||||
public MachinePageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
public MachinePageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, IBrowserService browserService) : base(navigationService, pageDialogService, apiService)
|
||||||
{
|
{
|
||||||
|
_BrowserService = browserService;
|
||||||
|
|
||||||
UseMachineCommand = new DelegateCommand(UseMachineCommandExecute);
|
UseMachineCommand = new DelegateCommand(UseMachineCommandExecute);
|
||||||
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecute);
|
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecute);
|
||||||
ForceFreeMachineCommand = new DelegateCommand(ForceFreeMachineCommandExecute);
|
ForceFreeMachineCommand = new DelegateCommand(ForceFreeMachineCommandExecute);
|
||||||
|
ForceBlockMachineCommand = new DelegateCommand(ForceBlockMachineCommandExecute);
|
||||||
|
ForceDisableMachineCommand = new DelegateCommand(ForceDisableMachineCommandExecute);
|
||||||
|
OpenWikiCommand = new DelegateCommand(OpenWikiCommandExecute);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -149,6 +156,86 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICommand _ForceBlockMachineCommand;
|
||||||
|
public ICommand ForceBlockMachineCommand
|
||||||
|
{
|
||||||
|
get => _ForceBlockMachineCommand;
|
||||||
|
set => SetProperty(ref _ForceBlockMachineCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void ForceBlockMachineCommandExecute()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
if (_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Machine.IManageInterface manageInterface = _Machine.Manage;
|
||||||
|
|
||||||
|
await manageInterface.Block().ConfigureAwait(false);
|
||||||
|
await LoadAPIData().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
Log.Debug("RPC Connection Loss");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _ForceDisableMachineCommand;
|
||||||
|
public ICommand ForceDisableMachineCommand
|
||||||
|
{
|
||||||
|
get => _ForceDisableMachineCommand;
|
||||||
|
set => SetProperty(ref _ForceDisableMachineCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void ForceDisableMachineCommandExecute()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
if (_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Machine.IManageInterface manageInterface = _Machine.Manage;
|
||||||
|
|
||||||
|
await manageInterface.Disabled().ConfigureAwait(false);
|
||||||
|
await LoadAPIData().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
Log.Debug("RPC Connection Loss");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _OpenWikiCommand;
|
||||||
|
public ICommand OpenWikiCommand
|
||||||
|
{
|
||||||
|
get => _OpenWikiCommand;
|
||||||
|
set => SetProperty(ref _OpenWikiCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void OpenWikiCommandExecute()
|
||||||
|
{
|
||||||
|
if(_Machine != null && _Machine.Wiki != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _BrowserService.OpenAsync(_Machine.Wiki).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//TODO: Do something
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,25 @@ namespace Borepin.Resources.Text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Force Free.
|
/// Looks up a localized string similar to Block Machine.
|
||||||
|
/// </summary>
|
||||||
|
internal static string MachinePage_ForceBlock {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MachinePage_ForceBlock", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Disable Machine.
|
||||||
|
/// </summary>
|
||||||
|
internal static string MachinePage_ForceDisable {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MachinePage_ForceDisable", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Free Machine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string MachinePage_ForceFree {
|
internal static string MachinePage_ForceFree {
|
||||||
get {
|
get {
|
||||||
@ -405,6 +423,15 @@ namespace Borepin.Resources.Text {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Open Wiki.
|
||||||
|
/// </summary>
|
||||||
|
internal static string MachinePage_OpenWiki {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MachinePage_OpenWiki", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Use.
|
/// Looks up a localized string similar to Use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -222,8 +222,14 @@ Ask in your Space if you can be trained on the machine to be unlocked for the ma
|
|||||||
<data name="MachinePage_CurrentUser" xml:space="preserve">
|
<data name="MachinePage_CurrentUser" xml:space="preserve">
|
||||||
<value>Current User:</value>
|
<value>Current User:</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MachinePage_ForceBlock" xml:space="preserve">
|
||||||
|
<value>Block Machine</value>
|
||||||
|
</data>
|
||||||
|
<data name="MachinePage_ForceDisable" xml:space="preserve">
|
||||||
|
<value>Disable Machine</value>
|
||||||
|
</data>
|
||||||
<data name="MachinePage_ForceFree" xml:space="preserve">
|
<data name="MachinePage_ForceFree" xml:space="preserve">
|
||||||
<value>Force Free</value>
|
<value>Free Machine</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="MachinePage_GiveBack" xml:space="preserve">
|
<data name="MachinePage_GiveBack" xml:space="preserve">
|
||||||
<value>GiveBack</value>
|
<value>GiveBack</value>
|
||||||
@ -234,6 +240,9 @@ Ask in your Space if you can be trained on the machine to be unlocked for the ma
|
|||||||
<data name="MachinePage_ManageMachine" xml:space="preserve">
|
<data name="MachinePage_ManageMachine" xml:space="preserve">
|
||||||
<value>Manage Machine:</value>
|
<value>Manage Machine:</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MachinePage_OpenWiki" xml:space="preserve">
|
||||||
|
<value>Open Wiki</value>
|
||||||
|
</data>
|
||||||
<data name="MachinePage_Use" xml:space="preserve">
|
<data name="MachinePage_Use" xml:space="preserve">
|
||||||
<value>Use</value>
|
<value>Use</value>
|
||||||
</data>
|
</data>
|
||||||
|
10
Borepin/Borepin/Service/Browser/BrowserLaunchFlags.cs
Normal file
10
Borepin/Borepin/Service/Browser/BrowserLaunchFlags.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Borepin.Service.Browser
|
||||||
|
{
|
||||||
|
public enum BrowserLaunchFlags
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
LaunchAdjacent = 1,
|
||||||
|
PresentAsPageSheet = 2,
|
||||||
|
PresentAsFormSheet = 4,
|
||||||
|
}
|
||||||
|
}
|
8
Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs
Normal file
8
Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Borepin.Service.Browser
|
||||||
|
{
|
||||||
|
public enum BrowserLaunchMode
|
||||||
|
{
|
||||||
|
SystemPreferred = 0,
|
||||||
|
External = 1
|
||||||
|
}
|
||||||
|
}
|
14
Borepin/Borepin/Service/Browser/BrowserLaunchOptions.cs
Normal file
14
Borepin/Borepin/Service/Browser/BrowserLaunchOptions.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Borepin.Service.Browser
|
||||||
|
{
|
||||||
|
public class BrowserLaunchOptions
|
||||||
|
{
|
||||||
|
public BrowserLaunchFlags Flags;
|
||||||
|
public BrowserLaunchMode LaunchMode;
|
||||||
|
public Nullable<Color> PreferredControlColor;
|
||||||
|
public Nullable<Color> PreferredToolbarColor;
|
||||||
|
public BrowserTitleMode TitleMode;
|
||||||
|
}
|
||||||
|
}
|
9
Borepin/Borepin/Service/Browser/BrowserTitleMode.cs
Normal file
9
Borepin/Borepin/Service/Browser/BrowserTitleMode.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Borepin.Service.Browser
|
||||||
|
{
|
||||||
|
public enum BrowserTitleMode
|
||||||
|
{
|
||||||
|
Default = 0,
|
||||||
|
Show = 1,
|
||||||
|
Hide = 2
|
||||||
|
}
|
||||||
|
}
|
17
Borepin/Borepin/Service/Browser/IBrowserService.cs
Normal file
17
Borepin/Borepin/Service/Browser/IBrowserService.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Borepin.Service.Browser
|
||||||
|
{
|
||||||
|
public interface IBrowserService
|
||||||
|
{
|
||||||
|
Task OpenAsync(string uri);
|
||||||
|
Task OpenAsync(string uri, BrowserLaunchMode browserLaunchMode);
|
||||||
|
Task OpenAsync(string uri, BrowserLaunchOptions browserLaunchOptions);
|
||||||
|
Task OpenAsync(Uri uri);
|
||||||
|
Task OpenAsync(Uri uri, BrowserLaunchMode browserLaunchMode);
|
||||||
|
Task OpenAsync(Uri uri, BrowserLaunchOptions browserLaunchOptions);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user