Пример #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusbar.BackgroundColor = new Windows.UI.Color()
                {
                    R = 76, G = 155, B = 214
                };
                statusbar.BackgroundOpacity = 1;
                statusbar.ForegroundColor   = Windows.UI.Colors.White;
            }

            _connection = App.Context.Connections.FirstOrDefault(c => c.Id.Equals(e.Parameter?.ToString(), StringComparison.OrdinalIgnoreCase));

            NavMenuList.SelectedIndex = 0;
            navlist[0].IsSelected     = true;
            AppFrame.Navigate(navlist[0].DestPage, navlist[0].Arguments);

            if (_connection != null)
            {
                if (Frame.CanGoBack)
                {
                    Frame.GoBack();
                }
                return;
            }

            //if (_connection.Kodi.IsMocked)
            //{
            //    ButtonMovies.Visibility = Visibility.Collapsed;
            //    ButtonMusic.Visibility = Visibility.Collapsed;
            //    ButtonAddons.Visibility = Visibility.Collapsed;
            //    ButtonPlaylists.Visibility = Visibility.Collapsed;
            //}
            //else
            //{
            //    ButtonMovies.Visibility = Visibility.Visible;
            //    ButtonMusic.Visibility = Visibility.Visible;
            //    ButtonAddons.Visibility = Visibility.Visible;
            //    ButtonPlaylists.Visibility = Visibility.Visible;
            //}

            App.Context.SetDefaultConnection(_connection);
            App.Context.Save();

            await _connection.TestConnectionAsync();
        }
Пример #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusbar.BackgroundColor = new Windows.UI.Color()
                {
                    R = 40, G = 42, B = 43
                };
                statusbar.BackgroundOpacity = 1;
                statusbar.ForegroundColor   = Windows.UI.Colors.White;
            }

            string parameter = e.Parameter.ToString();

            if ("new".Equals(parameter, StringComparison.OrdinalIgnoreCase))
            {
                _newConnection = true;
                _connection    = new KodiConnection {
                    Kodi = KodiRemote.Core.Connection.Default()
                };
            }
            else
            {
                _newConnection = false;
                _connection    = App.Context.Connections.FirstOrDefault(c => c.Id.Equals(parameter, StringComparison.OrdinalIgnoreCase));
            }

            Address    = _connection.Kodi.Address;
            Port       = _connection.Kodi.Port;
            Login      = _connection.Kodi.Login;
            Password   = _connection.Kodi.Password;
            MacAddress = _connection.Kodi.MacAddress;

            DataContext = this;
        }