Esempio n. 1
0
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            bool isLight = AppSettings.Instance.AppTheme == ApplicationTheme.Light;

            Application.Current.RequestedTheme = isLight ? ApplicationTheme.Light : ApplicationTheme.Dark;
            bool isAppUpdated = SettingsUpdater.UpdateAppSettings();

            RegisterBGTask(isAppUpdated);
        }
Esempio n. 2
0
 public BoardHub(ReleaseChecker releaseChecker, ILogger <BoardHub> logger, ReleaseInstaller installer, SettingsUpdater settingsUpdater)
 {
     this.ReleaseChecker  = releaseChecker;
     this.Installer       = installer;
     this.SettingsUpdater = settingsUpdater;
     this.Log             = logger;
     Task.Run(async() =>
     {
         this.NewerRelease     = await this.ReleaseChecker.GetLatestReleaseIfNewerAsync(Program.Version, Program.Repo, Program.Owner, nameof(HalmaEditor));
         this.ReleaseCheckDone = true;
         try
         {
             ReleaseCheckFinished?.Invoke(this, EventArgs.Empty);
         }
         catch { }
     });
 }
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                OnDisposed(this);

                WindowEventHandler.Dispose();

                _processExitHandler.Dispose();
                _skinWindowButtonsHandler.Dispose();
                _settingsUpdater.Dispose();


                TopBorder.Dispose();
                LeftBorder.Dispose();
                RightBorder.Dispose();
                BottomBorder.Dispose();

                TopBorder    = null;
                LeftBorder   = null;
                RightBorder  = null;
                BottomBorder = null;

                MinimizeButton = null;
                MaximizeButton = null;
                CloseButton    = null;
                HelpButton     = null;

                TitleControl           = null;
                TitleBackgroundControl = null;

                IconControl = null;

                _skin = null;

                _parent = null;

                _processExitHandler       = null;
                _settingsUpdater          = null;
                _skinWindowButtonsHandler = null;
                _windowEventHandler       = null;
                _controlsChangeHandler    = null;

                _disposed = true;
            }
        }
        public SkinableWindowBorder(TopLevelWindow Window, WindowBorderSkin skin, bool IsExecluded)
        {
            _parent = Window;

            TopBorder    = new SkinBorder(this);
            LeftBorder   = new SkinBorder(this);
            RightBorder  = new SkinBorder(this);
            BottomBorder = new SkinBorder(this);

            TitleBackgroundControl = new LayeredControl(TopBorder);
            TitleControl           = new LayeredLabel(TopBorder);

            IconControl      = new LayeredIcon(TopBorder);
            IconControl.Size = new Size(16, 16);

            MinimizeButton = new MinimizeButton(TopBorder);
            MaximizeButton = new MaximizeButton(TopBorder);
            CloseButton    = new CloseButton(TopBorder);
            HelpButton     = new HelpButton(TopBorder);

            if (Window.SizeBox)
            {
                TopBorder.LeftCornerCursor     = Cursors.SizeNWSE;
                TopBorder.RightCornerCursor    = Cursors.SizeNESW;
                TopBorder.TopCursor            = Cursors.SizeNS;
                LeftBorder.NormalCursor        = Cursors.SizeWE;
                RightBorder.NormalCursor       = Cursors.SizeWE;
                BottomBorder.NormalCursor      = Cursors.SizeNS;
                BottomBorder.LeftCornerCursor  = Cursors.SizeNESW;
                BottomBorder.RightCornerCursor = Cursors.SizeNWSE;
            }

            _windowEventHandler       = new WindowEventHandler(this, Parent);
            _settingsUpdater          = new SettingsUpdater(IsExecluded, this);
            _processExitHandler       = new ProcessExitHandler(this, Parent.Process);
            _skinWindowButtonsHandler = new SkinWindowButtonsHandler(this);
            _controlsChangeHandler    = new SkinWindowControlsChangeHandler(this);

            Skin = skin;
        }
Esempio n. 5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Shell shell = Window.Current.Content as Shell;

            if (shell == null)
            {
                // Create a AppShell to act as the navigation context and navigate to the first page
                shell = new Shell();

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                NavigationService = new NavigationService(shell.AppFrame);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Should load state from previous run
                }
                Window.Current.Content = shell;
            }

            if (NavigationService == null)
            {
                NavigationService = new NavigationService(shell.AppFrame);
            }

            if (e.Kind == ActivationKind.Launch)
            {
                SettingsUpdater.SendSettingsToServerAsync();
            }
            NavigationService.NavigateTo(typeof(Ogolne));

            // Ensure the current window is active
            Window.Current.Activate();

            ApplyThemes();
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            //CultureInfo culture = new CultureInfo("de-DE");
            //Thread.CurrentThread.CurrentCulture = culture;
            //Thread.CurrentThread.CurrentUICulture = culture;

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            RemoteUtility.Initialize();
            ThreadUtility.Initialize();

            // Update settings if necessary
            SettingsUpdater.CheckForUpdate();

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

#if DEBUG
                Komodex.Remote.Controls.MemoryCounters.Show();
#endif
            }

            // Initialize trial manager
            //TrialManager.SimulateTrialMode = true;
            //TrialManager.SimulateTrialExpired = true;
            TrialManager.TrialDays      = TrialDays;
            TrialManager.AutoStartTrial = false;
            TrialManager.Initialize();

            // Error reporter initialization
            PhoneAppCrashReporter.Initialize(this, RootFrame);
            CrashReporter.AdditionalLogInfoCallbacks.Add(RemoteUtility.DACPInfoCrashReporterCallback);

            ServerManager.Initialize();
            NetworkManager.Initialize();
            BonjourManager.Initialize();
            ConnectionStatusPopupManager.Initialize();

            // Other initialization
            SettingsManager.Initialize();

            // Tilt Effect
            TiltEffect.TiltableItems.Add(typeof(FakeButton));

#if WP7
            // Remove LongListSelector from the TiltableItems list
            TiltEffect.TiltableItems.Remove(typeof(LongListSelector));
#endif
        }
        public void TestSetup()
        {
            singularClient = Substitute.For <IClusterClient>();

            settingsUpdater = new SettingsUpdater(singularClient);
        }