コード例 #1
0
ファイル: App.xaml.cs プロジェクト: TryStatic/SMGApp
        protected override async void OnStartup(StartupEventArgs e)
        {
            string procName = Process.GetCurrentProcess().ProcessName;

            Process[] processes = Process.GetProcessesByName(procName);

            if (processes.Length > 1)
            {
                MessageBox.Show($"{procName} already running", "Error");
                Current.Shutdown();
                return;
            }

            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\receipts"))
            {
                try
                {
                    System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\receipts");
                }
                catch (Exception)
                {
                    MessageBox.Show("Error creating receipts directory.");
                    Environment.Exit(1);
                }
            }


            Thread.CurrentThread.CurrentCulture   = new CultureInfo("el-GR");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("el-GR");
            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(
                    XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));


            await SMGAppDbContextFactory.MigrateIfNeeded();

            IServiceProvider serviceProvider = CreateServiceProvider();

            Window window = serviceProvider.GetRequiredService <MainWindow>();

            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            window.Height      = SystemParameters.PrimaryScreenHeight * 0.95;
            window.Width       = SystemParameters.PrimaryScreenWidth * 0.95;
            window.DataContext = serviceProvider.GetRequiredService <MainViewModel>();
            window.Show();

            base.OnStartup(e);
        }
コード例 #2
0
 public GuaranteeDataService(SMGAppDbContextFactory contextFactory) : base(contextFactory)
 {
 }
コード例 #3
0
 public ServiceItemsDataService(SMGAppDbContextFactory contextFactory) : base(contextFactory)
 {
 }
コード例 #4
0
 public GenericDataServices(SMGAppDbContextFactory contextFactory)
 {
     ContextFactory = contextFactory;
 }
コード例 #5
0
 public CustomersDataService(SMGAppDbContextFactory contextFactory) : base(contextFactory)
 {
 }