Ejemplo n.º 1
0
        public ServiceSettingsView(PluginInstance servicePlugin)
        {
            this.servicePlugin = servicePlugin;
            service            = servicePlugin.Service;
            authenticatable    = service.AsAuthenticatable();
            if (authenticatable == null)
            {
                throw new ArgumentException("Service instance passed must implement IAuthenticatable", nameof(service));
            }
            InitializeComponent();
            sspSignInStatus = new SplitStringParser(signInStatusLabel);
            sspSignInButton = new SplitStringParser(signInButton);
            if (authenticatable.IsAuthenticated)
            {
                signInStatusLabel.Text = String.Format(sspSignInStatus.Get(authenticatable.IsAuthenticated),
                                                       LocalisableAccountNameFormat.GetFormattedName(authenticatable.Account));
            }
            else
            {
                sspSignInStatus.Update(false);
            }
            sspSignInButton.Update(authenticatable.IsAuthenticated);
            var control = service.GetSettingsControl();

            control.Dock = DockStyle.Fill;
            servicePanel.Controls.Add(control);
        }
Ejemplo n.º 2
0
        public ServiceSettingsView(MusicService service)
        {
            this.service = service;
            InitializeComponent();
            sspSignInStatus = new SplitStringParser(signInStatusLabel);
            sspSignInButton = new SplitStringParser(signInButton);
            if (service.IsAuthenticated)
            {
                signInStatusLabel.Text = String.Format(sspSignInStatus.Get(service.IsAuthenticated),
                                                       service.Settings.Response.UserName);
            }
            else
            {
                sspSignInStatus.Update(false);
            }
            sspSignInButton.Update(service.IsAuthenticated);
            var control = service.GetSettingsControl();

            control.Dock = DockStyle.Fill;
            servicePanel.Controls.Add(control);
        }