示例#1
0
        public MainForm()
        {
            mediaDownloadQueue = new MediaDownloadQueue
            {
                Tagger      = new TrackTagger(),
                UseTempFile = true
            };
            ApplySettings();

            InitializeComponent();
            queueListView.SmallImageList = GlobalImageList.Instance.ImageList;
            resolver = new UrlResolver(Program.DefaultPluginManager);
            aui      = new AuthenticationUi(this);
            UnlockUi();

            // Add event handlers for MDQ
            mediaDownloadQueue.Exception              += MediaDownloadQueue_Exception;
            mediaDownloadQueue.CollectionDequeued     += MediaDownloadQueue_CollectionDequeued;
            mediaDownloadQueue.TrackDequeued          += MediaDownloadQueue_TrackDequeued;
            mediaDownloadQueue.TrackDownloadCompleted += MediaDownloadQueue_TrackDownloadCompleted;
            mediaDownloadQueue.TrackDownloadProgress  += MediaDownloadQueue_TrackDownloadProgress;

            // Error handler for plugin loader
            Program.DefaultPluginManager.LoadException += DefaultPluginManagerOnLoadException;
        }
 public ServiceSettingsView(PluginInstance servicePlugin)
 {
     this.servicePlugin = servicePlugin;
     service            = servicePlugin.Service;
     authenticatable    = service.AsAuthenticatable();
     InitializeComponent();
     aui = new AuthenticationUi(ParentForm);
     if (authenticatable == null)
     {
         authPanel.Visible = false;
     }
     else
     {
         UpdateViews();
     }
     try
     {
         var control = service.GetSettingsControl();
         control.Dock = DockStyle.Fill;
         servicePanel.Controls.Add(control);
     }
     catch (Exception ex)
     {
         Log.WriteException(Level.Error, Lag, ex, "service.GetSettingsControl()");
         var text  = "An error occurred while trying to display the service's settings panel.\n\n" + ex;
         var label = new Label
         {
             AutoSize = false,
             Dock     = DockStyle.Fill,
             Padding  = new Padding(10),
             Text     = text
         };
         servicePanel.Controls.Add(label);
     }
 }