public SetupLicenseCommand(
     LicenseUi ui,
     MethodWeb web)
 {
     this.ui  = ui;
     this.web = web;
 }
 public LicensePresenter(
     LicenseUi ui,
     MethodRunner runner)
     : base(ui)
 {
     this.ui     = ui;
     this.runner = runner;
 }
예제 #3
0
        public virtual void Handle(
            LicenseUi ui)
        {
            var r = this.runner;

            r?.Run <UiReaderWriter>(uiRW =>
            {
                uiRW.Write(
                    ui,
                    ui.Hide);
            });
        }
예제 #4
0
        private void CheckIfLicenseIsActive()
        {
            var license = new License();

            if (license.Check())
            {
                return;
            }

            MessageBox.Show("Licencia expirada", "Licencia", MessageBoxButton.OK,
                            MessageBoxImage.Information);
            var activateLicense = new LicenseUi();

            activateLicense.Show();
            Close();
        }
        public virtual void Handle(
            LicenseUi ui)
        {
            var r = this.runner;

            r?.Run <Core98Publisher>(pub =>
            {
                pub.Publish();
            });

            r?.Run <UiReaderWriter>(uiRW =>
            {
                uiRW.Write(
                    ui,
                    ui.Hide);
            });
        }
예제 #6
0
        protected virtual void onBootstrap()
        {
            var s = this.mainShell;

            if (s == null)
            {
                return;
            }

            var m = this.newMessenger?.Invoke();

            if (m != null)
            {
                m.Subscriber = s;
            }

            var e = this.executor;

            e?.Execute(new SetupMethodWebCommand(
                           new MethodWebV2(),
                           m,
                           this.newConfigSaver,
                           this.newSettingsProvider));

            var w = e?.Get <SetupMethodWebCommand>()?.W;

            w?.Run <EventSubscriber>(sub =>
            {
                var cd = AppDomain.CurrentDomain;
                UnhandledExceptionEventHandler handler = this.handleException;
                sub.Subscribe(
                    cd,
                    nameof(cd.UnhandledException),
                    handler);
            });
            w?.RegisterDependency(s);

            HomeUi          homeUi       = null;
            HomeNavUi       homeNavUi    = null;
            StatisticsUi    statsUi      = null;
            TimestampsUi    timestampsUi = null;
            TimestampEditUi editUi       = null;
            DailyUi         dailyUi      = null;
            ConfigUi        configUi     = null;
            LicenseUi       licenseUi    = null;

            w?.Run <UiReaderWriter, Lotter>(
                (uiRW, lotter) =>
            {
                uiRW.WriteSync(
                    s,
                    () =>
                {
                    homeUi       = this.newHomeUi?.Invoke();
                    homeNavUi    = this.newHomeNavUi?.Invoke(lotter);
                    statsUi      = this.newStatsUi?.Invoke();
                    timestampsUi = this.newTimestampsUi?.Invoke(lotter);
                    editUi       = this.newEditUi?.Invoke();
                    dailyUi      = this.newDailyUi?.Invoke(lotter);
                    configUi     = this.newConfigUi?.Invoke();
                    licenseUi    = this.newLicenseUi?.Invoke(s);
                });
            });

            var homeFinished       = new ManualResetEvent(false);
            var homeNavFinished    = new ManualResetEvent(false);
            var statsFinished      = new ManualResetEvent(false);
            var editFinished       = new ManualResetEvent(false);
            var timestampsFinished = new ManualResetEvent(false);
            var dailyFinished      = new ManualResetEvent(false);
            var mainFinished       = new ManualResetEvent(false);
            var shutdownFinished   = new ManualResetEvent(false);
            var licenseFinished    = new ManualResetEvent(false);
            var configFinished     = new ManualResetEvent(false);

            w?.Run <Do <Do> >(invoker =>
            {
                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupHomeCommand(
                            homeUi,
                            s,
                            this.newReaderWriter,
                            this.newDataWatcher,
                            w));
                    homeFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupHomeNavCommand(
                            homeNavUi,
                            s.NavUi,
                            new NavigatorNavLogicReader(w),
                            w));
                    homeNavFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupStatisticsCommand(
                            statsUi,
                            homeUi,
                            w));
                    statsFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupTimestampEditCommand(
                            editUi,
                            homeUi,
                            w));
                    editFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupMainCommand(
                            s,
                            w,
                            new SettingsHolder()));
                    mainFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupShutdownCommand(
                            w));
                    shutdownFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupLicenseCommand(
                            licenseUi,
                            w));
                    licenseFinished.Set();
                });

                homeFinished.WaitOne();

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupTimestampsCommand(
                            timestampsUi,
                            homeUi,
                            w));
                    timestampsFinished.Set();
                });

                invoker.Invoke(
                    () =>
                {
                    e?.Execute(
                        new SetupDailyCommand(
                            dailyUi,
                            homeUi,
                            new NavigatorUiReader(w),
                            w));
                    dailyFinished.Set();
                });
            });

            // update to single-file format
            w?.Run <FileTimestampManager>(manager =>
            {
                manager.ConvertToSingleFile();
            });

            w?.Run <DataWatcher>(watcher =>
            {
                watcher.Start();
            });

            w?.Run <Navigator>(
                nav =>
            {
                nav.Present <HomePresenter>();

                w.Run <Do <Do> >(invoker =>
                {
                    homeNavFinished.WaitOne();
                });

                nav.PresentFluidly <HomeNavPresenter>();

                w.Run <Do <Do> >(invoker =>
                {
                    timestampsFinished.WaitOne();
                });

                nav.PresentFluidly <TimestampsPresenter>();
            });

            w?.Run <Do <Do> >(invoker =>
            {
                dailyFinished.WaitOne();
                invoker.Invoke(() =>
                {
                    e?.Execute(
                        new SetupConfigCommand(
                            configUi,
                            homeUi,
                            w));
                    configFinished.Set();
                });

                statsFinished.WaitOne();
                editFinished.WaitOne();
                mainFinished.WaitOne();
                shutdownFinished.WaitOne();
                licenseFinished.WaitOne();
                configFinished.WaitOne();
            });
        }
예제 #7
0
        private void BtnLicense_Click(object sender, RoutedEventArgs e)
        {
            var activateLicense = new LicenseUi();

            activateLicense.Show();
        }