Beispiel #1
0
        public void ShowPopup(bool ignoreRestrictions = false)
        {
            DateTime now = DateTime.UtcNow;

            if ((now.Subtract(_lastPopupTime).TotalSeconds >= 5 && !IsActive) || ignoreRestrictions)
            {
                if (_popup.IsVisible)
                {
                    _popup.UpdateSettings();
                    _popup.RearmTimer();
                }

                try
                {
                    _popup.Show();
                }
                catch (InvalidOperationException)
                {
                    /* Window already closed down */
                    _popup = new BudsPopup();
                    _popup.Show();
                }
                _lastPopupTime = now;
            }
        }
Beispiel #2
0
 /* Public constructor for XAMLIL only */
 public MainWindow()
 {
     /* Init with dummy objects */
     _titleBar = new CustomTitleBar();
     _popup    = new BudsPopup();
     Pager     = new PageContainer();
     Log.Error("MainWindow: Initialized without modified PlatformImpl. Features making use of legacy Win32 APIs may be unavailable.");
 }
Beispiel #3
0
        public MainWindow(IWindowImpl impl) : base(impl)
        {
            AvaloniaXamlLoader.Load(this);
            this.AttachDevTools();

            Pager = this.FindControl <PageContainer>("Container");

            Pager.RegisterPages(HomePage, new AmbientSoundPage(), new FindMyGearPage(), new FactoryResetPage(),
                                new CreditsPage(), new TouchpadPage(), new EqualizerPage(), new AdvancedPage(), new NoiseProPage(),
                                new SystemPage(), new SelfTestPage(), new SettingsPage(), new PopupSettingsPage(),
                                ConnectionLostPage, CustomTouchActionPage, DeviceSelectionPage, new SystemInfoPage(),
                                new WelcomePage(), UnsupportedFeaturePage, UpdatePage, UpdateProgressPage, new SystemCoredumpPage(),
                                new HotkeyPage());

            _titleBar = this.FindControl <CustomTitleBar>("TitleBar");
            _titleBar.PointerPressed += (i, e) => PlatformImpl?.BeginMoveDrag(e);
            _titleBar.OptionsPressed += (i, e) => _titleBar.OptionsButton.ContextMenu.Open(_titleBar.OptionsButton);

            _popup = new BudsPopup();

            BluetoothImpl.Instance.BluetoothError += OnBluetoothError;
            BluetoothImpl.Instance.Disconnected   += OnDisconnected;
            BluetoothImpl.Instance.Connected      += OnConnected;

            SPPMessageHandler.Instance.ExtendedStatusUpdate += OnExtendedStatusUpdate;
            SPPMessageHandler.Instance.StatusUpdate         += OnStatusUpdate;
            SPPMessageHandler.Instance.OtherOption          += HandleOtherTouchOption;

            EventDispatcher.Instance.EventReceived += OnEventReceived;
            NotifyIconImpl.Instance.LeftClicked    += TrayIcon_OnLeftClicked;
            TrayManager.Instance.Rebuild();

            Pager.PageSwitched  += (sender, pages) => BuildOptionsMenu();
            Loc.LanguageUpdated += BuildOptionsMenu;
            BuildOptionsMenu();

            if (BluetoothImpl.Instance.RegisteredDeviceValid)
            {
                Task.Factory.StartNew(() => BluetoothImpl.Instance.ConnectAsync());
                Pager.SwitchPage(AbstractPage.Pages.Home);
            }
            else
            {
                Pager.SwitchPage(AbstractPage.Pages.Welcome);
            }

            if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                if (desktop.Args.Contains("/StartMinimized") && PlatformUtils.SupportsTrayIcon)
                {
                    WindowState = WindowState.Minimized;
                }
            }
        }
 private void NewPopup(Screen screen)
 {
     Dispatcher.Invoke(() =>
     {
         BudsPopup pop = new BudsPopup(screen,
                                       BluetoothService.Instance.ActiveModel, _previousTrayBL,
                                       _previousTrayBR, _previousTrayBC);
         pop.ClickedEventHandler += CloseAllPopups;
         pop.HideHeader           = Settings.Default.ConnectionPopupCompact;
         pop.PopupPlacement       = Settings.Default.ConnectionPopupPosition;
         pop.ShowWindowWithoutFocus();
         _previousBudsPopups.Add(pop);
     });
 }
        /**
         * Only for testing/demo use. Please call ShowPopup instead.
         */
        public void ShowDemoPopup()
        {
            Dispatcher.Invoke(() => {
                _previousBudsPopup?.Close();

                BudsPopup pop = new BudsPopup(
                    BluetoothService.Instance.ActiveModel, _previousTrayBL,
                    _previousTrayBR, _previousTrayBC);
                pop.HideHeader     = Settings.Default.ConnectionPopupCompact;
                pop.PopupPlacement = Settings.Default.ConnectionPopupPosition;
                pop.ShowWindowWithoutFocus();
                _previousBudsPopup = pop;
            });
        }
Beispiel #6
0
        /*
         * Popup
         */
        public void ShowPopup(int bl, int br, int bc)
        {
            Dispatcher.Invoke(() => {
                if (!this.IsActive && (bl > 0 || br > 0 || bc > 0) &&
                    Settings.Default.ConnectionPopupEnabled)
                {
                    _previousBudsPopup?.Close();

                    BudsPopup pop = new BudsPopup(
                        BluetoothService.Instance.ActiveModel, bl, br, bc);
                    pop.HideHeader     = Settings.Default.ConnectionPopupCompact;
                    pop.PopupPlacement = Settings.Default.ConnectionPopupPosition;
                    pop.ShowWindowWithoutFocus();
                    _previousBudsPopup = pop;
                }
            });
        }
Beispiel #7
0
        /**
         * Only for testing/demo use. Please call ShowPopup instead.
         */
        public void ShowDemoPopup()
        {
            SentrySdk.ConfigureScope(scope =>
            {
                scope.AddBreadcrumb("Test-Message", "Note");
                scope.SetTag("demo-popup", "true");
                scope.SetExtra("page", PageControl.CurrentPage.Name);


                Console.WriteLine("In scope");
            });

            Dispatcher.Invoke(() => {
                _previousBudsPopup?.Close();

                BudsPopup pop = new BudsPopup(
                    BluetoothService.Instance.ActiveModel, _previousTrayBL,
                    _previousTrayBR, _previousTrayBC);
                pop.HideHeader     = Settings.Default.ConnectionPopupCompact;
                pop.PopupPlacement = Settings.Default.ConnectionPopupPosition;
                pop.ShowWindowWithoutFocus();
                _previousBudsPopup = pop;
            });
        }