diff --git a/BeWoLauncher/.vs/BeWoLauncher/v15/.suo b/BeWoLauncher/.vs/BeWoLauncher/v15/.suo new file mode 100644 index 000000000..adb6ea2a5 Binary files /dev/null and b/BeWoLauncher/.vs/BeWoLauncher/v15/.suo differ diff --git a/BeWoLauncher/.vs/ProjectSettings.json b/BeWoLauncher/.vs/ProjectSettings.json new file mode 100644 index 000000000..f8b488856 --- /dev/null +++ b/BeWoLauncher/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/BeWoLauncher/.vs/VSWorkspaceState.json b/BeWoLauncher/.vs/VSWorkspaceState.json new file mode 100644 index 000000000..6b6114114 --- /dev/null +++ b/BeWoLauncher/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/BeWoLauncher/.vs/slnx.sqlite b/BeWoLauncher/.vs/slnx.sqlite new file mode 100644 index 000000000..c5b7a9364 Binary files /dev/null and b/BeWoLauncher/.vs/slnx.sqlite differ diff --git a/BeWoLauncher/App.config b/BeWoLauncher/App.config new file mode 100644 index 000000000..eb846d046 --- /dev/null +++ b/BeWoLauncher/App.config @@ -0,0 +1,69 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + \ No newline at end of file diff --git a/BeWoLauncher/BeWoLauncher.csproj b/BeWoLauncher/BeWoLauncher.csproj new file mode 100644 index 000000000..dc5809e13 --- /dev/null +++ b/BeWoLauncher/BeWoLauncher.csproj @@ -0,0 +1,464 @@ + + + + + Debug + AnyCPU + {E3BA193A-A64F-4CE6-91BE-F54E551797BE} + WinExe + BeWoLauncher + BeWoLauncher + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + false + D:\Test\Launcher\ + true + Disk + false + Foreground + 7 + Days + false + false + true + true + 1 + 1.0.0.%2a + false + true + true + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + Auto + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + BeWoPlaner.ico + + + F47E9EA636ECD1D899058A03A3946362A6DA6EE5 + + + BeWoLauncher_1_TemporaryKey.pfx + + + true + + + false + + + + False + + + + + + + + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + + ConfirmDemoDialog.xaml + + + MessageDialog.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InfoFrame.xaml + + + LoadingFrame.xaml + + + ProgressFrame.xaml + + + FrameView.xaml + + + InstallInfoFrame.xaml + + + UpdateInfoFrame.xaml + + + UninstallInfoFrame.xaml + + + + + + PasswortAenderungsView.xaml + + + + PopUpWindow.xaml + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + LauncherApp.xaml + Code + + + + EnterTenantDialog.xaml + + + ProfileEditView.xaml + + + + + + + + + + + ExceptionMessageBox.xaml + + + LoginView.xaml + + + ProxyLoginView.xaml + + + PwVergessenView.xaml + + + WaitLayer2.xaml + + + LauncherWindow.xaml + Code + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 + false + + + + + {efe05c79-e0dd-4311-8b90-a8da7ebdf36f} + SharedLauncher + True + + + + + \ No newline at end of file diff --git a/BeWoLauncher/BeWoLauncher.csproj.user b/BeWoLauncher/BeWoLauncher.csproj.user new file mode 100644 index 000000000..13190cfb4 --- /dev/null +++ b/BeWoLauncher/BeWoLauncher.csproj.user @@ -0,0 +1,17 @@ + + + + D:\Test\Launcher\|publish\ + + + + + + de-DE + false + ProjectFiles + + + false + + \ No newline at end of file diff --git a/BeWoLauncher/BeWoPlaner.ico b/BeWoLauncher/BeWoPlaner.ico new file mode 100644 index 000000000..22ca7720a Binary files /dev/null and b/BeWoLauncher/BeWoPlaner.ico differ diff --git a/BeWoLauncher/LauncherApp.xaml b/BeWoLauncher/LauncherApp.xaml new file mode 100644 index 000000000..964c727df --- /dev/null +++ b/BeWoLauncher/LauncherApp.xaml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/BeWoLauncher/LauncherApp.xaml.cs b/BeWoLauncher/LauncherApp.xaml.cs new file mode 100644 index 000000000..37515ed1d --- /dev/null +++ b/BeWoLauncher/LauncherApp.xaml.cs @@ -0,0 +1,97 @@ +using BeWoLauncher.Components; +using BeWoLauncher.Logic; +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.ServiceProxy; +using BeWoLauncher.WindowImp; +using BS.SharedLauncher; +using BS.SharedLauncher.Information; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Pipes; +using System.Linq; +using System.Reflection; +using System.Security.Policy; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using System.Xml; + +namespace BeWoLauncher +{ + /// + /// Interaktionslogik für "App.xaml" + /// + public partial class LauncherApp : Application + { + public static string ShortVersion => "3"; + public static string Version => "Version 3.0"; + + public LauncherApp() + { + + } + + protected override void OnStartup(StartupEventArgs e) + { + MainWindow = new LauncherWindow(); + MainWindow.Show(); + + base.OnStartup(e); + + ProcessController.StartLauncher(); + + Dispatcher.UnhandledException += (s, ex) + => + { + if (ex.Exception == null || String.IsNullOrEmpty(ex.Exception.Message) || + (!ex.Exception.ToString().Contains("DevExpress.Xpf.Bars.Customization.CustomizationControl.OnLoaded") + && !ex.Exception.ToString().Contains("DevExpress.Xpf.Grid.Native.SelectionStrategyCellBase.IsCellSelected"))) + + { + ShowError("Unbehandelter Fehler", ex.Exception, true); + } + ex.Handled = true; + }; + + FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); + } + + + private void Application_Exit(object sender, ExitEventArgs e) + { + ProcessController.KillPlanerProcess(); + } + + #region ShowError + + public static void ShowError(Exception ex) => ShowError(null, ex, true); + public static void ShowError(string message, Exception ex, bool showDetails) + { + ShowError(message, ex.ToString(), showDetails); + } + public static void ShowError(string message, string ex, bool showDetails) + { + if (ViewController.CurrentWindow is null) + { + MessageBox.Show(ex, message); + } + else + { + ViewController.CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => + ViewController.CurrentWindow.ShowControlAsModalPopUp(new ExceptionMessageBox(message, ex, showDetails)))); + } + } + + #endregion + } +} diff --git a/BeWoLauncher/LauncherGeneratedNeuErstellen.lnk b/BeWoLauncher/LauncherGeneratedNeuErstellen.lnk new file mode 100644 index 000000000..47751bf9a Binary files /dev/null and b/BeWoLauncher/LauncherGeneratedNeuErstellen.lnk differ diff --git a/BeWoLauncher/LauncherServiceReferences.bat b/BeWoLauncher/LauncherServiceReferences.bat new file mode 100644 index 000000000..763400846 --- /dev/null +++ b/BeWoLauncher/LauncherServiceReferences.bat @@ -0,0 +1 @@ +svcutil.exe /noConfig /edb /n:*,BeWoLauncher.ServiceProxy /out:ServiceProxy\LauncherGenerated.cs /ct:System.Collections.Generic.List`1 /r:..\SharedLauncher\bin\Debug\BS.SharedLauncher.dll http://localhost:3778/LauncherService.svc?wsdl http://localhost:3778/EnumTranslationService.svc?wsdl http://localhost:3778/DownloadBeWoService.svc?wsdl \ No newline at end of file diff --git a/BeWoLauncher/LauncherWindow.xaml b/BeWoLauncher/LauncherWindow.xaml new file mode 100644 index 000000000..8f5f7dabf --- /dev/null +++ b/BeWoLauncher/LauncherWindow.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/BeWoLauncher/LauncherWindow.xaml.cs b/BeWoLauncher/LauncherWindow.xaml.cs new file mode 100644 index 000000000..2f9c05b6e --- /dev/null +++ b/BeWoLauncher/LauncherWindow.xaml.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Threading; +using BeWoLauncher.Components; +using BeWoLauncher.Logic.Controller; + +namespace BeWoLauncher +{ + public partial class LauncherWindow : Window + { + private readonly Stack _ModalPopUpControls; + private Control _CurrentModalPopUp; + private Grid _ModalPopUpBackGround; + private WaitLayer2 _WaitLayer; + + public LauncherWindow() + { + InitializeComponent(); + + _ModalPopUpControls = new Stack(); + + ViewController.InitWindow(this); + + ViewController.StartView(); + } + + private void MainWindow_OnClosing(object s, CancelEventArgs e) + { + ProcessController.StartLauncherShutdown(); + } + private void RootGrid_SizeChanged(object sender, SizeChangedEventArgs e) + { + double top = (rootGrid.ActualHeight - 400) / 3; + rootGrid.Margin = new Thickness(0, top, 0, 0); + } + + private void ShowModalBackground() + { + _ModalPopUpBackGround = new Grid(); + _ModalPopUpBackGround.IsHitTestVisible = true; + _ModalPopUpBackGround.Background = Brushes.White; + _ModalPopUpBackGround.Opacity = .5; + Grid.SetColumnSpan(_ModalPopUpBackGround, 3); + Grid.SetRowSpan(_ModalPopUpBackGround, 3); + rootGrid.Children.Add(_ModalPopUpBackGround); + Panel.SetZIndex(_ModalPopUpBackGround, int.MaxValue - 1); + } + public void ShowControlAsModalPopUp(Control control) + { + ShowControlAsModalPopUp(control, HorizontalAlignment.Center, VerticalAlignment.Center); + } + public void ShowControlAsModalPopUp(Control control, HorizontalAlignment ha, VerticalAlignment va) + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, + (Action)delegate + { + if (_CurrentModalPopUp != null) + { + rootGrid.Children.Remove(_CurrentModalPopUp); + _ModalPopUpControls.Push(_CurrentModalPopUp); + } + else + { + this.ShowModalBackground(); + } + + _CurrentModalPopUp = control; + control.HorizontalAlignment = ha; + control.VerticalAlignment = va; + Grid.SetColumnSpan(control, 3); + Grid.SetRowSpan(control, 3); + this.rootGrid.Children.Add(control); + Panel.SetZIndex(control, int.MaxValue); + }); + } + public void CloseCurrentPopUp() + { + if (_ModalPopUpBackGround != null) + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, + (Action)delegate + { + rootGrid.Children.Remove(_CurrentModalPopUp); + _CurrentModalPopUp = null; + if (_ModalPopUpControls.Count == 0) + { + rootGrid.Children.Remove(_ModalPopUpBackGround); + _ModalPopUpBackGround = null; + } + else + { + var control = this._ModalPopUpControls.Pop(); + _CurrentModalPopUp = control; + rootGrid.Children.Add(control); + Panel.SetZIndex(control, int.MaxValue); + } + }); + } + } + public void StartWaiting() + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, + (Action)delegate + { + if (_WaitLayer == null) + { + _WaitLayer = new WaitLayer2(); + _WaitLayer.HorizontalAlignment = HorizontalAlignment.Center; + _WaitLayer.VerticalAlignment = VerticalAlignment.Center; + rootGrid2.Children.Add(_WaitLayer); + Panel.SetZIndex(_WaitLayer, int.MaxValue); + _WaitLayer.Dispatcher.Invoke(DispatcherPriority.Render, (Action)delegate () { }); + } + }); + } + public void EndWaiting() + { + Dispatcher.BeginInvoke( + DispatcherPriority.Normal, + (Action)delegate + { + if (_WaitLayer != null) + { + rootGrid2.Children.Remove(_WaitLayer); + _WaitLayer = null; + } + }); + } + + public void SetMainContent(UserControl main) + { + rootGrid.Children.Clear(); + rootGrid.Children.Add(main); + } + + private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == System.Windows.Input.Key.Delete) + { + ViewController.LaunchBehavior.UninstallMode = true; + } + } + + private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == System.Windows.Input.Key.Delete) + { + ViewController.LaunchBehavior.UninstallMode = false; + } + } + } +} diff --git a/BeWoLauncher/Logic/Behavior/LaunchBehavior.cs b/BeWoLauncher/Logic/Behavior/LaunchBehavior.cs new file mode 100644 index 000000000..b73713f01 --- /dev/null +++ b/BeWoLauncher/Logic/Behavior/LaunchBehavior.cs @@ -0,0 +1,88 @@ +using BeWoLauncher.Components; +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.Logic.Utils; +using BS.SharedLauncher.Extensions; +using BS.SharedLauncher.Information; +using System; +using System.Threading.Tasks; +using static BeWoLauncher.Logic.Controller.ViewController; + +namespace BeWoLauncher.Logic.Behavior +{ + public class LaunchBehavior + { + public bool UninstallMode { get; set; } + + public LaunchBehavior() + { + + } + + public void LoginSuccessful() + { + #region confirm demo +#if DEBUG + //if (ConnectionInformation.Tenant == "demo") + //{ + // var dlg = new ConfirmDemoDialog(); + // dlg.ShowDialog(); + //} +#else + if (ConnectionInformation.Tenant == "demo") + { + var dlg = new ConfirmDemoDialog(); + dlg.ShowDialog(); + } +#endif + #endregion + + + + var path = LauncherPaths.GetInstallLocationFromSetting(); + + LauncherPaths.ActualPlanerLocation = path; + + if (path is string && !string.IsNullOrWhiteSpace(path) && !CheckForPermissions(path)) + { + ViewBehavior.ShowFrame(FrameType.NoPermissionInfo); + EndWaiting(); + } + else + { + if (UninstallMode) + ViewBehavior.ShowUninstallInfo(); + else + Task.Run(() => + { + try + { + DownloadController.Start(); + DownloadController.Manager.GetUpdatePlan(); + + if (!DownloadController.Manager.UpdatePlanResponse.Successful) + throw DownloadController.Manager.UpdatePlanResponse.Exception; + + if (DownloadController.Manager.UpdatePlanResponse.HasToDo()) + { + ViewBehavior.ShowInfo(); + } + else + { + ViewBehavior.ShowLoading(); + } + } + catch(Exception ex) + { + ViewBehavior.ShowError(ex); + } + EndWaiting(); + }); + } + } + + public void LaunchPlaner() + { + Task.Run(() => ProcessController.StartPlanerProcess()); + } + } +} diff --git a/BeWoLauncher/Logic/Behavior/ViewSwitchBehavior.cs b/BeWoLauncher/Logic/Behavior/ViewSwitchBehavior.cs new file mode 100644 index 000000000..4904ee431 --- /dev/null +++ b/BeWoLauncher/Logic/Behavior/ViewSwitchBehavior.cs @@ -0,0 +1,168 @@ +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.Logic.Utils; +using BeWoLauncher.View; +using BeWoLauncher.View.Frames; +using BS.SharedLauncher.Enums; +using System; +using System.IO; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Threading; +using static BeWoLauncher.Logic.Controller.ViewController; + +namespace BeWoLauncher.Logic.Behavior +{ + public class ViewSwitchBehavior + { + private UserControl _currentView; + private FrameBase _currentFrame; + private LauncherMode _currentLauncherMode; + + private UserControl CurrentView + { + get => _currentView; + set + { + _currentView = value; + + CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Render, + (Action)delegate + { + CurrentWindow.SetMainContent(value); + }); + } + } + private FrameBase CurrentFrame + { + get => _currentFrame; + set + { + _currentFrame = value; + + if (CurrentView is FrameView frameview) + CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Render, + (Action)delegate + { + frameview.SetFrame(value); + }); + else + CurrentView = new FrameView(value); + } + } + + public ViewSwitchBehavior() + { + + } + + public void ShowView(ViewType vt) + { + CurrentView = ViewController.ViewBuilder.GetNewView(vt); + } + public void ShowFrame(FrameType ft) + { + CurrentFrame = ViewController.ViewBuilder.GetNewFrame(ft); + } + + public void ShowInfo() + { + ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => + { + if (LauncherAppdataConfig.GetFirstInstallationSuccess() && + File.Exists(LauncherPaths.GetPlanerExePath())) + { + ShowFrame(FrameType.UpdateInfo); + } + else + { + ShowFrame(FrameType.InstallInfo); + } + })); + } + + public void ShowError(Exception exception) + { + ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => + { + Error = exception; + ShowFrame(FrameType.GenericFail); + })); + } + + public void ShowUninstallInfo() + { + ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => + { + ShowFrame(FrameType.UninstallInfo); + })); + } + + public void ShowLoading() + { + ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => + { + ShowFrame(FrameType.LoadingScreen); + })); + } + + public void BackToLogin(object sender, EventArgs e) + { + ShowView(ViewType.LoginView); + } + public void LoginSuccessful(object sender, EventArgs e) + { + ViewController.LaunchBehavior.LoginSuccessful(); + } + + public void InstallInfoAccept(object sender, EventArgs e) + { + var install = sender as InstallInfoFrame; + + if (CheckForPermissions(install.InstallLocation)) + { + LauncherPaths.SetAndSaveInstallLocation(install.InstallLocation); + LauncherAppdataConfig.SetFirstInstallationSuccess(true); + ShowFrame(FrameType.InstallProgress); + } + else + { + ShowFrame(FrameType.NoPermissionInfo); + } + } + public void InstallSuccesss(object sender, EventArgs e) + { + LauncherAppdataConfig.SetFirstInstallationSuccess(true); + ShowFrame(FrameType.LoadingScreen); + } + public void InstallFailed(object sender, EventArgs e) + { + ShowFrame(FrameType.InstallFailed); + } + public void UpdateFailed(object sender, EventArgs e) + { + ShowFrame(FrameType.UpdateFailed); + } + public void UninstallFailed(object sender, EventArgs e) + { + ShowFrame(FrameType.UninstallFailed); + } + + public void UpdateStarting(object sender, EventArgs e) + { + ShowFrame(FrameType.UpdateProgress); + } + public void UpdateSuccess(object sender, EventArgs e) + { + ShowFrame(FrameType.LoadingScreen); + } + + public void UninstallStarting(object sender, EventArgs e) + { + ShowFrame(FrameType.UninstallProgress); + } + public void UninstallSuccess(object sender, EventArgs e) + { + ShowFrame(FrameType.UninstallSuccessful); + } + } +} diff --git a/BeWoLauncher/Logic/Controller/DownloadController.cs b/BeWoLauncher/Logic/Controller/DownloadController.cs new file mode 100644 index 000000000..6ff041aeb --- /dev/null +++ b/BeWoLauncher/Logic/Controller/DownloadController.cs @@ -0,0 +1,35 @@ +using BeWoLauncher.Logic.Utils; +using BeWoLauncher.Logic.Utils.Download; +using BS.SharedLauncher.Information; +using BS.SharedLauncher.Utils; +using System.IO; + +namespace BeWoLauncher.Logic.Controller +{ + public static class DownloadController + { + public static DownloadManager Manager { get; set; } + + public static long FreeSpace { get; set; } + public static long NeededSpace => Manager.UpdatePlanResponse.DownloadSize; + + public static void Start() + { + Manager = new DownloadManager(); + + DownloadLogger.Init(LauncherPaths.GetLoggerPath()); + } + + public static string UpdateDiskSpace(string path) + { + FileInfo f = new FileInfo(path); + string drive = System.IO.Path.GetPathRoot(f.FullName); + FreeSpace = NonspecificTools.GetTotalFreeSpace(drive); + + if (FreeSpace >= 0) + return NonspecificTools.SizeSuffix((ulong)FreeSpace); + else + return "error"; + } + } +} diff --git a/BeWoLauncher/Logic/Controller/ProcessController.cs b/BeWoLauncher/Logic/Controller/ProcessController.cs new file mode 100644 index 000000000..b9ec15a28 --- /dev/null +++ b/BeWoLauncher/Logic/Controller/ProcessController.cs @@ -0,0 +1,162 @@ +using BeWoLauncher.Logic.Utils; +using BeWoLauncher.ServiceProxy; +using BS.SharedLauncher.Information; +using System; +using System.Diagnostics; +using System.IO; +using System.IO.Pipes; +using System.Threading; +using System.Windows; +using System.Windows.Threading; + +namespace BeWoLauncher.Logic.Controller +{ + public static class ProcessController + { + private static Process PlanerProcess { get; set; } + + public static Application Current => Application.Current; + public static LauncherApp CurrentLauncher => Current as LauncherApp; + + private static bool PlanerRunning + { + get + { + if (PlanerProcess is null) + return false; + PlanerProcess.Refresh(); + return !PlanerProcess.HasExited; + } + } + + internal static void CheckForOtherInstance() + { + string procName = Process.GetCurrentProcess().ProcessName; + + Process[] processes = Process.GetProcessesByName(procName); + + if (processes.Length > 1) + { + MessageBox.Show("BeWo Prozess läuft bereits"); + StartLauncherShutdown(); + } + + Process[] processes2 = Process.GetProcessesByName("BeWoPlaner"); + + if (processes2.Length > 0) + { + MessageBox.Show("BeWo Prozess läuft bereits"); + StartLauncherShutdown(); + } + } + + internal static void StartLauncher() + { + CheckForOtherInstance(); + + // Update Server Adresses + //ConnectionInformation.DownloadServerAddress = ConnectionInformation.DownloadServerAddressExact.ToString(); + //ConnectionInformation.CoreServerAddress = ConnectionInformation.CoreServerAddress.ToString(); + + LauncherServiceFacade.UpdateServerAddresses(); + } + + internal static void StartLauncherShutdown() + { + Current.Shutdown(); + } + + internal static void StartPlanerProcess() + { + // based on https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-use-anonymous-pipes-for-local-interprocess-communication?redirectedfrom=MSDN + PlanerProcess = new Process(); + + PlanerProcess.StartInfo.FileName = LauncherPaths.GetPlanerExePath(); + PlanerProcess.EnableRaisingEvents = true; + PlanerProcess.Exited += PlanerProcess_Exit; + + using (AnonymousPipeServerStream pipeServer = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable)) + { + PlanerProcess.StartInfo.Arguments = pipeServer.GetClientHandleAsString(); + PlanerProcess.StartInfo.UseShellExecute = false; + PlanerProcess.StartInfo.CreateNoWindow = false; + PlanerProcess.StartInfo.RedirectStandardOutput = true; + PlanerProcess.OutputDataReceived += MessageFromPlanerClient; + + PlanerProcess.Start(); + DownloadLogger.Post2($"Launcher Start: {PlanerProcess.StartInfo.FileName}"); + + PlanerProcess.BeginOutputReadLine(); + + pipeServer.DisposeLocalCopyOfClientHandle(); + + try + { + using (StreamWriter sw = new StreamWriter(pipeServer)) + { + var signal = new string[] { "C-137", "C-131" }; + + sw.AutoFlush = true; + + SendInfo(sw, signal[0], pipeServer); + + SessionInformation.Connection.ToList().ForEach(info => SendInfo(sw, info, pipeServer)); + SessionInformation.Login.ToList().ForEach(info => SendInfo(sw, info, pipeServer)); + SessionInformation.Session.ToList().ForEach(info => SendInfo(sw, info, pipeServer)); + + SendInfo(sw, signal[1], pipeServer); + } + } + catch (IOException ex) + { + + } + } + } + internal static void SendInfo(StreamWriter sw, string info, AnonymousPipeServerStream pipe) + { + sw.WriteLine(info); + pipe.WaitForPipeDrain(); + } + internal static void KillPlanerProcess() + { + foreach (var process in Process.GetProcesses()) + { + if (process.ProcessName.Contains("BeWoPlaner")) + { + process.Kill(); + } + } + } + + internal static void PlanerProcess_Exit(object sender, EventArgs e) + { + // ExitCode Übersicht: + // 100 - Nutzer hat Logout in Core gedrückt + // 0 - Nutzer hat Fenster geschlossen + // 1 - Proess über TaskManager gekillt + + if (PlanerProcess.ExitCode == 100) + { + CurrentLauncher.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)delegate + { + Thread.Sleep(500); + ViewController.RestartView(); + }); + return; + } + + CurrentLauncher.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)StartLauncherShutdown); + } + + private static void MessageFromPlanerClient(object sender, DataReceivedEventArgs args) + { + var data = args.Data; + + if (data == "GUI geladen") + { + ViewController.CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => ViewController.CurrentWindow.Hide())); + } + } + } +} diff --git a/BeWoLauncher/Logic/Controller/ViewController.cs b/BeWoLauncher/Logic/Controller/ViewController.cs new file mode 100644 index 000000000..691b92333 --- /dev/null +++ b/BeWoLauncher/Logic/Controller/ViewController.cs @@ -0,0 +1,90 @@ +using BeWoLauncher.Logic.Behavior; +using BeWoLauncher.Logic.Utils; +using BeWoLauncher.View; +using BeWoLauncher.View.Frames; +using BS.SharedLauncher.Logic; +using System; +using System.Configuration; +using System.IO; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Threading; + +namespace BeWoLauncher.Logic.Controller +{ + public enum ViewType + { + LoginView, + FrameView + } + + public enum FrameType + { + InstallInfo, + InstallProgress, + InstallFailed, + UpdateInfo, + UpdateProgress, + UpdateFailed, + UninstallInfo, + UninstallProgress, + UninstallFailed, + UninstallSuccessful, + LoadingScreen, + NoPermissionInfo, + GenericFail + } + + public static class ViewController + { + public static Exception Error{ get; set; } + + public static LauncherWindow CurrentWindow { get; private set; } + public static Dispatcher Dispatcher => CurrentWindow.Dispatcher; + + public static ViewSwitchBehavior ViewBehavior { get; set; } + public static LaunchBehavior LaunchBehavior { get; set; } + public static ViewBuilder ViewBuilder { get; set; } + + static ViewController() + { + LaunchBehavior = new LaunchBehavior(); + ViewBehavior = new ViewSwitchBehavior(); + ViewBuilder = new ViewBuilder(); + } + + public static void InitWindow(LauncherWindow window) + { + if (CurrentWindow is null) + CurrentWindow = window; + } + + public static void StartView() + { + ViewBehavior.ShowView(ViewType.LoginView); + } + public static void RestartView() + { + ViewBehavior.ShowView(ViewType.LoginView); + + CurrentWindow.Show(); + CurrentWindow.Activate(); + } + + public static void StartWaiting() => CurrentWindow.StartWaiting(); + public static void EndWaiting() => CurrentWindow.EndWaiting(); + + public static bool CheckForPermissions(string path) + { + return FileController.IsDirectoryWritable(path, false); + } + public static void CheckForAutoLogin(object sender, EventArgs e) + { + var autologin = bool.TryParse(ConfigurationManager.AppSettings.Get("AutoLogin"), out bool c) && c; + + if (autologin) + if (sender is LoginView loginPage) + loginPage.ClickLogin(); + } + } +} diff --git a/BeWoLauncher/Logic/Converter/BoolNullCheckConverter.cs b/BeWoLauncher/Logic/Converter/BoolNullCheckConverter.cs new file mode 100644 index 000000000..0a3a4b022 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/BoolNullCheckConverter.cs @@ -0,0 +1,19 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class BoolNullCheckConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value != null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWoLauncher/Logic/Converter/BoolReverseConverter.cs b/BeWoLauncher/Logic/Converter/BoolReverseConverter.cs new file mode 100644 index 000000000..9ecda8fe7 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/BoolReverseConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class BoolReverseConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool buhl) + { + return !buhl; + } + + return false; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/BoolVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/BoolVisibilityConverter.cs new file mode 100644 index 000000000..85d7d67ad --- /dev/null +++ b/BeWoLauncher/Logic/Converter/BoolVisibilityConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class BoolVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return Visibility.Visible; + } + + var lMode = true; + if (parameter is string s) + { + bool.TryParse(s, out lMode); + } + + if (lMode) + { + return !(bool)value ? Visibility.Collapsed : Visibility.Visible; + } + + return (bool)value ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/BoolVisibilityHiddenConverter.cs b/BeWoLauncher/Logic/Converter/BoolVisibilityHiddenConverter.cs new file mode 100644 index 000000000..76d0efa44 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/BoolVisibilityHiddenConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class BoolVisibilityHiddenConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return Visibility.Visible; + } + + bool lMode = true; + if (parameter is string) + { + bool.TryParse((string)parameter, out lMode); + } + + if (lMode) + { + return (!(bool)value) ? Visibility.Hidden : Visibility.Visible; + } + + return ((bool)value) ? Visibility.Hidden : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/BoolVisibilityMultiConverter.cs b/BeWoLauncher/Logic/Converter/BoolVisibilityMultiConverter.cs new file mode 100644 index 000000000..cafa22b41 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/BoolVisibilityMultiConverter.cs @@ -0,0 +1,21 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class BoolVisibilityMultiConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + return values.OfType().All(b => b) ? Visibility.Visible : Visibility.Collapsed; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/CollectionCountToBoolConverter.cs b/BeWoLauncher/Logic/Converter/CollectionCountToBoolConverter.cs new file mode 100644 index 000000000..a451448b5 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/CollectionCountToBoolConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class CollectionCountToBoolConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + var count = (int) value; + return count > 0; + } + catch (Exception) + { + return false; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWoLauncher/Logic/Converter/CollectionCountToVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/CollectionCountToVisibilityConverter.cs new file mode 100644 index 000000000..bb46b9e4d --- /dev/null +++ b/BeWoLauncher/Logic/Converter/CollectionCountToVisibilityConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class CollectionCountToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + var count = (int)value; + return count > 0 ? Visibility.Visible : Visibility.Collapsed; + } + catch (Exception) + { + return Visibility.Collapsed; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/DataContract2StringConverter.cs b/BeWoLauncher/Logic/Converter/DataContract2StringConverter.cs new file mode 100644 index 000000000..f275a90bc --- /dev/null +++ b/BeWoLauncher/Logic/Converter/DataContract2StringConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class DataContract2StringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null || ((String)value) == string.Empty) + { + return "nicht angegeben"; + } + + return value.ToString(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/Date2CalendarWeekStringConverter.cs b/BeWoLauncher/Logic/Converter/Date2CalendarWeekStringConverter.cs new file mode 100644 index 000000000..338283af3 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/Date2CalendarWeekStringConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class Date2CalendarWeekStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is DateTime)) + { + return null; + } + + var lDate = (DateTime)value; + var lCal = DateTimeFormatInfo.CurrentInfo.Calendar; + + // TODO Wochenbuchung wegmachen :-) + return "Leistungen gleicher Zeit und Dauer in dieser Woche buchen"; + + // return "Leistungen gleicher Zeit und Dauer in dieser Woche buchen (" + // + lDate.GetLast(DayOfWeek.Monday).ToShortDateString() + // + " - " + // + lDate.GetNext(DayOfWeek.Sunday).ToShortDateString() + // + ")"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/DateConverter.cs b/BeWoLauncher/Logic/Converter/DateConverter.cs new file mode 100644 index 000000000..a5228fdf4 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/DateConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + [ValueConversion(typeof(DateTime?), typeof(string))] + public class DateConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + string s = string.Empty; + DateTime? lDateTime = (DateTime?)value; + if (lDateTime.HasValue) + { + s = lDateTime.Value.ToShortDateString(); + } + + return s; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + DateTime temp; + DateTime.TryParse((string)value, out temp); + if (temp != DateTime.MinValue) + { + return temp; + } + else + { + return null; + } + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/DateNullValueToEmptyStringConverter.cs b/BeWoLauncher/Logic/Converter/DateNullValueToEmptyStringConverter.cs new file mode 100644 index 000000000..105cdf72e --- /dev/null +++ b/BeWoLauncher/Logic/Converter/DateNullValueToEmptyStringConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + [ValueConversion(typeof(DateTime?), typeof(string))] + public class DateNullValueToEmptyStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + DateTime? dt = System.Convert.ToDateTime(value); + + return (dt == null || dt.Value.Millisecond == 123) ? string.Empty : value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + [ValueConversion(typeof(decimal?), typeof(string))] + public class DecimalNullValueToEmptyStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + decimal? dec = System.Convert.ToDecimal(value); + bool empty = value == null || dec == null || dec.Value == (decimal)0.00123; + return empty ? string.Empty : value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/DecimalConverter.cs b/BeWoLauncher/Logic/Converter/DecimalConverter.cs new file mode 100644 index 000000000..0c1df92bf --- /dev/null +++ b/BeWoLauncher/Logic/Converter/DecimalConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class DecimalConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + if (string.IsNullOrEmpty(parameter as string)) + { + string v = value.ToString(); + + // nachfolgende nullen entfernen + while (v.Length > 1 && v[v.Length - 1] == '0') + { + v = v.Substring(0, v.Length - 1); + } + + if (v.Length > 1 && v[v.Length - 1] == ',') + { + v = v.Substring(0, v.Length - 1); + } + + return v; + } + + return string.Format((string)parameter, value); + } + + return string.Empty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!string.IsNullOrEmpty((string)value)) + { + var t = decimal.Parse((string)value); + return t; + } + + return null; + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/EnumToDescriptionConverter.cs b/BeWoLauncher/Logic/Converter/EnumToDescriptionConverter.cs new file mode 100644 index 000000000..2834847c4 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/EnumToDescriptionConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class EnumToDescriptionConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + return null; + + throw new Exception("Hier muss noch was getestet werden"); + //var EnVal = value as DevExpress.Xpf.Core.EnumHelper. EnumItem; + //var fi2 = EnVal.Id.GetType().GetField(EnVal.Id.ToString()); + //var attrs = (DescriptionAttribute[])fi2.GetCustomAttributes(typeof(DescriptionAttribute), true); + + //return !attrs.Any() ? value : attrs[0].Description; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value; + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/IListT2DataTableConverter.cs b/BeWoLauncher/Logic/Converter/IListT2DataTableConverter.cs new file mode 100644 index 000000000..c952a1b27 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/IListT2DataTableConverter.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections; +using System.Data; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class IListT2DataTableConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is IList && value.GetType().IsGenericType) + { + DataTable lResult = new DataTable(); + + Type lGenericType = value.GetType().GetGenericArguments()[0]; + + lResult.TableName = lGenericType.FullName; + lResult.Columns.Add("item"); + + foreach (var iProp in lGenericType.GetProperties()) + { + lResult.Columns.Add(iProp.Name); + } + + Hashtable lRows2Objects = new Hashtable(); + + foreach (var iItem in value as IList) + { + var iRow = lResult.NewRow(); + iRow["item"] = iItem; + + lRows2Objects.Add(iRow, iItem); + + foreach (var iProp in lGenericType.GetProperties()) + { + iRow[iProp.Name] = iProp.GetValue(iItem, null); + } + + lResult.Rows.Add(iRow); + } + + lResult.RowChanged += (s, e) => + { + foreach (var iProp in lGenericType.GetProperties()) + { + iProp.SetValue(lRows2Objects[e.Row], e.Row[iProp.Name], null); + } + }; + + return lResult; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/IndexBoolConverter.cs b/BeWoLauncher/Logic/Converter/IndexBoolConverter.cs new file mode 100644 index 000000000..0eac2a5f3 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/IndexBoolConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + [ValueConversion(typeof(int), typeof(bool))] + public class IndexBoolConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + int lIndex = -1; + if (parameter != null && parameter is string) + { + Int32.TryParse(parameter as string, out lIndex); + } + + return ((int)value) != lIndex; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/Int2DecimalConverter.cs b/BeWoLauncher/Logic/Converter/Int2DecimalConverter.cs new file mode 100644 index 000000000..0bc9d2337 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/Int2DecimalConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace BeWoLauncher.Converter +{ + public class Int2DecimalConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return System.Convert.ToDecimal(value); + } + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return System.Convert.ToInt32(value); + } + + #endregion + + + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/NullableBoolToBoolConverter.cs b/BeWoLauncher/Logic/Converter/NullableBoolToBoolConverter.cs new file mode 100644 index 000000000..4d75a6c12 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/NullableBoolToBoolConverter.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWoLauncher.Converter +{ + public class NullableBoolToBoolConverter : System.Windows.Data.IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return false; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWoLauncher/Logic/Converter/ObjectBoolConverter.cs b/BeWoLauncher/Logic/Converter/ObjectBoolConverter.cs new file mode 100644 index 000000000..45b7d8716 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/ObjectBoolConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class ObjectBoolConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + bool lFalseIfNull = true; + + if (parameter != null || parameter is string) + { + bool.TryParse((string)parameter, out lFalseIfNull); + } + + if (value is string) + { + if (lFalseIfNull) + { + return !string.IsNullOrEmpty((string)value); + } + else + { + return string.IsNullOrEmpty((string)value); + } + } + + if (lFalseIfNull) + { + return value != null; + } + + return value == null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/ObjectVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/ObjectVisibilityConverter.cs new file mode 100644 index 000000000..a343ddb12 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/ObjectVisibilityConverter.cs @@ -0,0 +1,44 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class ObjectVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + bool lVisibleIfNull = false; + + if (parameter != null || parameter is string) + { + bool.TryParse((string)parameter, out lVisibleIfNull); + } + + if (value is string) + { + if (lVisibleIfNull) + { + return !string.IsNullOrEmpty((string)value) ? Visibility.Collapsed : Visibility.Visible; + } + else + { + return string.IsNullOrEmpty((string)value) ? Visibility.Collapsed : Visibility.Visible; + } + } + + if (lVisibleIfNull) + { + return value != null ? Visibility.Collapsed : Visibility.Visible; + } + + return value == null ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/OneWayToSourceSwitch.cs b/BeWoLauncher/Logic/Converter/OneWayToSourceSwitch.cs new file mode 100644 index 000000000..8148be3e9 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/OneWayToSourceSwitch.cs @@ -0,0 +1,20 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class OneWayToSourceSwitch : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return targetTypes.Select(t => value).ToArray(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/ReverseValueEqualsParamVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/ReverseValueEqualsParamVisibilityConverter.cs new file mode 100644 index 000000000..bddfbc0de --- /dev/null +++ b/BeWoLauncher/Logic/Converter/ReverseValueEqualsParamVisibilityConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class ReverseValueEqualsParamVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter == null || value == null) + { + return Visibility.Visible; + } + + if (parameter.Equals(value)) + { + return Visibility.Collapsed; + } + + return Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/StringBrushConverter.cs b/BeWoLauncher/Logic/Converter/StringBrushConverter.cs new file mode 100644 index 000000000..67e1b95c7 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/StringBrushConverter.cs @@ -0,0 +1,22 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; + +namespace BeWoLauncher.Converter +{ + public class StringBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var lColor = value as string; + + return lColor == null ? null : new SolidColorBrush((Color) ColorConverter.ConvertFromString(lColor)); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/StringFormatConverter.cs b/BeWoLauncher/Logic/Converter/StringFormatConverter.cs new file mode 100644 index 000000000..d979af4d6 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/StringFormatConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class StringFormatConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Object val = String.Empty; + + if (value != null && value != DependencyProperty.UnsetValue) + { + val = value; + } + + if (parameter is string) + { + return string.Format(parameter as string, value); + } + + return value; + } + + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/StringFormatMulitConverter.cs b/BeWoLauncher/Logic/Converter/StringFormatMulitConverter.cs new file mode 100644 index 000000000..9c95d2fd7 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/StringFormatMulitConverter.cs @@ -0,0 +1,33 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class StringFormatMulitConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + for (int i = 0; i < values.Length; i++) + { + if (values[i] == null || values[i] == DependencyProperty.UnsetValue) + { + values[i] = string.Empty; + } + } + + if (parameter is string) + { + return string.Format(parameter as string, values); + } + + return values; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Converter/StringLengthVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/StringLengthVisibilityConverter.cs new file mode 100644 index 000000000..a8e3a1780 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/StringLengthVisibilityConverter.cs @@ -0,0 +1,22 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class StringLengthVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if(value == null || value.GetType() != typeof(string) || string.IsNullOrWhiteSpace(value.ToString())) + { + return Visibility.Collapsed; + } + + return Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} diff --git a/BeWoLauncher/Logic/Converter/StringLengthVisibilityMultiConverter.cs b/BeWoLauncher/Logic/Converter/StringLengthVisibilityMultiConverter.cs new file mode 100644 index 000000000..5bf2728c7 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/StringLengthVisibilityMultiConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class StringLengthVisibilityMultiConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if(values == null || values.Length < 2 || values.Any(a => string.IsNullOrWhiteSpace(a?.ToString()))) + { + return Visibility.Collapsed; + } + + return Visibility.Visible; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } +} diff --git a/BeWoLauncher/Logic/Converter/ValueEqualsParamVisibilityConverter.cs b/BeWoLauncher/Logic/Converter/ValueEqualsParamVisibilityConverter.cs new file mode 100644 index 000000000..60a850cf9 --- /dev/null +++ b/BeWoLauncher/Logic/Converter/ValueEqualsParamVisibilityConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWoLauncher.Converter +{ + public class ValueEqualsParamVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter == null || value == null) + { + return Visibility.Collapsed; + } + + if (parameter.Equals(value)) + { + return Visibility.Visible; + } + + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Multitenancy/MultitenancyEndpointBehavior.cs b/BeWoLauncher/Logic/Multitenancy/MultitenancyEndpointBehavior.cs new file mode 100644 index 000000000..c942971b5 --- /dev/null +++ b/BeWoLauncher/Logic/Multitenancy/MultitenancyEndpointBehavior.cs @@ -0,0 +1,28 @@ +using System; +using System.ServiceModel.Channels; +using System.ServiceModel.Description; +using System.ServiceModel.Dispatcher; + +namespace BeWoLauncher.Multitenancy +{ + public class MultitenancyEndpointBehavior : IEndpointBehavior + { + public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) + { + } + + public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) + { + clientRuntime.MessageInspectors.Add(new MultitenancyInterceptor()); + } + + public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) + { + throw new NotImplementedException("This is a client behavior only"); + } + + public void Validate(ServiceEndpoint endpoint) + { + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Multitenancy/MultitenancyHeader.cs b/BeWoLauncher/Logic/Multitenancy/MultitenancyHeader.cs new file mode 100644 index 000000000..523826d91 --- /dev/null +++ b/BeWoLauncher/Logic/Multitenancy/MultitenancyHeader.cs @@ -0,0 +1,39 @@ +using System.ServiceModel.Channels; +using System.Xml; + +namespace BeWoLauncher.Multitenancy +{ + public class MultitenancyHeader : MessageHeader + { + public override bool MustUnderstand + { + get + { + return false; + } + } + + public override string Name + { + get + { + return "Multitenancy"; + } + } + + public override string Namespace + { + get + { + return "http://beyondsoft.de/Multitenancy.xsd"; + } + } + + public string Tenant { get; set; } + + protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) + { + writer.WriteElementString("Tenant", this.Tenant); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Multitenancy/MultitenancyInterceptor.cs b/BeWoLauncher/Logic/Multitenancy/MultitenancyInterceptor.cs new file mode 100644 index 000000000..cc05087b0 --- /dev/null +++ b/BeWoLauncher/Logic/Multitenancy/MultitenancyInterceptor.cs @@ -0,0 +1,21 @@ +using BS.SharedLauncher; +using BS.SharedLauncher.Information; +using System.ServiceModel; +using System.ServiceModel.Channels; +using System.ServiceModel.Dispatcher; + +namespace BeWoLauncher.Multitenancy +{ + public class MultitenancyInterceptor : IClientMessageInspector + { + public void AfterReceiveReply(ref Message reply, object correlationState) + { + } + + public object BeforeSendRequest(ref Message request, IClientChannel channel) + { + request.Headers.Add(new MultitenancyHeader { Tenant = SessionInformation.Login.Tenant }); + return null; + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Security/LauncherSecurityHeader.cs b/BeWoLauncher/Logic/Security/LauncherSecurityHeader.cs new file mode 100644 index 000000000..cb8467b32 --- /dev/null +++ b/BeWoLauncher/Logic/Security/LauncherSecurityHeader.cs @@ -0,0 +1,75 @@ +using System.ServiceModel.Channels; +using System.Xml; + +namespace BeWoLauncher.Security +{ + // TODO: Make it namespace-conform (type Attributes, prefixes, etc) + // ns: + public class LauncherSecurityHeader : MessageHeader + { + private string mPassword; + + private string mUsername; + + public override bool MustUnderstand + { + get + { + return false; + } + } + + public override string Name + { + get + { + return "Security"; + } + } + + public override string Namespace + { + get + { + return "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; + } + } + + public string Password + { + get + { + return this.mPassword; + } + + set + { + this.mPassword = value; + } + } + + public string Username + { + get + { + return this.mUsername; + } + + set + { + this.mUsername = value; + } + } + + protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) + { + writer.WriteStartElement("UsernameToken"); + writer.WriteElementString("Username", this.mUsername); + writer.WriteStartElement("Password"); + writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); + writer.WriteValue(this.mPassword); + writer.WriteEndElement(); + writer.WriteEndElement(); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Security/LauncherSecurityHeaderEndpointBehavior.cs b/BeWoLauncher/Logic/Security/LauncherSecurityHeaderEndpointBehavior.cs new file mode 100644 index 000000000..d50377b58 --- /dev/null +++ b/BeWoLauncher/Logic/Security/LauncherSecurityHeaderEndpointBehavior.cs @@ -0,0 +1,28 @@ +using System; +using System.ServiceModel.Channels; +using System.ServiceModel.Description; +using System.ServiceModel.Dispatcher; + +namespace BeWoLauncher.Security +{ + public class LauncherSecurityHeaderEndpointBehavior : IEndpointBehavior + { + public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) + { + } + + public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) + { + clientRuntime.MessageInspectors.Add(new LauncherSecurityHeaderInterceptor()); + } + + public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) + { + throw new NotImplementedException("This is a client behavior only"); + } + + public void Validate(ServiceEndpoint endpoint) + { + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Security/LauncherSecurityHeaderInterceptor.cs b/BeWoLauncher/Logic/Security/LauncherSecurityHeaderInterceptor.cs new file mode 100644 index 000000000..8c0e49527 --- /dev/null +++ b/BeWoLauncher/Logic/Security/LauncherSecurityHeaderInterceptor.cs @@ -0,0 +1,22 @@ +using BeWoLauncher; +using BS.SharedLauncher; +using BS.SharedLauncher.Information; +using System.ServiceModel; +using System.ServiceModel.Channels; +using System.ServiceModel.Dispatcher; + +namespace BeWoLauncher.Security +{ + public class LauncherSecurityHeaderInterceptor : IClientMessageInspector + { + public void AfterReceiveReply(ref Message reply, object correlationState) + { + } + + public object BeforeSendRequest(ref Message request, IClientChannel channel) + { + request.Headers.Add(new LauncherSecurityHeader { Username = SessionInformation.Login.Username, Password = SessionInformation.Login.Password }); + return null; + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/ServiceProxy/LauncherGenerated.cs b/BeWoLauncher/Logic/ServiceProxy/LauncherGenerated.cs new file mode 100644 index 000000000..0b2a8cd65 --- /dev/null +++ b/BeWoLauncher/Logic/ServiceProxy/LauncherGenerated.cs @@ -0,0 +1,403 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoLauncher.ServiceProxy +{ + using System.Runtime.Serialization; + + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + public partial class BeWoFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged + { + + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; + + private BeWoLauncher.ServiceProxy.BeWoFaultType FaultTypeField; + + private string InnerExceptionMessageField; + + private string InnerExceptionStackTraceField; + + private string MessageField; + + private string StackTraceField; + + public System.Runtime.Serialization.ExtensionDataObject ExtensionData + { + get + { + return this.extensionDataField; + } + set + { + this.extensionDataField = value; + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public BeWoLauncher.ServiceProxy.BeWoFaultType FaultType + { + get + { + return this.FaultTypeField; + } + set + { + if ((this.FaultTypeField.Equals(value) != true)) + { + this.FaultTypeField = value; + this.RaisePropertyChanged("FaultType"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string InnerExceptionMessage + { + get + { + return this.InnerExceptionMessageField; + } + set + { + if ((object.ReferenceEquals(this.InnerExceptionMessageField, value) != true)) + { + this.InnerExceptionMessageField = value; + this.RaisePropertyChanged("InnerExceptionMessage"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string InnerExceptionStackTrace + { + get + { + return this.InnerExceptionStackTraceField; + } + set + { + if ((object.ReferenceEquals(this.InnerExceptionStackTraceField, value) != true)) + { + this.InnerExceptionStackTraceField = value; + this.RaisePropertyChanged("InnerExceptionStackTrace"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string Message + { + get + { + return this.MessageField; + } + set + { + if ((object.ReferenceEquals(this.MessageField, value) != true)) + { + this.MessageField = value; + this.RaisePropertyChanged("Message"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string StackTrace + { + get + { + return this.StackTraceField; + } + set + { + if ((object.ReferenceEquals(this.StackTraceField, value) != true)) + { + this.StackTraceField = value; + this.RaisePropertyChanged("StackTrace"); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected void RaisePropertyChanged(string propertyName) + { + System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if ((propertyChanged != null)) + { + propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name = "BeWoFaultType", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + public enum BeWoFaultType : int + { + + [System.Runtime.Serialization.EnumMemberAttribute()] + Unknown = 0, + + [System.Runtime.Serialization.EnumMemberAttribute()] + Concurrency = 1, + + [System.Runtime.Serialization.EnumMemberAttribute()] + DeleteNotPossible = 2, + + [System.Runtime.Serialization.EnumMemberAttribute()] + LoginNameTaken = 3, + + [System.Runtime.Serialization.EnumMemberAttribute()] + CustomWithoutDetails = 4, + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "BeWoLauncher.ServiceProxy.ILauncherService")] + public interface ILauncherService + { + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/IsUserValid", ReplyAction = "http://tempuri.org/ILauncherService/IsUserValidResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/IsUserValidBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/ResetTenant", ReplyAction = "http://tempuri.org/ILauncherService/ResetTenantResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/ResetTenantBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetTenant(string tenant); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/ResetAllTenant", ReplyAction = "http://tempuri.org/ILauncherService/ResetAllTenantResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/ResetAllTenantBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetAllTenant(); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/GetEmailForUserName", ReplyAction = "http://tempuri.org/ILauncherService/GetEmailForUserNameResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/GetEmailForUserNameBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/CheckPassword", ReplyAction = "http://tempuri.org/ILauncherService/CheckPasswordResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/CheckPasswordBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/CheckPassword2", ReplyAction = "http://tempuri.org/ILauncherService/CheckPassword2Response")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/CheckPassword2BeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/ChangePassword", ReplyAction = "http://tempuri.org/ILauncherService/ChangePasswordResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/ChangePasswordBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + long ChangePassword(string pUserName, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/ILauncherService/ResetPasswordInfo", ReplyAction = "http://tempuri.org/ILauncherService/ResetPasswordInfoResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/ILauncherService/ResetPasswordInfoBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetPasswordInfo(string pUserName, string pPassword); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface ILauncherServiceChannel : BeWoLauncher.ServiceProxy.ILauncherService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class LauncherServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.ILauncherService + { + + public LauncherServiceClient() + { + } + + public LauncherServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public LauncherServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public LauncherServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public LauncherServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant) + { + return base.Channel.IsUserValid(pUserName, pPassword, pPIN, clientId, checkTenant); + } + + public void ResetTenant(string tenant) + { + base.Channel.ResetTenant(tenant); + } + + public void ResetAllTenant() + { + base.Channel.ResetAllTenant(); + } + + public bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName) + { + return base.Channel.GetEmailForUserName(out email, pUserName, serverName); + } + + public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword) + { + return base.Channel.CheckPassword(userOid, pOldPassword, pNewPassword); + } + + public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword) + { + return base.Channel.CheckPassword2(username, pOldPassword, pNewPassword); + } + + public long ChangePassword(string pUserName, string pOldPassword, string pNewPassword) + { + return base.Channel.ChangePassword(pUserName, pOldPassword, pNewPassword); + } + + public void ResetPasswordInfo(string pUserName, string pPassword) + { + base.Channel.ResetPasswordInfo(pUserName, pPassword); + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "BeWoLauncher.ServiceProxy.IEnumTranslationService")] + public interface IEnumTranslationService + { + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IEnumTranslationService/GetTranslation", ReplyAction = "http://tempuri.org/IEnumTranslationService/GetTranslationResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IEnumTranslationService/GetTranslationBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetTranslation(string e, short value); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IEnumTranslationServiceChannel : BeWoLauncher.ServiceProxy.IEnumTranslationService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class EnumTranslationServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.IEnumTranslationService + { + + public EnumTranslationServiceClient() + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public EnumTranslationServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public string GetTranslation(string e, short value) + { + return base.Channel.GetTranslation(e, value); + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "BeWoLauncher.ServiceProxy.IDownloadBeWoService")] + public interface IDownloadBeWoService + { + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/Download2", ReplyAction = "http://tempuri.org/IDownloadBeWoService/Download2Response")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/Download2BeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdatePlanRequest request); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/DownloadInfo", ReplyAction = "http://tempuri.org/IDownloadBeWoService/DownloadInfoResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/DownloadInfoBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdatePlanResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdatePlanRequest request); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlan", ReplyAction = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlanResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlanBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdatePlanResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdatePlanRequest request); + + [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/GetUpdateFile", ReplyAction = "http://tempuri.org/IDownloadBeWoService/GetUpdateFileResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/GetUpdateFileBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IDownloadBeWoServiceChannel : BeWoLauncher.ServiceProxy.IDownloadBeWoService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class DownloadBeWoServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.IDownloadBeWoService + { + + public DownloadBeWoServiceClient() + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public DownloadBeWoServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdatePlanRequest request) + { + return base.Channel.Download2(request); + } + + public BS.SharedLauncher.DataContract.UpdatePlanResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdatePlanRequest request) + { + return base.Channel.DownloadInfo(request); + } + + public BS.SharedLauncher.DataContract.UpdatePlanResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdatePlanRequest request) + { + return base.Channel.GetUpdatePlan(request); + } + + public BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request) + { + return base.Channel.GetUpdateFile(request); + } + } +} diff --git a/BeWoLauncher/Logic/ServiceProxy/LauncherServiceFacade.cs b/BeWoLauncher/Logic/ServiceProxy/LauncherServiceFacade.cs new file mode 100644 index 000000000..c8dbe9637 --- /dev/null +++ b/BeWoLauncher/Logic/ServiceProxy/LauncherServiceFacade.cs @@ -0,0 +1,500 @@ +using BeWoLauncher.Multitenancy; +using BeWoLauncher.Security; +using BS.SharedLauncher.Information; +using System; +using System.Collections.Generic; +using System.ServiceModel; +using System.Threading; +using System.Windows; + +namespace BeWoLauncher.ServiceProxy +{ + public static class LauncherServiceFacade + { + public static object _Lock = string.Empty; + + private static Dictionary _EndpointAddresses; + private static readonly Dictionary _ProxyCache; + + private static readonly int _RunningAsyncs; + + public static void UpdateServerAddresses() + { + var download = SessionInformation.Connection.DownloadServerAddressExact; + var core = SessionInformation.Connection.CoreServerAddressExact; + + if (download.Substring(download.Length - 1, 1) != "/") + download += "/"; + if (core.Substring(core.Length - 1, 1) != "/") + core += "/"; + + _EndpointAddresses = new Dictionary + { + { typeof(ILauncherService), new EndpointAddress(core + "LauncherService.svc") }, + { typeof(IEnumTranslationService), new EndpointAddress(core + "EnumTranslationService.svc") }, + { typeof(IDownloadBeWoService), new EndpointAddress(download + "DownloadBeWoService.svc") } + }; + } + + static LauncherServiceFacade() + { + _ProxyCache = new Dictionary(); + } + + #region Launcher + public static void DoLauncherServiceSync(Action pAction) + { + try + { + pAction.Invoke(GetInstance()); + } + catch (Exception e) + { + // if (HandleServiceProxyException(e)) + // throw e; + ShowErrorMessage(e); + } + } + public static T DoLauncherServiceSync(Func pFunc) + { + try + { + return pFunc.Invoke(GetInstance()); + } + catch (Exception e) + { + ShowErrorMessage(e); + } + return default(T); + } + public static void DoLauncherServiceAsync(Func pFunc, Action pCallBack) + { + DoAsync(pFunc, pCallBack, true); + } + public static void DoLauncherServiceAsync(Func pFunc, Action pCallBack, bool showWaitDialog) + { + DoAsync(pFunc, pCallBack, showWaitDialog); + } + public static void DoLauncherServiceAsync(Action pAction) + { + DoAsync(pAction, true); + } + public static void DoLauncherServiceAsync(Action pAction, Action pCallBack) + { + DoAsync(pAction, pCallBack, true); + } + public static void DoMultipleLauncherServicesAsync(List> pActions, Action pAllDoneCallBack) + { + DoMulitpleAsync(pActions, pAllDoneCallBack, true); + } + public static void DoMultipleLauncherServicesSync(List> pActions) + { + DoMulitpleSync(pActions, true); + } + #endregion + #region EnumTranslation + + public static void DoEnumTranslationServiceSync(Action pAction) + { + try + { + pAction.Invoke(GetInstance()); + } + catch (Exception e) + { + // if (HandleServiceProxyException(e)) + // throw e; + ShowErrorMessage(e); + } + } + public static T DoEnumTranslationServiceSync(Func pFunc) + { + try + { + return pFunc.Invoke(GetInstance()); + } + catch (Exception e) + { + ShowErrorMessage(e); + } + return default(T); + } + public static void DoEnumTranslationServiceAsync(Func pFunc, Action pCallBack) + { + DoAsync(pFunc, pCallBack, true); + } + public static void DoEnumTranslationServiceAsync(Func pFunc, Action pCallBack, bool showWaitDialog) + { + DoAsync(pFunc, pCallBack, showWaitDialog); + } + public static void DoEnumTranslationServiceAsync(Action pAction) + { + DoAsync(pAction, true); + } + public static void DoEnumTranslationServiceAsync(Action pAction, Action pCallBack) + { + DoAsync(pAction, pCallBack, true); + } + public static void DoMultipleEnumTranslationServicesAsync(List> pActions, Action pAllDoneCallBack) + { + DoMulitpleAsync(pActions, pAllDoneCallBack, true); + } + public static void DoMultipleEnumTranslationServicesSync(List> pActions) + { + DoMulitpleSync(pActions, true); + } + + #endregion + #region DownloadBeWo + public static void DoDownloadBeWoServiceSync(Action pAction) + { + try + { + pAction.Invoke(GetInstance()); + } + catch (Exception e) + { + // if (HandleServiceProxyException(e)) + // throw e; + ShowErrorMessage(e); + } + } + public static T DoDownloadBeWoServiceSyncWithException(Func pFunc) + { + try + { + return pFunc.Invoke(GetInstance()); + } + catch (Exception e) + { + throw e; + } + return default(T); + } + public static T DoDownloadBeWoServiceSync(Func pFunc) + { + try + { + return pFunc.Invoke(GetInstance()); + } + catch (Exception e) + { + ShowErrorMessage(e); + } + return default(T); + } + public static void DoDownloadBeWoServiceAsync(Func pFunc, Action pCallBack) + { + DoAsync(pFunc, pCallBack, true); + } + public static void DoDownloadBeWoServiceAsync(Func pFunc, Action pCallBack, bool showWaitDialog) + { + DoAsync(pFunc, pCallBack, showWaitDialog); + } + public static void DoDownloadBeWoServiceAsync(Action pAction) + { + DoAsync(pAction, true); + } + public static void DoDownloadBeWoServiceAsync(Action pAction, Action pCallBack) + { + DoAsync(pAction, pCallBack, true); + } + #endregion + + private static void DoAsync(Func pFunc, Action pCallback, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + DoAsync(pFunc, pCallback, null, showWaitDialog); + } + private static void DoAsync(Func pFunc, Action pCallback, Action pErrorCallback, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + try + { + if (showWaitDialog) + { + StartWaiting(); + } + + pFunc.BeginInvoke( + GetInstance(), + cb => + { + try + { + T lResult = pFunc.EndInvoke(cb); + if (pCallback != null) + { + pCallback(lResult); + } + + if (showWaitDialog) + { + EndWaiting(); + } + } + catch (Exception e) + { + // bool lThrow = ShowErrorMessage(e); + // if (showWaitDialog) EndWaiting(); + // if (lThrow) + // throw e; + if (showWaitDialog) + { + EndWaiting(); + } + + ShowErrorMessage(e); + if (pErrorCallback != null) + { + pErrorCallback(); + } + } + }, + null); + } + catch (Exception e) + { + // bool lThrow = ShowErrorMessage(e); + // if (showWaitDialog) EndWaiting(); + // if (lThrow) + // throw e; + if (showWaitDialog) + { + EndWaiting(); + } + + ShowErrorMessage(e); + } + } + private static void DoAsync(Action pAction, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + DoAsync(pAction, null, showWaitDialog); + } + private static void DoAsync(Action pAction, Action pCallback, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + try + { + if (showWaitDialog) + { + StartWaiting(); + } + + pAction.BeginInvoke( + GetInstance(), + cb => + { + try + { + pAction.EndInvoke(cb); + if (pCallback != null) + { + pCallback(); + } + + if (showWaitDialog) + { + EndWaiting(); + } + } + catch (Exception e) + { + // bool lThrow = ShowErrorMessage(e); + // if (showWaitDialog) EndWaiting(); + // if (lThrow) + // throw e; + if (showWaitDialog) + { + EndWaiting(); + } + + ShowErrorMessage(e); + } + }, + null); + } + catch (Exception e) + { + // bool lThrow = ShowErrorMessage(e); + // if (showWaitDialog) EndWaiting(); + // if (lThrow) + // throw e; + if (showWaitDialog) + { + EndWaiting(); + } + + ShowErrorMessage(e); + } + } + private static void DoMulitpleSync(List> pActions, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + int lCount = pActions.Count; + + if (showWaitDialog) + { + StartWaiting(); + } + foreach (var iAction in pActions) + { + iAction.Invoke(GetInstance()); + } + if (showWaitDialog) + { + EndWaiting(); + } + } + private static void DoMulitpleAsync(List> pActions, Action pAllDoneCallBack, bool showWaitDialog) + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + int lCount = pActions.Count; + if (lCount == 0) + { + pAllDoneCallBack(); + } + + foreach (var iAction in pActions) + { + DoAsync( + iAction, + delegate + { + Monitor.Enter(_Lock); + lCount--; + Monitor.Exit(_Lock); + if (lCount == 0) + { + pAllDoneCallBack(); + } + }, + showWaitDialog); + } + } + private static TInterface GetInstance() + where TClient : ClientBase, TInterface, new() + where TInterface : class + { + TClient lClient = null; + if (_ProxyCache.ContainsKey(typeof(TClient))) + { + lClient = (TClient)_ProxyCache[typeof(TClient)]; + + if (lClient.State == CommunicationState.Closing || lClient.State == CommunicationState.Closed || lClient.State == CommunicationState.Faulted) + { + if (lClient.State == CommunicationState.Faulted) + { + lClient.Abort(); + } + + lClient = null; + _ProxyCache.Remove(typeof(TClient)); + } + } + + if (lClient != null) + {// EndpointAddresses aktualisieren + if (!lClient.Endpoint.Address.Equals(_EndpointAddresses[typeof(TInterface)])) + { + if (lClient.State == CommunicationState.Opened) + lClient.Close(); + + if (_ProxyCache.ContainsKey(typeof(TClient))) + _ProxyCache.Remove(typeof(TClient)); + lClient = null; + } + } + + if (lClient == null) + { + lClient = new TClient(); + + if (!_ProxyCache.ContainsKey(lClient.GetType())) + { + _ProxyCache.Add(typeof(TClient), lClient); + } + + + lClient.Endpoint.Behaviors.Add(new LauncherSecurityHeaderEndpointBehavior()); + lClient.Endpoint.Behaviors.Add(new MultitenancyEndpointBehavior()); + + lClient.Endpoint.Address = _EndpointAddresses[typeof(TInterface)]; + } + + return lClient; + } + private static void ShowErrorMessage(Exception e) + { + if (e is FaultException) + { + var lBeWoFault = (e as FaultException).Detail; + + String rowUpdated = "Der Datensatz wurde in der Zwischenzeit von einem anderen Benutzer geändert. Ihre Änderungen konnten leider NICHT gespeichert werden. Das Problem tritt auf, wenn mehrere Benutzer gleichzeitig den gleichen Datensatz bearbeiten.\n\nSie müssen den Datensatz schließen und erneut öffnen, um die Änderungen vornehmen zu können."; + switch (lBeWoFault.FaultType) + { + case BeWoFaultType.Concurrency: + LauncherApp.ShowError(rowUpdated, e, false); + break; + case BeWoFaultType.DeleteNotPossible: + MessageBox.Show(lBeWoFault.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk); + break; + case BeWoFaultType.LoginNameTaken: + MessageBox.Show(lBeWoFault.Message, "Warnung", MessageBoxButton.OK, MessageBoxImage.Asterisk); + return; + case BeWoFaultType.CustomWithoutDetails: + LauncherApp.ShowError(lBeWoFault.Message, e, false); + break; + default: + if (!string.IsNullOrEmpty(e.Message) && e.Message.IndexOf("Row was updated or deleted by another transaction") >= 0) + { + LauncherApp.ShowError(rowUpdated, e, false); + } + else + { + if (!string.IsNullOrEmpty(lBeWoFault.Message)) + { + LauncherApp.ShowError(lBeWoFault.Message, e, true); + } + else + { + LauncherApp.ShowError(null, e, true); + } + } + break; + } + } + else + { + LauncherApp.ShowError(null, e, true); + } + } + private static void StartWaiting() + { + //Monitor.Enter(_Lock); + //if ((++_RunningAsyncs) == 1) + //{ + // LauncherApp.Window.StartWaiting(); + //} + + //Monitor.Exit(_Lock); + } + private static void EndWaiting() + { + //Monitor.Enter(_Lock); + //if ((--_RunningAsyncs) == 0) + //{ + // LauncherApp.Window.EndWaiting(); + //} + + //Monitor.Exit(_Lock); + } + } +} diff --git a/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs b/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs new file mode 100644 index 000000000..af73ba4b8 --- /dev/null +++ b/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs @@ -0,0 +1,212 @@ +using BeWoLauncher.ServiceProxy; +using BS.SharedLauncher; +using BS.SharedLauncher.DataContract; +using BS.SharedLauncher.Enums; +using BS.SharedLauncher.Exceptions; +using BS.SharedLauncher.Extensions; +using BS.SharedLauncher.Information; +using BS.SharedLauncher.Logic; +using BS.SharedLauncher.Update; +using BS.SharedLauncher.Utils; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Xml.Serialization; + +namespace BeWoLauncher.Logic.Utils.Download +{ + public class DownloadManager + { + public UpdatePlanRequest UpdatePlanRequest { get; set; } + public UpdatePlanResponse UpdatePlanResponse { get; set; } + + public string RootFolder => LauncherPaths.GetRootPath(); + public string DownloadFolder => LauncherPaths.GetDownloadPath(); + public string ApplyFolder => LauncherPaths.GetApplyPath(); + + public bool SkipLock { get; set; } + public Action Feedback { get; set; } + + public int FilesToDownloadCount => UpdatePlanResponse.FilesToRequest?.Count ?? 0; + public int FilesToApplyCount => FilesToDownloadCount + (UpdatePlanResponse.FilesToApply?.Count ?? 0); + public int FilesToDeleteInApplyCount => UpdatePlanResponse.FilesToDeleteInApply?.Count ?? 0; + public int FilesToProcessTotal => FilesToDownloadCount + FilesToApplyCount + FilesToDeleteInApplyCount; + + public DownloadManager() + { + + } + + public void GetUpdatePlan() + { + CreateUpdatePlanRequest(); + + GetUpdatePlanResponse(); + + SessionInformation.Session.Version = UpdatePlanResponse.CurrentPackage.Version; + } + + public void StartProcess(BackgroundWorker worker) + { + var report = new Action((progress, waitms) => + { + worker.ReportProgress((int)progress); + Thread.Sleep(waitms); + }); + + report(LauncherProgress.ProgressStart, 1000); + + if (FilesToDownloadCount > 0) + { + report(LauncherProgress.DownloadStart, 500); + + Download(); + + report(LauncherProgress.DownloadFinish, 1000); + } + + if (FilesToApplyCount > 0) + { + report(LauncherProgress.ApplyStart, 500); + + Apply(); + + report(LauncherProgress.ApplyFinished, 1000); + } + + if (FilesToDeleteInApplyCount > 0) + { + report(LauncherProgress.DeleteStart, 500); + + Delete(); + + report(LauncherProgress.DeleteFinished, 1000); + } + + report(LauncherProgress.CleanupStart, 500); + + Cleanup(); + + report(LauncherProgress.CleanupFinished, 1000); + + // report(LauncherProgress.ProgressEnd, 500); + } + + public void Download() + { + DownloadFolder.CreateFolder(); + + DownloadFolder.Lock(SkipLock); + + DownloadFolder.SaveCurrentInfo("current"); + + UpdateFileRequest req = new UpdateFileRequest(UpdatePlanResponse.CurrentPackage.Version); + foreach (var file2request in UpdatePlanResponse.FilesToRequest) + { + req.UpdateFile = file2request; + + var res = AskForFile(req); + + var download_path = DownloadFolder.Combine(file2request.RelativePath); + + Path.GetDirectoryName(download_path).CreateFolder(); + download_path.SaveFile(res.FileData); + + var size = NonspecificTools.SizeSuffix((ulong)res.FileData.Length); + + Feedback((int)LauncherProgress.DownloadUpdate, new DownloadProgressEventArgs(size, file2request)); + } + + DownloadFolder.Unlock(); + } + public void Apply() + { + ApplyFolder.CreateFolder(); + + ApplyFolder.Lock(SkipLock); + + if (UpdatePlanResponse.FilesToApply is object) + UpdatePlanResponse.FilesToApply.ForEach(ApplyFile); + + if (UpdatePlanResponse.FilesToRequest is object) + UpdatePlanResponse.FilesToRequest.ForEach(ApplyFile); + + ApplyFolder.SaveCurrentInfo("current"); + } + public void ApplyFile(UpdateFileDC file2apply) + { + var apply_path = ApplyFolder.Combine(file2apply.RelativePath); + var download_path = DownloadFolder.Combine(file2apply.RelativePath); + + Path.GetDirectoryName(apply_path).CreateFolder(); + download_path.CopyFileTo(apply_path); + + Feedback((int)LauncherProgress.ApplyUpdate, new ApplyFileEventArgs(file2apply.RelativePath)); + } + public void Delete() + { + foreach (var file2delete in UpdatePlanResponse.FilesToDeleteInApply) + { + var delete_path = ApplyFolder.Combine(file2delete.RelativePath); + + delete_path.DeleteFile(); + + Feedback((int)LauncherProgress.DeleteUpdate, file2delete.RelativePath); + } + } + public void Cleanup() + { + ApplyFolder.DeleteEmptyDirectories(); + + DownloadFolder.ClearFolder(); + + ApplyFolder.Unlock(); + } + + private void CreateUpdatePlanRequest() + { + UpdatePlanRequest = new UpdatePlanRequest(); + + if (UpdatePlanRequest.PlanerRootFolderExists = LauncherPaths.ActualPlanerLocation.Exists()) + { + if (UpdatePlanRequest.DownloadFolderExists = DownloadFolder.Exists()) + if (!(UpdatePlanRequest.DownloadFolderIsEmpty = DownloadFolder.IsFolderEmpty())) + UpdatePlanRequest.DownloadedFiles = FileController.GetDownloadedFiles(DownloadFolder); + + if (UpdatePlanRequest.ApplyFolderExists = ApplyFolder.Exists()) + if (!(UpdatePlanRequest.ApplyFolderIsEmpty = ApplyFolder.IsFolderEmpty())) + UpdatePlanRequest.ApplyPackage = FileController.GetApplyPackage(ApplyFolder); + } + + UpdatePlanRequest.Login = new LoginDC() + { + Username = SessionInformation.Login.Username, + Password = SessionInformation.Login.Password, + CoreServerAddress = SessionInformation.Connection.CoreServerAddress, + Pin = SessionInformation.Login.Pin, + ClientID = SessionInformation.Login.ClientId, + CheckTenant = true, + TempUsername = SessionInformation.Login.TempUsername, + }; + } + + private UpdateFileResponse AskForFile(UpdateFileRequest request) + { + return LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdateFile(request)); + } + + private void GetUpdatePlanResponse() + { + UpdatePlanResponse = LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdatePlan(UpdatePlanRequest)); + + // UpdatePlanResponse.FilesToApply.AddRange(UpdatePlanResponse.FilesToRequest); + } + } +} diff --git a/BeWoLauncher/Logic/Utils/LauncherAppdataConfig.cs b/BeWoLauncher/Logic/Utils/LauncherAppdataConfig.cs new file mode 100644 index 000000000..81d3f4e92 --- /dev/null +++ b/BeWoLauncher/Logic/Utils/LauncherAppdataConfig.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWoLauncher.Logic.Utils +{ + public static class LauncherAppdataConfig + { + public static string GetInstallLocation() + { + return Properties.Settings.Default.InstallLocation; + } + + public static void SetInstallLocation(string path) + { + Properties.Settings.Default.InstallLocation = path; + Properties.Settings.Default.Save(); + } + + public static bool GetFirstInstallationSuccess() + { + return Properties.Settings.Default.FirstInstallationSuccess; + } + + public static void SetFirstInstallationSuccess(bool b) + { + Properties.Settings.Default.FirstInstallationSuccess = b; + Properties.Settings.Default.Save(); + } + } +} diff --git a/BeWoLauncher/Logic/Utils/LauncherPaths.cs b/BeWoLauncher/Logic/Utils/LauncherPaths.cs new file mode 100644 index 000000000..ac145715e --- /dev/null +++ b/BeWoLauncher/Logic/Utils/LauncherPaths.cs @@ -0,0 +1,127 @@ +using BeWoLauncher.Logic.Controller; +using BS.SharedLauncher.Extensions; +using BS.SharedLauncher.Information; +using BS.SharedLauncher.Logic; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace BeWoLauncher.Logic.Utils +{ + public static class LauncherPaths + { + private static readonly string planerExeName = "BeWoPlaner.exe"; + + //private static readonly string versionXml = "bewo.version"; + + public static string LoginSelectionPlanerLocation { get; set; } + public static string ActualPlanerLocation { get; set; } + + /// + /// Holt den Install Ort aus den Properties Settings. + /// Sollte dieser nicht verfügbar sein, wird als default - "CurrentBaseDir"/BeWoPlaner - verwendet + /// + /// + public static string GetInstallLocationFromSettingOrDefault() + { + var installLocation = GetInstallLocationFromSetting(); + + if (string.IsNullOrWhiteSpace(installLocation)) + { + installLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, BeWoPathFileConfig.SubDirectory); + } + + return installLocation; + } + + public static string GetInstallLocationFromSetting() + { + return LauncherAppdataConfig.GetInstallLocation(); + } + + /// + /// + /// + /// + /// Gibt true aus, wenn der Path sich verändert hat. + public static bool ChangePath(string newLocation) + { + var info = new DirectoryInfo(newLocation); + + if (LoginSelectionPlanerLocation == newLocation) + { + return false; + } + + //if (newLocation.Exists() && (info.GetDirectories().Any() || info.GetFiles().Any())) + //{ + // MessageBox.Show($"Ordner muss leer sein! Es sind {info.GetDirectories().Count()} Ordner und {info.GetFiles().Count()} Datei(en) enthalten"); + // return false; + //} + + // Annahme: Ordner ist leer und neuer Ort + LoginSelectionPlanerLocation = newLocation; + + return true; + } + + public static void SetAndSaveInstallLocation(string path) + { + ActualPlanerLocation = path; + + LauncherAppdataConfig.SetInstallLocation(path); + } + + + public static string GetRootPath() + { + return ActualPlanerLocation; + } + public static string GetLoggerPath() + { + return Path.Combine(new string[] { GetRootPath(), "log" }); + } + public static string GetDownloadPath() + { + return Path.Combine(new string[] { GetRootPath(), "download" }); + } + public static string GetApplyPath() + { + return Path.Combine(new string[] { GetRootPath(), "apply" }); + } + public static string GetPlanerExeName() => planerExeName; + public static string GetPlanerExePath() + { + return Path.Combine(GetApplyPath(), GetPlanerExeName()); + } + + public static void SaveCurrentInfo(this string path, string file) + { + FileController.SaveInfo(path.Combine(file), DownloadController.Manager.UpdatePlanResponse.CurrentPackage); + } + + public static void SaveFile(this string path, byte[] data) + { + FileController.SaveFile(path, data); + } + + public static void CopyFileTo(this string source, string destination) + { + FileController.CopyFile(source, destination); + } + + public static void DeleteFile(this string file) + { + FileController.DeleteFile(file); + } + + public static void DeleteEmptyDirectories(this string dir) + { + FileController.DeleteEmptyDirectories(dir); + } + } +} \ No newline at end of file diff --git a/BeWoLauncher/Logic/Utils/LauncherUtils.cs b/BeWoLauncher/Logic/Utils/LauncherUtils.cs new file mode 100644 index 000000000..4b33d7fce --- /dev/null +++ b/BeWoLauncher/Logic/Utils/LauncherUtils.cs @@ -0,0 +1,81 @@ +using BeWoLauncher.ServiceProxy; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.ServiceModel; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; + +namespace BeWoLauncher.Logic.Utils +{ + public static class LauncherUtils + { + public static Dictionary ParseQuery(string query) + { + try + { + if (query.IndexOf('?') >= 0) + { + query = query.Split('?')[1]; + + var valueArray = Regex.Split(query, @"[\&]{0,1}[A-Za-z0-9]+[\=]{1}"); + var paramArray = Regex.Split(query, @"[\=][A-Za-z0-9;]+"); + + valueArray = valueArray.Where(t => !string.IsNullOrWhiteSpace(t)).ToArray(); + paramArray = paramArray.Where(t => !string.IsNullOrWhiteSpace(t)).ToArray(); + + var queryDictionary = new Dictionary(); + + int ixg = 0; + foreach (var item in paramArray) + { + queryDictionary.Add(item.Contains("&") ? Regex.Split(item, @"[\?]|[\&]")[1] : item, + valueArray[ixg]); + ixg++; + if (ixg >= valueArray.Length) + break; + } + + return queryDictionary; + } + return new Dictionary(); + } + catch (Exception ex) + { + throw new Exception(String.Format("Error while parsing query '{0}'\n{1}", query, ex.Message), ex); + } + } + public static string GetAndCreateUserAppDataPath() + { + try + { + string localAppData = Environment.GetFolderPath( + Environment.SpecialFolder.LocalApplicationData); + string companyFilePath + = Path.Combine(localAppData, "beyondSoft"); + + if (!Directory.Exists(companyFilePath)) + Directory.CreateDirectory(companyFilePath); + + string bewoFilePath + = Path.Combine(companyFilePath, "BeWoPlaner"); + + if (!Directory.Exists(bewoFilePath)) + Directory.CreateDirectory(bewoFilePath); + + return bewoFilePath; + } + catch (Exception ex) + { + MessageBox.Show( + "Fehler beim Anlegen des Anwendungsordners. Sie besitzen nicht die erforderlichen Rechte, bitte wenden Sie sich an Ihren Systemadministrator.\n" + + ex.Message, "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + } + } +} diff --git a/BeWoLauncher/Logic/ViewBuilder.cs b/BeWoLauncher/Logic/ViewBuilder.cs new file mode 100644 index 000000000..b9c41357a --- /dev/null +++ b/BeWoLauncher/Logic/ViewBuilder.cs @@ -0,0 +1,218 @@ +using BeWoLauncher.Logic.Behavior; +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.View; +using BeWoLauncher.View.Frames; +using BS.SharedLauncher.Enums; +using System; +using System.Threading.Tasks; +using System.Windows.Controls; +using static BeWoLauncher.Logic.Controller.ViewController; + +namespace BeWoLauncher.Logic +{ + public class ViewBuilder + { + public ViewBuilder() + { + + } + + public UserControl GetNewView(ViewType type) + { + switch (type) + { + case ViewType.LoginView: + return getLoginView(); + } + + throw new NotImplementedException("ViewBuilder: View nicht implementiert"); + } + + public FrameBase GetNewFrame(FrameType type) + { + switch (type) + { + case FrameType.GenericFail: + return getGenericFailedFrame(); + case FrameType.InstallInfo: + return getInstallInfoFrame(); + case FrameType.InstallProgress: + return getInstallProgressFrame(); + case FrameType.InstallFailed: + return getInstallFailedFrame(); + case FrameType.UpdateInfo: + return getUpdateInfoFrame(); + case FrameType.UpdateProgress: + return getUpdateProgressFrame(); + case FrameType.UpdateFailed: + return getUpdateFailedFrame(); + case FrameType.UninstallInfo: + return getUninstallInfoFrame(); + case FrameType.UninstallProgress: + return getUninstallProgressFrame(); + case FrameType.UninstallFailed: + return getUninstallFailedFrame(); + case FrameType.UninstallSuccessful: + return getUninstallSuccessfulFrame(); + case FrameType.LoadingScreen: + return getLoadingScreenFrame(); + case FrameType.NoPermissionInfo: + return getNoPermissionInfoFrame(); + } + + throw new NotImplementedException("ViewBuilder: Frame nicht implementiert"); + } + + private UserControl getLoginView() + { + var login = new LoginView(); + + login.Loaded += CheckForAutoLogin; + login.LoginSuccessful += ViewBehavior.LoginSuccessful; + + return login; + } + + private FrameBase getNoPermissionInfoFrame() + { + var noper = new InfoFrame(); + + noper.Title = "Keine Rechte auf Speicherort!"; + noper.Text = "Es liegt eine neue Version. Sie besitzen aber nicht die benötigten Rechte, um diese anzuwenden. Bitte wenden Sie sich an Ihren System-Administrator!"; + + noper.Button1Click += ViewBehavior.BackToLogin; + + return noper; + } + + private FrameBase getLoadingScreenFrame() + { + var loading = new LoadingScreen(); + + loading.Loaded += (s,e)=> ViewController.LaunchBehavior.LaunchPlaner(); + + return loading; + } + + private FrameBase getUninstallSuccessfulFrame() + { + var uninstallSuccessful = new InfoFrame(); + + uninstallSuccessful.Title = "Deinstallation erfolgreich!"; + uninstallSuccessful.Text = "Kehre zum Login zurück..."; + uninstallSuccessful.CollapseCopyButton(); + + uninstallSuccessful.Button1Click += ViewBehavior.BackToLogin; + + return uninstallSuccessful; + } + + private FrameBase getUninstallFailedFrame() + { + var uninstallFailed = new InfoFrame(); + + uninstallFailed.Title = "Deinstallation fehlgeschlagen!"; + uninstallFailed.Text = Error.ToString(); + + uninstallFailed.Button1Click += ViewBehavior.BackToLogin; + + return uninstallFailed; + } + + private FrameBase getUninstallProgressFrame() + { + var progress = new ProgressFrame(LauncherMode.Update); + + progress.Successful += ViewBehavior.UninstallSuccess; + progress.Exception += ViewBehavior.UninstallFailed; + + return progress; + } + + private FrameBase getUninstallInfoFrame() + { + var uninstall = new UninstallInfoFrame(); + + uninstall.Accept += ViewBehavior.UninstallStarting; + uninstall.Abort += ViewBehavior.BackToLogin; + + return uninstall; + } + + private FrameBase getUpdateFailedFrame() + { + var updateError = new InfoFrame(); + + updateError.Title = "Update fehlgeschlagen!"; + updateError.Text = Error.ToString(); + + updateError.Button1Click += ViewBehavior.BackToLogin; + + return updateError; + } + + private FrameBase getUpdateProgressFrame() + { + var progress = new ProgressFrame(LauncherMode.Update); + + progress.Successful += ViewBehavior.UpdateSuccess; + progress.Exception += ViewBehavior.UpdateFailed; + + return progress; + } + + private FrameBase getUpdateInfoFrame() + { + var update = new UpdateInfoFrame(); + + update.Accept += ViewBehavior.UpdateStarting; + update.Abort += ViewBehavior.BackToLogin; + + return update; + } + + private FrameBase getInstallFailedFrame() + { + var installError = new InfoFrame(); + + installError.Title = "Installation fehlgeschlagen!"; + installError.Text = Error.ToString(); + + installError.Button1Click += ViewBehavior.BackToLogin; + + return installError; + } + + private FrameBase getGenericFailedFrame() + { + var genError = new InfoFrame(); + + genError.Title = "Loader fehlgeschlagen!"; + genError.Text = Error.ToString(); + + genError.Button1Click += ViewBehavior.BackToLogin; + + return genError; + } + + private FrameBase getInstallProgressFrame() + { + var progress = new ProgressFrame(LauncherMode.Install); + + progress.Successful += ViewBehavior.InstallSuccesss; + progress.Exception += ViewBehavior.InstallFailed; + + return progress; + } + + private FrameBase getInstallInfoFrame() + { + var install = new InstallInfoFrame(); + + install.Accept += ViewBehavior.InstallInfoAccept; + install.Abort += ViewBehavior.BackToLogin; + + return install; + } + } +} diff --git a/BeWoLauncher/Models/ConnectionProfile.cs b/BeWoLauncher/Models/ConnectionProfile.cs new file mode 100644 index 000000000..4fa6ee9c9 --- /dev/null +++ b/BeWoLauncher/Models/ConnectionProfile.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWoLauncher.Models +{ + public class ConnectionProfile + { + public string Name { get; set; } + public string Server { get; set; } + public string Tenant { get; set; } + + public ConnectionProfile(string pname, string pserver, string ptenant) + { + Name = pname; + Server = pserver; + Tenant = ptenant; + if (Name == null) + Name = String.Empty; + } + + public override string ToString() + { + return Name; + } + + // Mistery Bug: + //public override int GetHashCode() + //{ + // String key = String.Format("{0}_{1}_{2}", Name, Server, Tenant); + // return key.GetHashCode(); + //} + + //public override bool Equals(object obj) + //{ + // var profile = obj as ConnectionProfile; + // if (profile == null) + // { + // return false; + // } + // String key1 = String.Format("{0}_{1}_{2}", Name, Server, Tenant); + // String key2 = String.Format("{0}_{1}_{2}", profile.Name, profile.Server, profile.Tenant); + // return key1.Equals(key2); + //} + } +} diff --git a/BeWoLauncher/Properties/AssemblyInfo.cs b/BeWoLauncher/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..305c95649 --- /dev/null +++ b/BeWoLauncher/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("BeWoLauncher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("beyondSoft GmbH")] +[assembly: AssemblyProduct("BeWoPlaner")] +[assembly: AssemblyCopyright("Copyright © 2013 beyondSoft GmbH")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie +//ImCodeVerwendeteKultur in der .csproj-Datei +//in einer fest. Wenn Sie in den Quelldateien beispielsweise Deutsch +//(Deutschland) verwenden, legen Sie auf \"de-DE\" fest. Heben Sie dann die Auskommentierung +//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile, +//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher + //(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird, + // oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.) + ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs + //(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird, + // designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.) +)] + + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] diff --git a/BeWoLauncher/Properties/Resources.Designer.cs b/BeWoLauncher/Properties/Resources.Designer.cs new file mode 100644 index 000000000..e934e4469 --- /dev/null +++ b/BeWoLauncher/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoLauncher.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BeWoLauncher.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/BeWoLauncher/Properties/Resources.resx b/BeWoLauncher/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/BeWoLauncher/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BeWoLauncher/Properties/Settings.Designer.cs b/BeWoLauncher/Properties/Settings.Designer.cs new file mode 100644 index 000000000..3dbb00994 --- /dev/null +++ b/BeWoLauncher/Properties/Settings.Designer.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoLauncher.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string InstallLocation { + get { + return ((string)(this["InstallLocation"])); + } + set { + this["InstallLocation"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool FirstInstallationSuccess { + get { + return ((bool)(this["FirstInstallationSuccess"])); + } + set { + this["FirstInstallationSuccess"] = value; + } + } + } +} diff --git a/BeWoLauncher/Properties/Settings.settings b/BeWoLauncher/Properties/Settings.settings new file mode 100644 index 000000000..f4fc75103 --- /dev/null +++ b/BeWoLauncher/Properties/Settings.settings @@ -0,0 +1,12 @@ + + + + + + + + + False + + + \ No newline at end of file diff --git a/BeWoLauncher/Properties/licenses.licx b/BeWoLauncher/Properties/licenses.licx new file mode 100644 index 000000000..e69de29bb diff --git a/BeWoLauncher/ServiceProxy/LauncherGenerated.cs b/BeWoLauncher/ServiceProxy/LauncherGenerated.cs new file mode 100644 index 000000000..f096a7629 --- /dev/null +++ b/BeWoLauncher/ServiceProxy/LauncherGenerated.cs @@ -0,0 +1,403 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoLauncher.ServiceProxy +{ + using System.Runtime.Serialization; + + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + public partial class BeWoFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged + { + + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; + + private BeWoLauncher.ServiceProxy.BeWoFaultType FaultTypeField; + + private string InnerExceptionMessageField; + + private string InnerExceptionStackTraceField; + + private string MessageField; + + private string StackTraceField; + + public System.Runtime.Serialization.ExtensionDataObject ExtensionData + { + get + { + return this.extensionDataField; + } + set + { + this.extensionDataField = value; + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public BeWoLauncher.ServiceProxy.BeWoFaultType FaultType + { + get + { + return this.FaultTypeField; + } + set + { + if ((this.FaultTypeField.Equals(value) != true)) + { + this.FaultTypeField = value; + this.RaisePropertyChanged("FaultType"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string InnerExceptionMessage + { + get + { + return this.InnerExceptionMessageField; + } + set + { + if ((object.ReferenceEquals(this.InnerExceptionMessageField, value) != true)) + { + this.InnerExceptionMessageField = value; + this.RaisePropertyChanged("InnerExceptionMessage"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string InnerExceptionStackTrace + { + get + { + return this.InnerExceptionStackTraceField; + } + set + { + if ((object.ReferenceEquals(this.InnerExceptionStackTraceField, value) != true)) + { + this.InnerExceptionStackTraceField = value; + this.RaisePropertyChanged("InnerExceptionStackTrace"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string Message + { + get + { + return this.MessageField; + } + set + { + if ((object.ReferenceEquals(this.MessageField, value) != true)) + { + this.MessageField = value; + this.RaisePropertyChanged("Message"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string StackTrace + { + get + { + return this.StackTraceField; + } + set + { + if ((object.ReferenceEquals(this.StackTraceField, value) != true)) + { + this.StackTraceField = value; + this.RaisePropertyChanged("StackTrace"); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected void RaisePropertyChanged(string propertyName) + { + System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if ((propertyChanged != null)) + { + propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name="BeWoFaultType", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + public enum BeWoFaultType : int + { + + [System.Runtime.Serialization.EnumMemberAttribute()] + Unknown = 0, + + [System.Runtime.Serialization.EnumMemberAttribute()] + Concurrency = 1, + + [System.Runtime.Serialization.EnumMemberAttribute()] + DeleteNotPossible = 2, + + [System.Runtime.Serialization.EnumMemberAttribute()] + LoginNameTaken = 3, + + [System.Runtime.Serialization.EnumMemberAttribute()] + CustomWithoutDetails = 4, + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.ILauncherService")] + public interface ILauncherService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/IsUserValid", ReplyAction="http://tempuri.org/ILauncherService/IsUserValidResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/IsUserValidBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetTenantResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetTenant(string tenant); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetAllTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetAllTenantResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetAllTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetAllTenant(); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/GetEmailForUserName", ReplyAction="http://tempuri.org/ILauncherService/GetEmailForUserNameResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/GetEmailForUserNameBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword", ReplyAction="http://tempuri.org/ILauncherService/CheckPasswordResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword2", ReplyAction="http://tempuri.org/ILauncherService/CheckPassword2Response")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPassword2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ChangePassword", ReplyAction="http://tempuri.org/ILauncherService/ChangePasswordResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ChangePasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + long ChangePassword(string pUserName, string pOldPassword, string pNewPassword); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetPasswordInfo", ReplyAction="http://tempuri.org/ILauncherService/ResetPasswordInfoResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetPasswordInfoBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void ResetPasswordInfo(string pUserName, string pPassword); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface ILauncherServiceChannel : BeWoLauncher.ServiceProxy.ILauncherService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class LauncherServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.ILauncherService + { + + public LauncherServiceClient() + { + } + + public LauncherServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public LauncherServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public LauncherServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public LauncherServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant) + { + return base.Channel.IsUserValid(pUserName, pPassword, pPIN, clientId, checkTenant); + } + + public void ResetTenant(string tenant) + { + base.Channel.ResetTenant(tenant); + } + + public void ResetAllTenant() + { + base.Channel.ResetAllTenant(); + } + + public bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName) + { + return base.Channel.GetEmailForUserName(out email, pUserName, serverName); + } + + public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword) + { + return base.Channel.CheckPassword(userOid, pOldPassword, pNewPassword); + } + + public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword) + { + return base.Channel.CheckPassword2(username, pOldPassword, pNewPassword); + } + + public long ChangePassword(string pUserName, string pOldPassword, string pNewPassword) + { + return base.Channel.ChangePassword(pUserName, pOldPassword, pNewPassword); + } + + public void ResetPasswordInfo(string pUserName, string pPassword) + { + base.Channel.ResetPasswordInfo(pUserName, pPassword); + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.IEnumTranslationService")] + public interface IEnumTranslationService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEnumTranslationService/GetTranslation", ReplyAction="http://tempuri.org/IEnumTranslationService/GetTranslationResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IEnumTranslationService/GetTranslationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetTranslation(string e, short value); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IEnumTranslationServiceChannel : BeWoLauncher.ServiceProxy.IEnumTranslationService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class EnumTranslationServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.IEnumTranslationService + { + + public EnumTranslationServiceClient() + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public EnumTranslationServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public EnumTranslationServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public string GetTranslation(string e, short value) + { + return base.Channel.GetTranslation(e, value); + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.IDownloadBeWoService")] + public interface IDownloadBeWoService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/Download2", ReplyAction="http://tempuri.org/IDownloadBeWoService/Download2Response")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/Download2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdateRequest request); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/DownloadInfo", ReplyAction="http://tempuri.org/IDownloadBeWoService/DownloadInfoResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/DownloadInfoBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdateRequest request); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/GetUpdatePlan", ReplyAction="http://tempuri.org/IDownloadBeWoService/GetUpdatePlanResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/GetUpdatePlanBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdateRequest request); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/GetUpdateFile", ReplyAction="http://tempuri.org/IDownloadBeWoService/GetUpdateFileResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/GetUpdateFileBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IDownloadBeWoServiceChannel : BeWoLauncher.ServiceProxy.IDownloadBeWoService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class DownloadBeWoServiceClient : System.ServiceModel.ClientBase, BeWoLauncher.ServiceProxy.IDownloadBeWoService + { + + public DownloadBeWoServiceClient() + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public DownloadBeWoServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public DownloadBeWoServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdateRequest request) + { + return base.Channel.Download2(request); + } + + public BS.SharedLauncher.DataContract.UpdateResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdateRequest request) + { + return base.Channel.DownloadInfo(request); + } + + public BS.SharedLauncher.DataContract.UpdateResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdateRequest request) + { + return base.Channel.GetUpdatePlan(request); + } + + public BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request) + { + return base.Channel.GetUpdateFile(request); + } + } +} diff --git a/BeWoLauncher/Styles/OrangeBlack.xaml b/BeWoLauncher/Styles/OrangeBlack.xaml new file mode 100644 index 000000000..5bbf9aa49 --- /dev/null +++ b/BeWoLauncher/Styles/OrangeBlack.xaml @@ -0,0 +1,4088 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + M 0 0 L 3.5 4 L 7 0 Z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWoLauncher/SvcUtil.exe b/BeWoLauncher/SvcUtil.exe new file mode 100644 index 000000000..c81ea03b1 Binary files /dev/null and b/BeWoLauncher/SvcUtil.exe differ diff --git a/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml b/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml new file mode 100644 index 000000000..4db57510c --- /dev/null +++ b/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + WICHTIG! Bitte tragen Sie keine echten Daten bei Ihren Tests ein, da es sich um einen öffentlichen Testzugang handelt, auf den jeder Zugriff hat! + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml.cs b/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml.cs new file mode 100644 index 000000000..b4799bd0e --- /dev/null +++ b/BeWoLauncher/View/Components/ConfirmDemoDialog.xaml.cs @@ -0,0 +1,51 @@ +using System; +using System.Windows; +using System.Windows.Threading; + +namespace BeWoLauncher.Components +{ + /// + /// Interaktionslogik für ConfirmDemoDialog.xaml + /// + public partial class ConfirmDemoDialog : Window + { + public ConfirmDemoDialog() + { + InitializeComponent(); + CountButton.Content = "Bitte warten (10 sek.)"; + CountButton.IsEnabled = false; + + this.Loaded += new RoutedEventHandler(ConfirmDemoDialog_Loaded); + + } + + void ConfirmDemoDialog_Loaded(object sender, RoutedEventArgs e) + { + + int count = 9; + + new DispatcherTimer( + TimeSpan.FromMilliseconds(1000), + DispatcherPriority.Background, + (s1, e1) => + { + CountButton.Content = String.Format("Bitte warten ({0} sek.)", count); + + if (count-- == 0) + { + CountButton.Content = "OK"; + CountButton.IsEnabled = true; + ((DispatcherTimer) s1).Stop(); + } + }, + this.Dispatcher).Start(); + } + + + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + //DialogResult = true; + Close(); + } + } +} diff --git a/BeWoLauncher/View/Components/EnterTenantDialog.xaml b/BeWoLauncher/View/Components/EnterTenantDialog.xaml new file mode 100644 index 000000000..e85c35812 --- /dev/null +++ b/BeWoLauncher/View/Components/EnterTenantDialog.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bitte geben Sie Ihre 10-stellige Kundennummer ein: + + + + Demo Zugang nutzen + + + + + + + + diff --git a/BeWoLauncher/View/Components/EnterTenantDialog.xaml.cs b/BeWoLauncher/View/Components/EnterTenantDialog.xaml.cs new file mode 100644 index 000000000..1e01692b1 --- /dev/null +++ b/BeWoLauncher/View/Components/EnterTenantDialog.xaml.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BeWoLauncher.Components +{ + /// + /// Interaktionslogik für EnterTenantDialog.xaml + /// + public partial class EnterTenantDialog : Window + { + public EnterTenantDialog() + { + InitializeComponent(); + } + + private String oldTenant = String.Empty; + + public String Tenant + { + get { return txtTenant.Text; } + set + { + txtTenant.Text = value; + txtTenant.Focus(); + txtTenant.SelectAll(); + } + } + + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + DialogResult = true; + } + + private void ToggleButton_OnChecked(object sender, RoutedEventArgs e) + { + oldTenant = txtTenant.Text; + txtTenant.Text = "demo"; + txtTenant.IsEnabled = false; + } + + private void ToggleButton_OnUnchecked(object sender, RoutedEventArgs e) + { + txtTenant.Text = oldTenant; + txtTenant.IsEnabled = true; + } + } +} diff --git a/BeWoLauncher/View/Components/ExceptionMessageBox.xaml b/BeWoLauncher/View/Components/ExceptionMessageBox.xaml new file mode 100644 index 000000000..9603a27e2 --- /dev/null +++ b/BeWoLauncher/View/Components/ExceptionMessageBox.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Components/MessageDialog.xaml.cs b/BeWoLauncher/View/Components/MessageDialog.xaml.cs new file mode 100644 index 000000000..2fcce003c --- /dev/null +++ b/BeWoLauncher/View/Components/MessageDialog.xaml.cs @@ -0,0 +1,122 @@ +using BeWoLauncher.ServiceProxy; +using BS.SharedLauncher; +using BS.SharedLauncher.Enums; +using BS.SharedLauncher.Information; +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Threading; +using System.Xaml; +using XamlReader = System.Windows.Markup.XamlReader; + +namespace BeWoLauncher.Components +{ + public partial class MessageDialog + { + public MessageDialog() + { + InitializeComponent(); + DataContext = this; + + OkayButton.Visibility = Visibility.Collapsed; + } + + public MessageDialog(Action pAfterPasswordConfirmationCallBack) + { + IsInConfirmationWithPasswordMode = true; + + AfterPasswordConfirmationCallBack = pAfterPasswordConfirmationCallBack; + + InitializeComponent(); + DataContext = this; + + OkayButton.IsDefault = true; + CountButton.IsDefault = false; + } + + public Action AfterPasswordConfirmationCallBack { get; set; } + + public bool IsInConfirmationWithPasswordMode { get; set; } + + private ICommand _OpenBrowserCommand; + public ICommand OpenBrowserCommand => _OpenBrowserCommand ?? (_OpenBrowserCommand = new OpenBrowserCommandImpl()); + + public class OpenBrowserCommandImpl : ICommand + { + public bool CanExecute(object parameter) + { + return true; + } + + public event EventHandler CanExecuteChanged; + + public void Execute(object parameter) + { + if (parameter != null) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(parameter.ToString())); + } + } + } + + public void SetXaml(string xamlCode) + { + try + { + if(XamlReader.Parse(xamlCode) is UIElement element) + { + txtMessage.Visibility = Visibility.Collapsed; + rootGrid.Children.Add(element); + } + } + catch(Exception e) + { + //ignore + } + } + + public string Message + { + get => txtMessage.Text; + set => txtMessage.Text = value; + } + + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + //DialogResult = true; + Close(); + } + private void OpenBrowserCommand_Executed(object sender, ExecutedRoutedEventArgs e) + { + if (e.OriginalSource is Hyperlink) + { + System.Diagnostics.Process.Start( + new System.Diagnostics.ProcessStartInfo((e.OriginalSource as Hyperlink).NavigateUri.ToString())); + } + } + + private void OpenBrowserCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) + { + e.CanExecute = true; + e.Handled = true; + } + + private void OkayButton_OnClick(object sender, RoutedEventArgs e) + { + LauncherServiceFacade.DoLauncherServiceAsync(u => u.IsUserValid(SessionInformation.Login.Username, PasswordBox.Password, null, null, false), result => + { + if(result == UserValidationResult.UserValid) + { + AfterPasswordConfirmationCallBack?.Invoke(); + Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)Close); + } + else + { + MessageBox.Show("Anmeldeinformationen nicht bekannt. Bitte überprüfen Sie den Benutzernamen und das Passwort!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + }, true); + } + } +} diff --git a/BeWoLauncher/View/Components/PasswortAenderungsView.xaml b/BeWoLauncher/View/Components/PasswortAenderungsView.xaml new file mode 100644 index 000000000..aead48f68 --- /dev/null +++ b/BeWoLauncher/View/Components/PasswortAenderungsView.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + www.beyondsoft.de + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/FrameView.xaml.cs b/BeWoLauncher/View/FrameView.xaml.cs new file mode 100644 index 000000000..898b7ce1f --- /dev/null +++ b/BeWoLauncher/View/FrameView.xaml.cs @@ -0,0 +1,66 @@ +using BeWoLauncher.Logic; +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.View.Frames; +using BeWoLauncher.WindowImp; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWoLauncher.View +{ + /// + /// Interaktionslogik für BeWoLoginBorder.xaml + /// + public partial class FrameView : UserControl + { + public FrameView() + { + InitializeComponent(); + + DateTime dt = new DateTime(2017, 1, 1); + if (DateTime.Now > dt) + dt = DateTime.Now; + + txtCopyright.Text = String.Format("Copyright {0:yyyy} | beyondSoft GmbH", dt); + + lblVersion.Content = LauncherApp.Version; + } + + public FrameView(FrameBase frame) : this() + { + SetFrame(frame); + } + + private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo((sender as Hyperlink).NavigateUri.ToString())); + } + public FrameBase GetFrame() + { + return contentGrid.Children?[0] as FrameBase; + } + + public void SetFrame(FrameBase uc) + { + ClearFrame(); + contentGrid.Children.Add(uc); + } + + public void ClearFrame() + { + contentGrid.Children.Clear(); + } + } +} diff --git a/BeWoLauncher/View/Frames/FrameBase.cs b/BeWoLauncher/View/Frames/FrameBase.cs new file mode 100644 index 000000000..6b889a5b1 --- /dev/null +++ b/BeWoLauncher/View/Frames/FrameBase.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace BeWoLauncher.View.Frames +{ + public class FrameBase : UserControl + { + } +} diff --git a/BeWoLauncher/View/Frames/InfoFrame.xaml b/BeWoLauncher/View/Frames/InfoFrame.xaml new file mode 100644 index 000000000..8d07f6b16 --- /dev/null +++ b/BeWoLauncher/View/Frames/InfoFrame.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + Hier könnte ihre Fehlermeldung stehen! + + + + diff --git a/BeWoLauncher/View/Frames/InfoFrame.xaml.cs b/BeWoLauncher/View/Frames/InfoFrame.xaml.cs new file mode 100644 index 000000000..37ddb3978 --- /dev/null +++ b/BeWoLauncher/View/Frames/InfoFrame.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für ErrorScreen.xaml + /// + public partial class InfoFrame : FrameBase + { + public event EventHandler Button1Click; + + public InfoFrame() + { + InitializeComponent(); + } + + public string Title + { + get => lblTitle.Content as string; + set => lblTitle.Content = value; + } + + public string Text + { + get => txtField2.Text; + set => txtField2.Text = value; + } + + public void CollapseCopyButton() => btnCopy.Visibility = Visibility.Collapsed; + + private void Button_Click(object sender, RoutedEventArgs e) + { + System.Windows.Clipboard.SetText(Text); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + Button1Click.Invoke(this, new EventArgs()); + } + } +} diff --git a/BeWoLauncher/View/Frames/InstallInfoFrame.xaml b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml new file mode 100644 index 000000000..dba8bed7e --- /dev/null +++ b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs new file mode 100644 index 000000000..767912151 --- /dev/null +++ b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs @@ -0,0 +1,105 @@ +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.Logic.Utils; +using BS.SharedLauncher.Information; +using BS.SharedLauncher.Utils; +using System; +using System.IO; +using System.Windows; +using Path = System.IO.Path; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für UpdateInfo1.xaml + /// + public partial class InstallInfoFrame : FrameBase + { + public event EventHandler Accept; + public event EventHandler Abort; + + public InstallInfoFrame() + { + InitializeComponent(); + + InstallLocation = LauncherPaths.GetInstallLocationFromSettingOrDefault(); + + var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.UpdatePlanResponse.DownloadSize).Split(' '); + + lblErforderlich.Content = size[0]; + lblErforderlichSize.Content = size[1]; + + lblversion.Content = DownloadController.Manager.UpdatePlanResponse.CurrentPackage.Version; + } + + public string InstallLocation + { + get + { + return LauncherPaths.LoginSelectionPlanerLocation; + } + set + { + if (!endPathWithSubDir(value)) + value = Path.Combine(value, BeWoPathFileConfig.SubDirectory); + + if (LauncherPaths.ChangePath(value)) + { + txtLoc.Text = value; + + var size2 = DownloadController.UpdateDiskSpace(LauncherPaths.LoginSelectionPlanerLocation).Split(' '); + + if (size2.Length > 1) + { + lblVerfuegbar.Content = size2[0]; + lblVerfuegbarSize.Content = size2[1]; + } + else + { + lblVerfuegbar.Content = size2[0] ?? "error#87"; + lblVerfuegbarSize.Content = string.Empty; + } + } + } + } + + private void button_installLoc_Click(object sender, RoutedEventArgs rea) + { + // https://stackoverflow.com/questions/11624298/how-to-use-openfiledialog-to-select-a-folder + using (var fbd = new System.Windows.Forms.FolderBrowserDialog()) + { + fbd.SelectedPath = getPathWithoutSubDir(InstallLocation); + + System.Windows.Forms.DialogResult result = fbd.ShowDialog(); + + if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) + { + InstallLocation = fbd.SelectedPath; + } + } + } + + private bool endPathWithSubDir(string path) + { + var dirName = new DirectoryInfo(path).Name; + + return (dirName == BeWoPathFileConfig.SubDirectory); + } + + private string getPathWithoutSubDir(string path) + { + if (endPathWithSubDir(path)) + return Directory.GetParent(path).FullName; + return path; + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + Abort.Invoke(this, new EventArgs()); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + Accept.Invoke(this, new EventArgs()); + } + } +} diff --git a/BeWoLauncher/View/Frames/LoadingFrame.xaml b/BeWoLauncher/View/Frames/LoadingFrame.xaml new file mode 100644 index 000000000..11ff9f3dc --- /dev/null +++ b/BeWoLauncher/View/Frames/LoadingFrame.xaml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/BeWoLauncher/View/Frames/LoadingFrame.xaml.cs b/BeWoLauncher/View/Frames/LoadingFrame.xaml.cs new file mode 100644 index 000000000..90bcc89cc --- /dev/null +++ b/BeWoLauncher/View/Frames/LoadingFrame.xaml.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für LoadingScreen.xaml + /// + public partial class LoadingScreen : FrameBase + { + public LoadingScreen() + { + InitializeComponent(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/BeWoLauncher/View/Frames/ProgressFrame.xaml b/BeWoLauncher/View/Frames/ProgressFrame.xaml new file mode 100644 index 000000000..c1c426bdc --- /dev/null +++ b/BeWoLauncher/View/Frames/ProgressFrame.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Frames/ProgressFrame.xaml.cs b/BeWoLauncher/View/Frames/ProgressFrame.xaml.cs new file mode 100644 index 000000000..ac1a86671 --- /dev/null +++ b/BeWoLauncher/View/Frames/ProgressFrame.xaml.cs @@ -0,0 +1,237 @@ +using BeWoLauncher.Logic.Controller; +using BS.SharedLauncher.Enums; +using BS.SharedLauncher.Update; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Animation; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für UpdateView.xaml + /// + public partial class ProgressFrame : FrameBase + { + private static TimeSpan duration = TimeSpan.FromSeconds(1); + + private int lastStep = -1; + + private string[][] keywords = new string[][] + { + new string[]{"Installation", "Ungebrauchte Datei(en) gefunden." }, + new string[]{"Update", "Ungebrauchte Datei(en) gefunden."}, + new string[]{"Deinstallation", "Deinstallation startet..."}, + }; + private int keyword_mode; + + public readonly BackgroundWorker Worker = new BackgroundWorker(); + public event EventHandler Successful; + public event EventHandler Exception; + + public LauncherMode LauncherMode { get; set; } + + public ProgressFrame(LauncherMode mode) + { + InitializeComponent(); + + proBar1.IsIndeterminate = false; + proBar1.Minimum = 0; + proBar1.Maximum = 100; + + proBar2.IsIndeterminate = false; + proBar2.Minimum = 0; + proBar2.Maximum = DownloadController.Manager.FilesToProcessTotal; + + LauncherMode = mode; + + keyword_mode = (int)mode; + + Loaded += (s, e) => Start(); + } + + private string getKeyword(int pos) => keywords[keyword_mode][pos]; + + public string Message + { + get { return lblMessage.Content as string; } + set { lblMessage.Content = value; } + } + public string SubMessage + { + get { return lblSubmessage.Content as string; } + set { lblSubmessage.Content = value; } + } + + public void Start() + { + var skipLock = bool.TryParse(ConfigurationManager.AppSettings.Get("SkipLock"), out bool c) && c; + + Worker.DoWork += worker_DoWork; + Worker.ProgressChanged += worker_ProgressChanged; + Worker.RunWorkerCompleted += worker_completed; + + Worker.WorkerReportsProgress = true; + + Worker.RunWorkerAsync(skipLock); + } + + void worker_DoWork(object sender, DoWorkEventArgs e) + { + var skipLock = (bool)e.Argument; + var worker = sender as BackgroundWorker; + + DownloadController.Manager.SkipLock = skipLock; + DownloadController.Manager.Feedback = worker.ReportProgress; + + DownloadController.Manager.StartProcess(worker); + } + + private void worker_completed(object sender, RunWorkerCompletedEventArgs e) + { + if (e.Error != null) + { + ViewController.Error = e.Error; + + Exception.Invoke(this, new EventArgs()); + } + else + { + Successful.Invoke(this, new EventArgs()); + } + } + + private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + var progress = (LauncherProgress)e.ProgressPercentage; + var obj = e.UserState; + + switch (progress) + { + case LauncherProgress.ProgressStart: + Message = $"{getKeyword(0)} wird vorbereitet..."; + SubMessage = ""; + Bar2Activate(); + break; + + case LauncherProgress.DownloadStart: + Message = "Download startet..."; + SubMessage = ""; + Bar1Show(); + Bar1Activate(); + Bar1Reset(); + Bar1SetLimit(DownloadController.Manager.FilesToDownloadCount); + break; + + case LauncherProgress.DownloadUpdate: + var args = obj as DownloadProgressEventArgs; + Message = "Download wird ausgeführt..."; + SubMessage = $"{args.File.RelativePath} ({args.Size})\n wurde heruntergeladen..."; + Bar1MakeStep(); + Bar2MakeStep(); + break; + + case LauncherProgress.DownloadFinish: + Message = "Download abgeschlossen!"; + SubMessage = ""; + Bar1Hide(); + break; + + case LauncherProgress.ApplyStart: + Message = "Füge Pakete hinzu..."; + SubMessage = ""; + Bar1Show(); + Bar1Activate(); + Bar1Reset(); + Bar1SetLimit(DownloadController.Manager.FilesToApplyCount); + break; + + case LauncherProgress.ApplyUpdate: + var args2 = obj as ApplyFileEventArgs; + SubMessage = $"{args2.RelativePath}\n wurde installiert..."; + Bar1MakeStep(); + Bar2MakeStep(); + break; + + case LauncherProgress.ApplyFinished: + Message = "Hinzufügen abgeschlossen!"; + SubMessage = ""; + Bar1Hide(); + break; + + case LauncherProgress.DeleteStart: + Message = getKeyword(1); + SubMessage = ""; + Bar1Show(); + Bar1Activate(); + Bar1Reset(); + Bar1SetLimit(DownloadController.Manager.FilesToDeleteInApplyCount); + break; + case LauncherProgress.DeleteUpdate: + var args3 = obj as string; + SubMessage = $"{args3}\n wurde entfernt!"; + Bar1MakeStep(); + Bar2MakeStep(); + break; + + case LauncherProgress.DeleteFinished: + Message = "Säuberung abgeschlossen!"; + SubMessage = ""; + Bar1Hide(); + break; + + case LauncherProgress.CleanupStart: + Message = "Räume hier noch eben auf..."; + SubMessage = ""; + Bar1Show(); + Bar1Deactivate(); + break; + + case LauncherProgress.CleanupUpdate: + break; + + case LauncherProgress.CleanupFinished: + Message = "Blitze blank..."; + SubMessage = ""; + break; + + case LauncherProgress.ProgressEnd: + Message = $"{getKeyword(0)} abgeschlossen!"; + SubMessage = ""; + Bar2Fill(); + break; + default: + break; + } + } + + #region a + public void Bar1Activate() => proBar1.IsIndeterminate = false; + public void Bar1Deactivate() => proBar1.IsIndeterminate = true; + public void Bar1SetLimit(int max) => proBar1.Maximum = max; + public void Bar1Reset() => proBar1.Value = 0; + public void Bar1MakeStep() => proBar1.Value++; + public void Bar1Hide() => proBar1.Visibility = Visibility.Hidden; + public void Bar1Show() => proBar1.Visibility = Visibility.Visible; + + public void Bar2Activate() => proBar2.IsIndeterminate = false; + public void Bar2Deactivate() => proBar2.IsIndeterminate = true; + public void Bar2SetLimit(int max) => proBar2.Maximum = max; + public void Bar2MakeStep() => proBar2.Value++; + public void Bar2MakeStep(int val) => proBar2.Value += val; + public void Bar2Fill() => proBar2.Value = proBar2.Maximum; + public void Bar2Hide() => proBar2.Visibility = Visibility.Hidden; + public void Bar2Show() => proBar2.Visibility = Visibility.Visible; + + public void Bar2SetPercent(double percentage) + { + DoubleAnimation animation = new DoubleAnimation(percentage, duration); + proBar2.BeginAnimation(ProgressBar.ValueProperty, animation); + } + #endregion + } +} diff --git a/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml new file mode 100644 index 000000000..6eff23561 --- /dev/null +++ b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs new file mode 100644 index 000000000..898d450b6 --- /dev/null +++ b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für UpdateInfo3.xaml + /// + public partial class UninstallInfoFrame : FrameBase + { + public event EventHandler Accept; + public event EventHandler Abort; + + public UninstallInfoFrame() + { + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + Abort.Invoke(this, new EventArgs()); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + Accept.Invoke(this, new EventArgs()); + } + } +} diff --git a/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml new file mode 100644 index 000000000..95a2b0c54 --- /dev/null +++ b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs new file mode 100644 index 000000000..fc2cb2cd9 --- /dev/null +++ b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs @@ -0,0 +1,67 @@ +using BeWoLauncher.Logic.Controller; +using BeWoLauncher.Logic.Utils; +using BS.SharedLauncher.Utils; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWoLauncher.View.Frames +{ + /// + /// Interaktionslogik für UpdateInfo2.xaml + /// + public partial class UpdateInfoFrame : FrameBase + { + public event EventHandler Accept; + public event EventHandler Abort; + + public UpdateInfoFrame() + { + InitializeComponent(); + + LauncherPaths.ActualPlanerLocation = LauncherPaths.GetInstallLocationFromSetting(); + + var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.UpdatePlanResponse.DownloadSize).Split(' '); + + lblErforderlich.Content = size[0]; + lblErforderlichSize.Content = size[1]; + + var size2 = DownloadController.UpdateDiskSpace(LauncherPaths.ActualPlanerLocation).Split(' '); + + if(size2.Length > 1) + { + lblVerfuegbar.Content = size2[0]; + lblVerfuegbarSize.Content = size2[1]; + } + else + { + lblVerfuegbar.Content = size2[0] ?? "error#87"; + lblVerfuegbarSize.Content = string.Empty; + } + + lblversion.Content = DownloadController.Manager.UpdatePlanResponse.CurrentPackage.Version; + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + Abort.Invoke(this, new EventArgs()); + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + Accept.Invoke(this, new EventArgs()); + } + } +} diff --git a/BeWoLauncher/View/Icons/16_bulleted_list.png b/BeWoLauncher/View/Icons/16_bulleted_list.png new file mode 100644 index 000000000..8b0f4a583 Binary files /dev/null and b/BeWoLauncher/View/Icons/16_bulleted_list.png differ diff --git a/BeWoLauncher/View/Icons/16_employee.png b/BeWoLauncher/View/Icons/16_employee.png new file mode 100644 index 000000000..947bd4b62 Binary files /dev/null and b/BeWoLauncher/View/Icons/16_employee.png differ diff --git a/BeWoLauncher/View/Icons/16_euro.png b/BeWoLauncher/View/Icons/16_euro.png new file mode 100644 index 000000000..b322ba929 Binary files /dev/null and b/BeWoLauncher/View/Icons/16_euro.png differ diff --git a/BeWoLauncher/View/Icons/16_female.png b/BeWoLauncher/View/Icons/16_female.png new file mode 100644 index 000000000..7c71de03b Binary files /dev/null and b/BeWoLauncher/View/Icons/16_female.png differ diff --git a/BeWoLauncher/View/Icons/16_male.png b/BeWoLauncher/View/Icons/16_male.png new file mode 100644 index 000000000..79f35ccbd Binary files /dev/null and b/BeWoLauncher/View/Icons/16_male.png differ diff --git a/BeWoLauncher/View/Icons/16_report.png b/BeWoLauncher/View/Icons/16_report.png new file mode 100644 index 000000000..779ad58ef Binary files /dev/null and b/BeWoLauncher/View/Icons/16_report.png differ diff --git a/BeWoLauncher/View/Icons/Add24.png b/BeWoLauncher/View/Icons/Add24.png new file mode 100644 index 000000000..f4a806e26 Binary files /dev/null and b/BeWoLauncher/View/Icons/Add24.png differ diff --git a/BeWoLauncher/View/Icons/Alarm.png b/BeWoLauncher/View/Icons/Alarm.png new file mode 100644 index 000000000..5082af3df Binary files /dev/null and b/BeWoLauncher/View/Icons/Alarm.png differ diff --git a/BeWoLauncher/View/Icons/AlertsDisabled.png b/BeWoLauncher/View/Icons/AlertsDisabled.png new file mode 100644 index 000000000..929d236c5 Binary files /dev/null and b/BeWoLauncher/View/Icons/AlertsDisabled.png differ diff --git a/BeWoLauncher/View/Icons/AnonymousUserDisabled.png b/BeWoLauncher/View/Icons/AnonymousUserDisabled.png new file mode 100644 index 000000000..9eb735e53 Binary files /dev/null and b/BeWoLauncher/View/Icons/AnonymousUserDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Archiv.png b/BeWoLauncher/View/Icons/Archiv.png new file mode 100644 index 000000000..d12c7dbd0 Binary files /dev/null and b/BeWoLauncher/View/Icons/Archiv.png differ diff --git a/BeWoLauncher/View/Icons/ArrowLeft.png b/BeWoLauncher/View/Icons/ArrowLeft.png new file mode 100644 index 000000000..577630b62 Binary files /dev/null and b/BeWoLauncher/View/Icons/ArrowLeft.png differ diff --git a/BeWoLauncher/View/Icons/ArrowRight.png b/BeWoLauncher/View/Icons/ArrowRight.png new file mode 100644 index 000000000..026782670 Binary files /dev/null and b/BeWoLauncher/View/Icons/ArrowRight.png differ diff --git a/BeWoLauncher/View/Icons/Calendar 1.png b/BeWoLauncher/View/Icons/Calendar 1.png new file mode 100644 index 000000000..180e75d67 Binary files /dev/null and b/BeWoLauncher/View/Icons/Calendar 1.png differ diff --git a/BeWoLauncher/View/Icons/Calendar1Day24.png b/BeWoLauncher/View/Icons/Calendar1Day24.png new file mode 100644 index 000000000..bec8d2e26 Binary files /dev/null and b/BeWoLauncher/View/Icons/Calendar1Day24.png differ diff --git a/BeWoLauncher/View/Icons/Calendar31Day24.png b/BeWoLauncher/View/Icons/Calendar31Day24.png new file mode 100644 index 000000000..850c6d492 Binary files /dev/null and b/BeWoLauncher/View/Icons/Calendar31Day24.png differ diff --git a/BeWoLauncher/View/Icons/Calendar5Day24.png b/BeWoLauncher/View/Icons/Calendar5Day24.png new file mode 100644 index 000000000..1fe969339 Binary files /dev/null and b/BeWoLauncher/View/Icons/Calendar5Day24.png differ diff --git a/BeWoLauncher/View/Icons/Calendar7Day24.png b/BeWoLauncher/View/Icons/Calendar7Day24.png new file mode 100644 index 000000000..091ceeaa0 Binary files /dev/null and b/BeWoLauncher/View/Icons/Calendar7Day24.png differ diff --git a/BeWoLauncher/View/Icons/CalendarDisabled.png b/BeWoLauncher/View/Icons/CalendarDisabled.png new file mode 100644 index 000000000..a04d1d2d0 Binary files /dev/null and b/BeWoLauncher/View/Icons/CalendarDisabled.png differ diff --git a/BeWoLauncher/View/Icons/CashStackDisabled.png b/BeWoLauncher/View/Icons/CashStackDisabled.png new file mode 100644 index 000000000..93ea36baa Binary files /dev/null and b/BeWoLauncher/View/Icons/CashStackDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ChartBarDisabled.png b/BeWoLauncher/View/Icons/ChartBarDisabled.png new file mode 100644 index 000000000..2afee3948 Binary files /dev/null and b/BeWoLauncher/View/Icons/ChartBarDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ChartLineDisabled.png b/BeWoLauncher/View/Icons/ChartLineDisabled.png new file mode 100644 index 000000000..9ef0a0acd Binary files /dev/null and b/BeWoLauncher/View/Icons/ChartLineDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ClipboardDisabled.png b/BeWoLauncher/View/Icons/ClipboardDisabled.png new file mode 100644 index 000000000..9cbc0e462 Binary files /dev/null and b/BeWoLauncher/View/Icons/ClipboardDisabled.png differ diff --git a/BeWoLauncher/View/Icons/CoinsDisabled.png b/BeWoLauncher/View/Icons/CoinsDisabled.png new file mode 100644 index 000000000..9f95a56cb Binary files /dev/null and b/BeWoLauncher/View/Icons/CoinsDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ConfigurationDisabled.png b/BeWoLauncher/View/Icons/ConfigurationDisabled.png new file mode 100644 index 000000000..423c28b46 Binary files /dev/null and b/BeWoLauncher/View/Icons/ConfigurationDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ConfigurationToolsDisabled.png b/BeWoLauncher/View/Icons/ConfigurationToolsDisabled.png new file mode 100644 index 000000000..26dade83f Binary files /dev/null and b/BeWoLauncher/View/Icons/ConfigurationToolsDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ContactCardDisabled.png b/BeWoLauncher/View/Icons/ContactCardDisabled.png new file mode 100644 index 000000000..7ac357b16 Binary files /dev/null and b/BeWoLauncher/View/Icons/ContactCardDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ContactCardWebDisabled.png b/BeWoLauncher/View/Icons/ContactCardWebDisabled.png new file mode 100644 index 000000000..a2453fe0c Binary files /dev/null and b/BeWoLauncher/View/Icons/ContactCardWebDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Copy.png b/BeWoLauncher/View/Icons/Copy.png new file mode 100644 index 000000000..ccba8fdcb Binary files /dev/null and b/BeWoLauncher/View/Icons/Copy.png differ diff --git a/BeWoLauncher/View/Icons/Cut.png b/BeWoLauncher/View/Icons/Cut.png new file mode 100644 index 000000000..158de4eb0 Binary files /dev/null and b/BeWoLauncher/View/Icons/Cut.png differ diff --git a/BeWoLauncher/View/Icons/Delete24.png b/BeWoLauncher/View/Icons/Delete24.png new file mode 100644 index 000000000..d64b98f5d Binary files /dev/null and b/BeWoLauncher/View/Icons/Delete24.png differ diff --git a/BeWoLauncher/View/Icons/Document48.png b/BeWoLauncher/View/Icons/Document48.png new file mode 100644 index 000000000..23e7ddf36 Binary files /dev/null and b/BeWoLauncher/View/Icons/Document48.png differ diff --git a/BeWoLauncher/View/Icons/DocumentWithAdd.png b/BeWoLauncher/View/Icons/DocumentWithAdd.png new file mode 100644 index 000000000..184b22700 Binary files /dev/null and b/BeWoLauncher/View/Icons/DocumentWithAdd.png differ diff --git a/BeWoLauncher/View/Icons/DocumentWithAdd2.png b/BeWoLauncher/View/Icons/DocumentWithAdd2.png new file mode 100644 index 000000000..21a36eb6e Binary files /dev/null and b/BeWoLauncher/View/Icons/DocumentWithAdd2.png differ diff --git a/BeWoLauncher/View/Icons/Email.png b/BeWoLauncher/View/Icons/Email.png new file mode 100644 index 000000000..437e48193 Binary files /dev/null and b/BeWoLauncher/View/Icons/Email.png differ diff --git a/BeWoLauncher/View/Icons/Favorites16.png b/BeWoLauncher/View/Icons/Favorites16.png new file mode 100644 index 000000000..459af3f89 Binary files /dev/null and b/BeWoLauncher/View/Icons/Favorites16.png differ diff --git a/BeWoLauncher/View/Icons/Favorites32.png b/BeWoLauncher/View/Icons/Favorites32.png new file mode 100644 index 000000000..f169f537b Binary files /dev/null and b/BeWoLauncher/View/Icons/Favorites32.png differ diff --git a/BeWoLauncher/View/Icons/FavoritesDisabled32.png b/BeWoLauncher/View/Icons/FavoritesDisabled32.png new file mode 100644 index 000000000..3ba8055e7 Binary files /dev/null and b/BeWoLauncher/View/Icons/FavoritesDisabled32.png differ diff --git a/BeWoLauncher/View/Icons/Folder.png b/BeWoLauncher/View/Icons/Folder.png new file mode 100644 index 000000000..41b8bcb37 Binary files /dev/null and b/BeWoLauncher/View/Icons/Folder.png differ diff --git a/BeWoLauncher/View/Icons/Haeckchen.png b/BeWoLauncher/View/Icons/Haeckchen.png new file mode 100644 index 000000000..d4379ecab Binary files /dev/null and b/BeWoLauncher/View/Icons/Haeckchen.png differ diff --git a/BeWoLauncher/View/Icons/Help.png b/BeWoLauncher/View/Icons/Help.png new file mode 100644 index 000000000..ea265cf09 Binary files /dev/null and b/BeWoLauncher/View/Icons/Help.png differ diff --git a/BeWoLauncher/View/Icons/HelpDisabled.png b/BeWoLauncher/View/Icons/HelpDisabled.png new file mode 100644 index 000000000..d3d65e323 Binary files /dev/null and b/BeWoLauncher/View/Icons/HelpDisabled.png differ diff --git a/BeWoLauncher/View/Icons/History24.png b/BeWoLauncher/View/Icons/History24.png new file mode 100644 index 000000000..1c3dc5a7d Binary files /dev/null and b/BeWoLauncher/View/Icons/History24.png differ diff --git a/BeWoLauncher/View/Icons/HistoryDisabled - Kopie.png b/BeWoLauncher/View/Icons/HistoryDisabled - Kopie.png new file mode 100644 index 000000000..773bff47b Binary files /dev/null and b/BeWoLauncher/View/Icons/HistoryDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/HistoryDisabled.png b/BeWoLauncher/View/Icons/HistoryDisabled.png new file mode 100644 index 000000000..773bff47b Binary files /dev/null and b/BeWoLauncher/View/Icons/HistoryDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Home.png b/BeWoLauncher/View/Icons/Home.png new file mode 100644 index 000000000..44836a6e9 Binary files /dev/null and b/BeWoLauncher/View/Icons/Home.png differ diff --git a/BeWoLauncher/View/Icons/HomeDisabled - Kopie.png b/BeWoLauncher/View/Icons/HomeDisabled - Kopie.png new file mode 100644 index 000000000..64bd35ad7 Binary files /dev/null and b/BeWoLauncher/View/Icons/HomeDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/HomeDisabled.png b/BeWoLauncher/View/Icons/HomeDisabled.png new file mode 100644 index 000000000..64bd35ad7 Binary files /dev/null and b/BeWoLauncher/View/Icons/HomeDisabled.png differ diff --git a/BeWoLauncher/View/Icons/IDBadgeDisabled - Kopie.png b/BeWoLauncher/View/Icons/IDBadgeDisabled - Kopie.png new file mode 100644 index 000000000..f6fd97fdc Binary files /dev/null and b/BeWoLauncher/View/Icons/IDBadgeDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/IDBadgeDisabled.png b/BeWoLauncher/View/Icons/IDBadgeDisabled.png new file mode 100644 index 000000000..f6fd97fdc Binary files /dev/null and b/BeWoLauncher/View/Icons/IDBadgeDisabled.png differ diff --git a/BeWoLauncher/View/Icons/InternetDisabled - Kopie.png b/BeWoLauncher/View/Icons/InternetDisabled - Kopie.png new file mode 100644 index 000000000..ed4dfdb9b Binary files /dev/null and b/BeWoLauncher/View/Icons/InternetDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/InternetDisabled.png b/BeWoLauncher/View/Icons/InternetDisabled.png new file mode 100644 index 000000000..ed4dfdb9b Binary files /dev/null and b/BeWoLauncher/View/Icons/InternetDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Keywords.png b/BeWoLauncher/View/Icons/Keywords.png new file mode 100644 index 000000000..0f3ba25f1 Binary files /dev/null and b/BeWoLauncher/View/Icons/Keywords.png differ diff --git a/BeWoLauncher/View/Icons/KeywordsDisabled.png b/BeWoLauncher/View/Icons/KeywordsDisabled.png new file mode 100644 index 000000000..34a87be27 Binary files /dev/null and b/BeWoLauncher/View/Icons/KeywordsDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Light Bulb.png b/BeWoLauncher/View/Icons/Light Bulb.png new file mode 100644 index 000000000..48aae85f8 Binary files /dev/null and b/BeWoLauncher/View/Icons/Light Bulb.png differ diff --git a/BeWoLauncher/View/Icons/Logout - Kopie.png b/BeWoLauncher/View/Icons/Logout - Kopie.png new file mode 100644 index 000000000..46f6a3b14 Binary files /dev/null and b/BeWoLauncher/View/Icons/Logout - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Logout.png b/BeWoLauncher/View/Icons/Logout.png new file mode 100644 index 000000000..46f6a3b14 Binary files /dev/null and b/BeWoLauncher/View/Icons/Logout.png differ diff --git a/BeWoLauncher/View/Icons/LogoutDisabled.png b/BeWoLauncher/View/Icons/LogoutDisabled.png new file mode 100644 index 000000000..b7004fc33 Binary files /dev/null and b/BeWoLauncher/View/Icons/LogoutDisabled.png differ diff --git a/BeWoLauncher/View/Icons/ManufacturingDisabled - Kopie.png b/BeWoLauncher/View/Icons/ManufacturingDisabled - Kopie.png new file mode 100644 index 000000000..11a1e7e09 Binary files /dev/null and b/BeWoLauncher/View/Icons/ManufacturingDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/ManufacturingDisabled.png b/BeWoLauncher/View/Icons/ManufacturingDisabled.png new file mode 100644 index 000000000..11a1e7e09 Binary files /dev/null and b/BeWoLauncher/View/Icons/ManufacturingDisabled.png differ diff --git a/BeWoLauncher/View/Icons/MenuDisabled.png b/BeWoLauncher/View/Icons/MenuDisabled.png new file mode 100644 index 000000000..32f0dc05f Binary files /dev/null and b/BeWoLauncher/View/Icons/MenuDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Newspaper.png b/BeWoLauncher/View/Icons/Newspaper.png new file mode 100644 index 000000000..23c121daa Binary files /dev/null and b/BeWoLauncher/View/Icons/Newspaper.png differ diff --git a/BeWoLauncher/View/Icons/ObjectsDisabled.png b/BeWoLauncher/View/Icons/ObjectsDisabled.png new file mode 100644 index 000000000..bbd629bf3 Binary files /dev/null and b/BeWoLauncher/View/Icons/ObjectsDisabled.png differ diff --git a/BeWoLauncher/View/Icons/OfficeBulidingBlackDisabled.png b/BeWoLauncher/View/Icons/OfficeBulidingBlackDisabled.png new file mode 100644 index 000000000..a762d5836 Binary files /dev/null and b/BeWoLauncher/View/Icons/OfficeBulidingBlackDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Paste.png b/BeWoLauncher/View/Icons/Paste.png new file mode 100644 index 000000000..24976137e Binary files /dev/null and b/BeWoLauncher/View/Icons/Paste.png differ diff --git a/BeWoLauncher/View/Icons/Paste24.png b/BeWoLauncher/View/Icons/Paste24.png new file mode 100644 index 000000000..f63ea0480 Binary files /dev/null and b/BeWoLauncher/View/Icons/Paste24.png differ diff --git a/BeWoLauncher/View/Icons/RSS Newsfeed - Kopie.png b/BeWoLauncher/View/Icons/RSS Newsfeed - Kopie.png new file mode 100644 index 000000000..558ef075b Binary files /dev/null and b/BeWoLauncher/View/Icons/RSS Newsfeed - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/RSS Newsfeed.png b/BeWoLauncher/View/Icons/RSS Newsfeed.png new file mode 100644 index 000000000..558ef075b Binary files /dev/null and b/BeWoLauncher/View/Icons/RSS Newsfeed.png differ diff --git a/BeWoLauncher/View/Icons/Redo - Kopie.png b/BeWoLauncher/View/Icons/Redo - Kopie.png new file mode 100644 index 000000000..7f52beef7 Binary files /dev/null and b/BeWoLauncher/View/Icons/Redo - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Redo.png b/BeWoLauncher/View/Icons/Redo.png new file mode 100644 index 000000000..7f52beef7 Binary files /dev/null and b/BeWoLauncher/View/Icons/Redo.png differ diff --git a/BeWoLauncher/View/Icons/Rename24 - Kopie.png b/BeWoLauncher/View/Icons/Rename24 - Kopie.png new file mode 100644 index 000000000..24fe40d39 Binary files /dev/null and b/BeWoLauncher/View/Icons/Rename24 - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Rename24.png b/BeWoLauncher/View/Icons/Rename24.png new file mode 100644 index 000000000..24fe40d39 Binary files /dev/null and b/BeWoLauncher/View/Icons/Rename24.png differ diff --git a/BeWoLauncher/View/Icons/SMS24_2.png b/BeWoLauncher/View/Icons/SMS24_2.png new file mode 100644 index 000000000..f964d970d Binary files /dev/null and b/BeWoLauncher/View/Icons/SMS24_2.png differ diff --git a/BeWoLauncher/View/Icons/Save - Kopie.png b/BeWoLauncher/View/Icons/Save - Kopie.png new file mode 100644 index 000000000..3f0d3cd68 Binary files /dev/null and b/BeWoLauncher/View/Icons/Save - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Save.png b/BeWoLauncher/View/Icons/Save.png new file mode 100644 index 000000000..3f0d3cd68 Binary files /dev/null and b/BeWoLauncher/View/Icons/Save.png differ diff --git a/BeWoLauncher/View/Icons/Search - Kopie.png b/BeWoLauncher/View/Icons/Search - Kopie.png new file mode 100644 index 000000000..f43310d41 Binary files /dev/null and b/BeWoLauncher/View/Icons/Search - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Search.png b/BeWoLauncher/View/Icons/Search.png new file mode 100644 index 000000000..f43310d41 Binary files /dev/null and b/BeWoLauncher/View/Icons/Search.png differ diff --git a/BeWoLauncher/View/Icons/Symbol Delete.png b/BeWoLauncher/View/Icons/Symbol Delete.png new file mode 100644 index 000000000..a5d7d4ce2 Binary files /dev/null and b/BeWoLauncher/View/Icons/Symbol Delete.png differ diff --git a/BeWoLauncher/View/Icons/Symbol Edit.png b/BeWoLauncher/View/Icons/Symbol Edit.png new file mode 100644 index 000000000..efed87db3 Binary files /dev/null and b/BeWoLauncher/View/Icons/Symbol Edit.png differ diff --git a/BeWoLauncher/View/Icons/Symbol Help.png b/BeWoLauncher/View/Icons/Symbol Help.png new file mode 100644 index 000000000..52c0f34a4 Binary files /dev/null and b/BeWoLauncher/View/Icons/Symbol Help.png differ diff --git a/BeWoLauncher/View/Icons/SymbolRefresh32.png b/BeWoLauncher/View/Icons/SymbolRefresh32.png new file mode 100644 index 000000000..566137591 Binary files /dev/null and b/BeWoLauncher/View/Icons/SymbolRefresh32.png differ diff --git a/BeWoLauncher/View/Icons/SymbolRefresh32Disabled - Kopie.png b/BeWoLauncher/View/Icons/SymbolRefresh32Disabled - Kopie.png new file mode 100644 index 000000000..ae2e6bc75 Binary files /dev/null and b/BeWoLauncher/View/Icons/SymbolRefresh32Disabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/SymbolRefresh32Disabled.png b/BeWoLauncher/View/Icons/SymbolRefresh32Disabled.png new file mode 100644 index 000000000..ae2e6bc75 Binary files /dev/null and b/BeWoLauncher/View/Icons/SymbolRefresh32Disabled.png differ diff --git a/BeWoLauncher/View/Icons/TechSupportWhiteDisabled.png b/BeWoLauncher/View/Icons/TechSupportWhiteDisabled.png new file mode 100644 index 000000000..5addf8ba1 Binary files /dev/null and b/BeWoLauncher/View/Icons/TechSupportWhiteDisabled.png differ diff --git a/BeWoLauncher/View/Icons/Undo - Kopie.png b/BeWoLauncher/View/Icons/Undo - Kopie.png new file mode 100644 index 000000000..ba6633eaf Binary files /dev/null and b/BeWoLauncher/View/Icons/Undo - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/Undo.png b/BeWoLauncher/View/Icons/Undo.png new file mode 100644 index 000000000..ba6633eaf Binary files /dev/null and b/BeWoLauncher/View/Icons/Undo.png differ diff --git a/BeWoLauncher/View/Icons/User Business Male.png b/BeWoLauncher/View/Icons/User Business Male.png new file mode 100644 index 000000000..de97570ec Binary files /dev/null and b/BeWoLauncher/View/Icons/User Business Male.png differ diff --git a/BeWoLauncher/View/Icons/User Home Boy.png b/BeWoLauncher/View/Icons/User Home Boy.png new file mode 100644 index 000000000..e5074afbe Binary files /dev/null and b/BeWoLauncher/View/Icons/User Home Boy.png differ diff --git a/BeWoLauncher/View/Icons/User Home Girl.png b/BeWoLauncher/View/Icons/User Home Girl.png new file mode 100644 index 000000000..983ae1da9 Binary files /dev/null and b/BeWoLauncher/View/Icons/User Home Girl.png differ diff --git a/BeWoLauncher/View/Icons/UserBusinessMaleDisabled - Kopie.png b/BeWoLauncher/View/Icons/UserBusinessMaleDisabled - Kopie.png new file mode 100644 index 000000000..57fe51bcc Binary files /dev/null and b/BeWoLauncher/View/Icons/UserBusinessMaleDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/UserBusinessMaleDisabled.png b/BeWoLauncher/View/Icons/UserBusinessMaleDisabled.png new file mode 100644 index 000000000..57fe51bcc Binary files /dev/null and b/BeWoLauncher/View/Icons/UserBusinessMaleDisabled.png differ diff --git a/BeWoLauncher/View/Icons/UserGroupBusinessDisabled - Kopie.png b/BeWoLauncher/View/Icons/UserGroupBusinessDisabled - Kopie.png new file mode 100644 index 000000000..c3bc5d090 Binary files /dev/null and b/BeWoLauncher/View/Icons/UserGroupBusinessDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/UserGroupBusinessDisabled.png b/BeWoLauncher/View/Icons/UserGroupBusinessDisabled.png new file mode 100644 index 000000000..c3bc5d090 Binary files /dev/null and b/BeWoLauncher/View/Icons/UserGroupBusinessDisabled.png differ diff --git a/BeWoLauncher/View/Icons/UserGroupDisabled - Kopie.png b/BeWoLauncher/View/Icons/UserGroupDisabled - Kopie.png new file mode 100644 index 000000000..70d2e28ac Binary files /dev/null and b/BeWoLauncher/View/Icons/UserGroupDisabled - Kopie.png differ diff --git a/BeWoLauncher/View/Icons/UserGroupDisabled.png b/BeWoLauncher/View/Icons/UserGroupDisabled.png new file mode 100644 index 000000000..70d2e28ac Binary files /dev/null and b/BeWoLauncher/View/Icons/UserGroupDisabled.png differ diff --git a/BeWoLauncher/View/Icons/UserGroupHome24bw.png b/BeWoLauncher/View/Icons/UserGroupHome24bw.png new file mode 100644 index 000000000..90ec8f94e Binary files /dev/null and b/BeWoLauncher/View/Icons/UserGroupHome24bw.png differ diff --git a/BeWoLauncher/View/Icons/UserHomeBoyDisabled.png b/BeWoLauncher/View/Icons/UserHomeBoyDisabled.png new file mode 100644 index 000000000..0096e46c0 Binary files /dev/null and b/BeWoLauncher/View/Icons/UserHomeBoyDisabled.png differ diff --git a/BeWoLauncher/View/Icons/UserHomeMaleDisabled.png b/BeWoLauncher/View/Icons/UserHomeMaleDisabled.png new file mode 100644 index 000000000..7b86cb36a Binary files /dev/null and b/BeWoLauncher/View/Icons/UserHomeMaleDisabled.png differ diff --git a/BeWoLauncher/View/Icons/UserHomeMaleDisabled32.png b/BeWoLauncher/View/Icons/UserHomeMaleDisabled32.png new file mode 100644 index 000000000..97a5e870e Binary files /dev/null and b/BeWoLauncher/View/Icons/UserHomeMaleDisabled32.png differ diff --git a/BeWoLauncher/View/Icons/UserMaleBlackDisabled.png b/BeWoLauncher/View/Icons/UserMaleBlackDisabled.png new file mode 100644 index 000000000..243afc91b Binary files /dev/null and b/BeWoLauncher/View/Icons/UserMaleBlackDisabled.png differ diff --git a/BeWoLauncher/View/Icons/WeitereNachrichtLaden.png b/BeWoLauncher/View/Icons/WeitereNachrichtLaden.png new file mode 100644 index 000000000..cf7110d2f Binary files /dev/null and b/BeWoLauncher/View/Icons/WeitereNachrichtLaden.png differ diff --git a/BeWoLauncher/View/Icons/adobe-pdf-icon.png b/BeWoLauncher/View/Icons/adobe-pdf-icon.png new file mode 100644 index 000000000..c12e0a9a3 Binary files /dev/null and b/BeWoLauncher/View/Icons/adobe-pdf-icon.png differ diff --git a/BeWoLauncher/View/Icons/bewologo_big.gif b/BeWoLauncher/View/Icons/bewologo_big.gif new file mode 100644 index 000000000..82ab9f061 Binary files /dev/null and b/BeWoLauncher/View/Icons/bewologo_big.gif differ diff --git a/BeWoLauncher/View/Icons/bewoplaner_logo_big.png b/BeWoLauncher/View/Icons/bewoplaner_logo_big.png new file mode 100644 index 000000000..a5874eb7a Binary files /dev/null and b/BeWoLauncher/View/Icons/bewoplaner_logo_big.png differ diff --git a/BeWoLauncher/View/Icons/bewoplaner_logo_small.png b/BeWoLauncher/View/Icons/bewoplaner_logo_small.png new file mode 100644 index 000000000..b1925160e Binary files /dev/null and b/BeWoLauncher/View/Icons/bewoplaner_logo_small.png differ diff --git a/BeWoLauncher/View/Icons/bslogo.gif b/BeWoLauncher/View/Icons/bslogo.gif new file mode 100644 index 000000000..489c58519 Binary files /dev/null and b/BeWoLauncher/View/Icons/bslogo.gif differ diff --git a/BeWoLauncher/View/Icons/delete.png b/BeWoLauncher/View/Icons/delete.png new file mode 100644 index 000000000..a8462cf15 Binary files /dev/null and b/BeWoLauncher/View/Icons/delete.png differ diff --git a/BeWoLauncher/View/Icons/edit.png b/BeWoLauncher/View/Icons/edit.png new file mode 100644 index 000000000..04426005a Binary files /dev/null and b/BeWoLauncher/View/Icons/edit.png differ diff --git a/BeWoLauncher/View/Icons/excel.png b/BeWoLauncher/View/Icons/excel.png new file mode 100644 index 000000000..54667e757 Binary files /dev/null and b/BeWoLauncher/View/Icons/excel.png differ diff --git a/BeWoLauncher/View/Icons/glucklicher.png b/BeWoLauncher/View/Icons/glucklicher.png new file mode 100644 index 000000000..5464d2670 Binary files /dev/null and b/BeWoLauncher/View/Icons/glucklicher.png differ diff --git a/BeWoLauncher/View/Icons/klient-avatar.png b/BeWoLauncher/View/Icons/klient-avatar.png new file mode 100644 index 000000000..d6b59083e Binary files /dev/null and b/BeWoLauncher/View/Icons/klient-avatar.png differ diff --git a/BeWoLauncher/View/Icons/massnahme.png b/BeWoLauncher/View/Icons/massnahme.png new file mode 100644 index 000000000..26fd4e390 Binary files /dev/null and b/BeWoLauncher/View/Icons/massnahme.png differ diff --git a/BeWoLauncher/View/Icons/mitarbeiter-avatar.png b/BeWoLauncher/View/Icons/mitarbeiter-avatar.png new file mode 100644 index 000000000..34a3a8bf0 Binary files /dev/null and b/BeWoLauncher/View/Icons/mitarbeiter-avatar.png differ diff --git a/BeWoLauncher/View/Icons/mitarbeiter-team-avatar.png b/BeWoLauncher/View/Icons/mitarbeiter-team-avatar.png new file mode 100644 index 000000000..dac4e73e3 Binary files /dev/null and b/BeWoLauncher/View/Icons/mitarbeiter-team-avatar.png differ diff --git a/BeWoLauncher/View/Icons/new.png b/BeWoLauncher/View/Icons/new.png new file mode 100644 index 000000000..fcf44f25c Binary files /dev/null and b/BeWoLauncher/View/Icons/new.png differ diff --git a/BeWoLauncher/View/Icons/sortiert.png b/BeWoLauncher/View/Icons/sortiert.png new file mode 100644 index 000000000..400b5333b Binary files /dev/null and b/BeWoLauncher/View/Icons/sortiert.png differ diff --git a/BeWoLauncher/View/Icons/trauriges-smiley.png b/BeWoLauncher/View/Icons/trauriges-smiley.png new file mode 100644 index 000000000..3ddb7368e Binary files /dev/null and b/BeWoLauncher/View/Icons/trauriges-smiley.png differ diff --git a/BeWoLauncher/View/Icons/unsortiert.png b/BeWoLauncher/View/Icons/unsortiert.png new file mode 100644 index 000000000..7900b8320 Binary files /dev/null and b/BeWoLauncher/View/Icons/unsortiert.png differ diff --git a/BeWoLauncher/View/Icons/warning-16x16.png b/BeWoLauncher/View/Icons/warning-16x16.png new file mode 100644 index 000000000..0cdf9eb89 Binary files /dev/null and b/BeWoLauncher/View/Icons/warning-16x16.png differ diff --git a/BeWoLauncher/View/Icons/word.png b/BeWoLauncher/View/Icons/word.png new file mode 100644 index 000000000..3169c4195 Binary files /dev/null and b/BeWoLauncher/View/Icons/word.png differ diff --git a/BeWoLauncher/View/Icons/ziel.png b/BeWoLauncher/View/Icons/ziel.png new file mode 100644 index 000000000..c8db1f45e Binary files /dev/null and b/BeWoLauncher/View/Icons/ziel.png differ diff --git a/BeWoLauncher/View/LoginView.xaml b/BeWoLauncher/View/LoginView.xaml new file mode 100644 index 000000000..4566a26ee --- /dev/null +++ b/BeWoLauncher/View/LoginView.xaml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +