Ejemplo n.º 1
0
        public BaseTileGrid(TileTheme tileTheme, UIElement background, string settingsFile, int gridWidth, int gridHeight)
        {
            _tileTheme = tileTheme;

            _gridWidth = gridWidth;
            _gridHeight = gridHeight;
            _settingsFile = settingsFile;

            // запрет перерисовки во время скроллирования
            OnStartScroll = () => FreezeUpdate(true);
            OnStopScroll = () => FreezeUpdate(false);

            VerticalScroll = true;
            HorizontalScroll = false;

            TapHandler = GridClickHandler;
            HoldHandler = p =>
            {
                if (!SelectionMode)
                    ShowMainPopupMenu(p);
                return true;
            };

            // холст контейнер плиток
            _tilesCanvas = new TilesCanvas(background);
            Content = _tilesCanvas;

            ReadTilesSettings();
        }
Ejemplo n.º 2
0
        public MainSettings()
        {
            ThemeIsDark = (MetroTheme.PhoneBackgroundBrush != Color.White);
            AccentColor = MetroTheme.PhoneAccentBrush;

            TileThemeIndex = 0;
            _tileTheme = new TileThemeWP7();
        }
Ejemplo n.º 3
0
        public TilesGrid(TileTheme tileTheme)
            : base(tileTheme, GetBackground(), "", 4, 100)
        {
            // подписка на событие добавления программы из меню
            var messenger = TinyIoCContainer.Current.Resolve<ITinyMessengerHub>();
            messenger.Subscribe<PinProgramMessage>(msg => PinProgram(msg.Name, msg.Path));

            // подписываемся на событие смены настроек для отлова смены темы
            messenger.Subscribe<SettingsChangedMessage>(OnSettingsChanged);

            SizeChanged += (sender, args) => OnSizeChanged();
        }
Ejemplo n.º 4
0
 public HubPageTileGrid(TileTheme tileTheme, UIElement background, string settingsFile, int gridWidth, int gridHeight)
     : base(tileTheme, background, settingsFile, gridWidth, gridHeight)
 {
 }
Ejemplo n.º 5
0
        public HomeScreen()
            : base(false)
        {
            theForm.ControlBox = false;
            theForm.Menu = null;
            theForm.Text = "";

            Control.EntranceDuration = 100;

            ReadThemeSettings();

            var mainSettings = TinyIoCContainer.Current.Resolve<MainSettings>();
            _tileTheme = mainSettings.GetTileTheme();
            if (mainSettings.FullScreen)
                SwitchFullScreen(true); //!! do not decrease counter when start in normal mode

            // фон окна
            var background = new ThemedBackground { Location = new Point(0, 0), };
            Control.AddElement(background);
            TinyIoCContainer.Current.Register<ScaledBackground>(background);

            // загрузчик плагинов
            TinyIoCContainer.Current.Register<IPluginManager>(new PluginManager());

            // холст главной страницы
            _homeScreenCanvas = new Canvas
                                    {
                                        Size = this.Size,
                                        Location = new Point(0, 0),
                                    };

            // экран блокировки
            var lockScreen = new LockScreenManager();
            AddSection(lockScreen, 0);

            // прокрутчик холста плиток
            var tilesGrid = new TilesGrid.TilesGrid(_tileTheme)
                                {
                                    OnExit = ExitApp,
                                    OnShowMainSettings = ShowMainSettings,
                                };
            AddSection(tilesGrid, 1);

            // стрелка переключатель страниц
            _switchArrowNext = new ThemedImageButton("next")
            {
                Location = new Point(ArrowPosNext, _tileTheme.ArrowPosY),
                TapHandler = p => { CurrentSection = 2; return true; },
            };
            _homeScreenCanvas.AddElement(_switchArrowNext);

            _switchArrowBack = new ThemedImageButton("back")
            {
                Location = new Point(ArrowPosBack, _tileTheme.ArrowPosY),
                TapHandler = p => { CurrentSection = 1; return true; },
            };
            _homeScreenCanvas.AddElement(_switchArrowBack);

            // список программ
            var programsSv = new ProgramsMenuPage();
            AddSection(programsSv, 2);

            Control.AddElement(_homeScreenCanvas);

            _homeScreenCanvas.FlickHandler = Flick;

            _systemState.Changed += OnSystemStateChanged;
            TheForm.Deactivate += (s, e) => OnDeactivate();

            // deactivate all other pages but first
            CurrentSection = 1;

            // subscribe to events - show page and change main settings
            var messenger = TinyIoCContainer.Current.Resolve<ITinyMessengerHub>();
            messenger.Subscribe<ShowPageMessage>(msg => OnShowPage(msg.Page));
            messenger.Subscribe<SettingsChangedMessage>(OnSettingsChanged);
            messenger.Subscribe<FullScreenMessage>(OnFullScreen);
        }
Ejemplo n.º 6
0
        protected virtual void OnSettingsChanged(SettingsChangedMessage settingsChangedMessage)
        {
            if (settingsChangedMessage.PropertyName == "TileTheme")
            {
                _tileTheme = settingsChangedMessage.Value as TileTheme;
                _switchArrowNext.Location = new Point(ArrowPosNext, _tileTheme.ArrowPosY);
                _switchArrowBack.Location = new Point(ArrowPosBack, _tileTheme.ArrowPosY);

                _homeScreenCanvas.Update();
            }
        }