public virtual void Load(IBootContext b) { if (b.WaitDependency("BootLoaderErpWpf")) { return; } if (_erp.Acl.Connection == null) { if (!_erp.Acl.Cancelled) { b.Requeue(); } return; } if (!_erp.Acl.IsGranted(AclRights.ManageUser)) { return; } _erp.Menu.RegisterMenu("tools/ImportUsers", "{Import Users}", OpenCommand, "icons/tools/ImportUsers"); }
public void Load(IBootContext bootstrapper) { //if (_mvvm.ServiceState != ServiceState.Available) //{ // bootstrapper.Requeue(); // return; //} _data.SetConfigureAction(() => { var data = new ConnectionData(); var view = _mvvm.MainContext.GetView(data, typeof(ViewModeDefault), typeof(IViewClassDefault)); var dialog = new Window { Content = view, WindowStartupLocation = WindowStartupLocation.CenterScreen, SizeToContent = SizeToContent.WidthAndHeight }; if (dialog.ShowDialog() ?? false) { return($"Host={data.Server};Username={data.UserName};Password={data.Password};Database={data.Database}");; } return(""); }); }
public void Load(IBootContext b) { if (b.Contains("LocalizeBootloader")) { b.Requeue(); return; } MainWindow = new DefaultWindow() { //WindowStartupLocation = WindowStartupLocation.CenterScreen, //WindowState = WindowState.Maximized }; MainWindow.Closing += (sender, args) => System.Windows.Application.Current.Shutdown(); MainWindow.Show(); _info.Version = Assembly.GetCallingAssembly().GetName().Version; InitializeCultures(); if (Updater != null) { Updater.CheckVersion(); if (Updater.NewVersionFound) { var updaterView = new ApplicationUpdateView { DataContext = Updater }; // TODO : updaterView.ShowDialog(); if (Updater.Updated) { System.Windows.Application.Current.Shutdown(); return;; } } } ViewModel = _getVm(); var w = _mvvm.MainContext.GetView(ViewModel, MainViewMode); _menu.RegisterMenu("file", "{File}", null, null); _menu.RegisterMenu("data", "{Data}", null, null); _menu.RegisterMenu("param", "{Parameters}", null, null); _menu.RegisterMenu("tools", "{Tools}", null, null); _menu.RegisterMenu("help", "{_?}", null, null); _menu.RegisterMenu("file/exit", "{Exit}", ViewModel.Exit, null); MainWindow.Content = w; return; }
public void Load(IBootContext b) { if (b.WaitService(_data)) { return; } _service.Register(_get()); }
public void Load(IBootContext b) { if (_data.ServiceState != ServiceState.Available) { b.Requeue(); return; } LoadAsync(); }
public virtual void Load(IBootContext bootstrapper) { if (!Allowed) { return; } Erp.Menu.RegisterMenu(MenuPath + "/" + Name, Header, OpenCommand, IconPath); }
public void Load(IBootContext b) { if (b.WaitDependency <LocalizeBootloader>()) { return; } if (b.WaitDependency <LoginBootloader>()) { return; } _info.Version = Assembly.GetEntryAssembly()?.GetName().Version; InitializeCultures(); if (Updater != null) { Updater.CheckVersion(); if (Updater.NewVersionFound) { var updaterView = new ApplicationUpdateView { DataContext = Updater }; // TODO : updaterView.ShowDialog(); if (Updater.Updated) { System.Windows.Application.Current.Shutdown(); return;; } } } ViewModel = _getVm(); MainWindow = _mvvm.MainContext.GetView(ViewModel, MainViewMode).AsWindow(); MainWindow.Closing += (sender, args) => System.Windows.Application.Current.Shutdown(); _menu.RegisterMenu("file", "{File}", null, null); _menu.RegisterMenu("data", "{Data}", null, null); _menu.RegisterMenu("param", "{Parameters}", null, null); _menu.RegisterMenu("tools", "{Tools}", null, null); _menu.RegisterMenu("help", "{_?}", null, null); _menu.RegisterMenu("file/exit", "{Exit}", ViewModel.Exit, null); MainWindow.Show(); return; }
public void Load(IBootContext b) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(e => !e.IsDynamic)) { try { var v = assembly.GetCustomAttribute <AssemblyCompanyAttribute>(); if (v?.Company == "Microsoft Corporation") { continue; } var resourceManager = new ResourceManager(assembly.GetName().Name + ".g", assembly); var resources = resourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true); foreach (var rkey in resources) { var r = ((DictionaryEntry)rkey).Key.ToString().ToLower(); var resourcePath = r.Replace(assembly.ManifestModule.Name.Replace(".exe", "") + ".", ""); if (resourcePath.EndsWith(".xaml")) { var n = resourcePath.Remove(resourcePath.Length - 5); _icons.AddIconProvider(n, new IconProviderXamlFromResource(resourceManager, resourcePath)); } else if (resourcePath.EndsWith(".svg")) { var n = resourcePath.Remove(resourcePath.Length - 4); _icons.AddIconProvider(n, new IconProviderSvg(resourceManager, resourcePath)); } else if (resourcePath.EndsWith(".baml")) { var n = resourcePath.Remove(resourcePath.Length - 5); _icons.AddIconProvider(n, new IconProviderXamlFromUri(new Uri("/" + assembly.FullName + ";component/" + n + ".xaml", UriKind.Relative))); } } } catch (System.Resources.MissingManifestResourceException ex) { } } }
public void Load(IBootContext bootstrapper) { //if we can have localization and picture lets do it if (bootstrapper.WaitDependency("LocalizeBootloader", "IconBootloader")) { return; } //retrieve login window var loginWindow = _mvvm.MainContext.GetView(_getViewModel(), typeof(ViewModeDefault)).AsWindow(); //loginWindow.SizeToContent = SizeToContent.WidthAndHeight; loginWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; loginWindow.ShowDialog(); //if connection failed if (_acl.Connection is null) { Application.Current.Shutdown(); } }
public static void Enqueue(this IBootContext context, IBootloader bootloader) { context.Enqueue(bootloader.GetType().Name, bootloader.Load); }
public void Load(IBootContext bootstrapper) { if (bootstrapper.WaitService(Data)) { return; } string oldVersion = ""; while (true) { DataVersion version = null; try { version = Data.FetchOne <DataVersion>(d => d.Module == CurrentModule); } catch (DataException exception) { if (exception.InnerException is PostgresException postgres) { if (postgres.SqlState == "42P01" && postgres.MessageText.Contains("DataVersion")) { CreateDataVersion(); version = Data.FetchOne <DataVersion>(d => d.Module == CurrentModule); } } } if (version == null) { version = Data.Add <DataVersion>(v => { v.Module = CurrentModule; v.Version = "0.0.0.0"; }); } if (version.Version == oldVersion) { throw new DataException($"Wrong database version {version.Version} but need {CurrentVersion}", null); } if (version.Version == CurrentVersion) { #if DEBUG try { Upgrade(version.Version); } catch (Exception ex) { } #endif return; } oldVersion = version.Version; Upgrade(version.Version); } }
public void Load(IBootContext b) { _mvvm.Register(); }
public void Load(IBootContext bootstrapper) { }
public void Load(IBootContext b) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(e => !e.IsDynamic)) { try { var v = assembly.GetCustomAttribute <AssemblyCompanyAttribute>(); if (v?.Company == "Microsoft Corporation") { continue; } var resourceManager = new ResourceManager(assembly.GetName().Name + ".g", assembly); var resources = resourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true); foreach (var rkey in resources) { var r = ((DictionaryEntry)rkey).Key.ToString().ToLower(); var resourcePath = r.Replace(assembly.ManifestModule.Name.Replace(".exe", "") + ".", ""); resourcePath = Uri.UnescapeDataString(resourcePath); if (resourcePath.EndsWith(".xaml")) { var resource = resourcePath.Split('/'); var path = string.Join('/', resource.SkipLast(1)); foreach (var n in resource.Last().Split('.').SkipLast(1)) { _icons.AddIconProvider(string.Join('/', path, n), new IconProviderXamlFromResource(resourceManager, resourcePath, Colors.Black)); } } else if (resourcePath.EndsWith(".svg")) { var resource = resourcePath.Split('/'); var path = string.Join('/', resource.SkipLast(1)); foreach (var n in resource.Last().Split('.').SkipLast(1)) { _icons.AddIconProvider(string.Join('/', path, n), new IconProviderSvg(resourceManager, resourcePath, Colors.Black)); } } else if (resourcePath.EndsWith(".baml")) { var resource = resourcePath.Split('/'); var path = string.Join('/', resource.SkipLast(1)); foreach (var n in resource.Last().Split('.').SkipLast(1)) { _icons.AddIconProvider( string.Join('/', path, n), new IconProviderXamlFromUri(new Uri($"/{assembly.FullName};component/{string.Join('.',resourcePath.Split('.').SkipLast(1))}.xaml", UriKind.Relative)) ); } } } } catch (MissingManifestResourceException) { } } }
public void Load(IBootContext bootstrapper) { WorkflowAnalysisExtension.Acl = _acl; }
public void Load(IBootContext b) { // //TODO : // //_docs.OpenDocument(_getDetails()); }
public void Load(IBootContext b) => _erp.Menu.RegisterMenu("tools/internet", "{Internet}", OpenDocumentCommand, "icons/internet");
public void Load(IBootContext bootstrapper) { AclRight.Data = _data; }