Exemple #1
0
 public Status()
 {
     this.InitializeComponent();
     radarrService = new RadarrService();
     radarrClient  = radarrService.GetService();
     GetStatusDetails();
 }
        public Queue()
        {
            this.InitializeComponent();
            RadarrService radarrService = new RadarrService();

            radarrClient = radarrService.GetService();

            GetQueue();
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            int errors = 0;

            if (APIKeyValue.Text == "" || APIKeyValue.Text.Length != 32)
            {
                APIKeyValue.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Red);
                SavedText.Visibility    = Visibility.Visible;
                SavedText.Text          = "Please enter your Radarr API key.";
                SavedText.Foreground    = new SolidColorBrush(Windows.UI.Colors.Red);
                return;
            }

            roamingSettings.Values["serverURL"] = HostnameValue.Text;
            roamingSettings.Values["apiKey"]    = APIKeyValue.Text;
            roamingSettings.Values["https"]     = UseHTTPS.IsOn;

            try
            {
                int.Parse(PortValue.Text);
                roamingSettings.Values["port"] = PortValue.Text;
            }
            catch (Exception)
            {
                errors += 1;
            }

            if (errors > 0)
            {
                PortValue.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Red);
                SavedText.Visibility  = Visibility.Visible;
                SavedText.Text        = "Please enter a number in the port field.";
                SavedText.Foreground  = new SolidColorBrush(Windows.UI.Colors.Red);
            }
            else
            {
                try
                {
                    RadarrService rs = new RadarrService();
                    RadarrClient  rc = rs.GetService();

                    await rc.Movie.GetMovies();
                } catch
                {
                    var dialog = new MessageDialog("There was an error testing your settings, please ensure the details entered are correct.", "Error testing connection");
                    _ = await dialog.ShowAsync();

                    return;
                }

                PortValue.BorderBrush   = new SolidColorBrush(Windows.UI.Colors.DarkGray);
                APIKeyValue.BorderBrush = new SolidColorBrush(Windows.UI.Colors.DarkGray);
                SavedText.Visibility    = Visibility.Visible;
                SavedText.Foreground    = new SolidColorBrush(Windows.UI.Colors.Green);
                SavedText.Text          = "Your settings have been saved.";

                Debug.WriteLine(Frame.Parent.GetType().FullName);

                NavigationView navView = (NavigationView)Frame.Parent;

                foreach (NavigationViewItem navItem in navView.MenuItems)
                {
                    navItem.IsEnabled = true;
                }
            }
        }