Ejemplo n.º 1
0
        public void Update()
        {
            // this needless test is important due to a platform bug

            try
            {
                if (Application.Current.Resources.ContainsKey("ExtendedSplashBackground"))
                {
                    var unused = Application.Current.Resources["ExtendedSplashBackground"];
                }
            }
            catch { /* this is okay */ }

            if (Settings.EnableCustomTitleBar)
            {
                // this wonky style of loop is important due to a platform bug

                var count = Application.Current.Resources.Count;
                foreach (var resource in Application.Current.Resources)
                {
                    var key = resource.Key;
                    if (key == typeof(CustomTitleBar))
                    {
                        var style = resource.Value as Style;
                        var title = new CustomTitleBar();
                        title.Style = style;
                    }
                    count--;
                    if (count == 0)
                    {
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Setup()
        {
            charts     = StaticData.GetChartTypes();
            chartTypes = new ObservableCollection <string>(charts);
            chartTypeComboBox.ItemsSource = chartTypes;
            chartTypeComboBox.Text        = chartTypeComboBox.Items[0].ToString();

            CustomTitleBar titleBar = new CustomTitleBar();

            titleBar.TitleBarTitleText.Content = "Graphs and Trends";
            MainGrid.Children.Insert(0, titleBar);

            YAxisComboBox.IsEnabled        = false;
            XAxisComboBox.IsEnabled        = false;
            SelectedYearComboBox.IsEnabled = false;

            PopulateQuickStats();

            //Populate Quick Stats Values
            TotalCaseCount.Content          = totalCaseCount + @" Cases";
            TotalMoneySpentSoFar.Content    = @"£" + totalMoneySpentSoFar;
            LeastExpensiveCase.Content      = @"£" + leastExpensiveCase;
            MostExpensiveCase.Content       = @"£" + mostExpensiveCase;
            AvgWeeklyCaseCountCost.Content  = avgCaseCountAndCostPerWeek.Item1 + " / £" + avgCaseCountAndCostPerWeek.Item2;
            AvgMonthlyCaseCountCost.Content = avgCaseCountAndCostPerMonth.Item1 + " / £" + avgCaseCountAndCostPerMonth.Item2;
            AvgYearlyCaseCountCost.Content  = avgCaseCountAndCostPerYear.Item1 + " / £" + avgCaseCountAndCostPerYear.Item2;
            //MostUsedProductAndCost.Content = mostUsedProductAndCost.Item1 + " / £" + mostUsedProductAndCost.Item2;
            //LeastUsedProductAndCost.Content = leastUsedProductAndCost.Item1 + " / £" + leastUsedProductAndCost.Item2;
        }
Ejemplo n.º 3
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.");
 }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
        public OrdersPage()
        {
            InitializeComponent();

            SetupUpToDateButton();
            RefreshScrollViewer();

            CustomTitleBar titleBar = new CustomTitleBar();

            titleBar.TitleBarTitleText.Content = "These Items Need Ordering:";
            MainGrid.Children.Add(titleBar);
        }
        public MainWindow()
        {
            AvaloniaXamlLoader.Load(this);
            this.AttachDevTools();

            // Weird OSX hack to hide decorations properly
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                SystemDecorations    = SystemDecorations.Full;
                HasSystemDecorations = false;
            }

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

            BuildOptionsMenu();
        }