Ejemplo n.º 1
0
 public async Task <AuthenticationResult> Restore(MusicService service)
 {
     ServiceBeginAuthenticating(service);
     try
     {
         return(new AuthenticationResult(service, await service.AsAuthenticatable().RestoreAsync(), null));
     }
     catch (Exception ex)
     {
         return(new AuthenticationResult(service, false, ex));
     }
     finally
     {
         ServiceEndAuthenticating(service);
     }
 }
Ejemplo n.º 2
0
        public ServiceSettingsView(PluginInstance servicePlugin)
        {
            this.servicePlugin = servicePlugin;
            service            = servicePlugin.Service;
            authenticatable    = service.AsAuthenticatable();
            InitializeComponent();
            if (authenticatable == null)
            {
                authPanel.Visible = false;
            }
            else
            {
                UpdateLabels();
            }
            var control = service.GetSettingsControl();

            control.Dock = DockStyle.Fill;
            servicePanel.Controls.Add(control);
        }
Ejemplo n.º 3
0
 private void servicesListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedInstance = services[servicesListBox.SelectedIndex];
     selectedService  = selectedInstance.Service;
     serviceUiPanel.Controls.Clear();
     if (selectedService.AsAuthenticatable() != null)
     {
         var ssv = new ServiceSettingsView(selectedInstance)
         {
             Dock = DockStyle.Fill
         };
         serviceUiPanel.Controls.Add(ssv);
     }
     else
     {
         serviceUiPanel.Controls.Add(selectedService.GetSettingsControl());
     }
     serviceNameLabel.Text        = selectedService.Info.Name;
     serviceDescriptionLabel.Text = selectedService.Info.Description;
     serviceAuthorLabel.Text      = selectedService.Info.Author;
     serviceWebsiteLabel.Text     = selectedService.Info.Website.ToString();
 }