예제 #1
0
 public MainForm(PlayerControllerService control)
 {
     if (control == null) return;
     _control = control;
     InitializeComponent();
     Icon = new Icon(GetType(), "Main.ico");
 }
예제 #2
0
        public OSDService(PlayerControllerService controller)
        {
            if (controller == null) return;
            _controller = controller;
            _controller.Player.OnPlayerPlayEvent += OnPlayerEvent;
            _controller.Player.OnPlayerPlayingTrackChangedEvent += OnPlayerEvent;
            _controller.Player.OnPlayerStopEvent += OnPlayerEvent;
            _osd = new OSDForm();
            ApplySettings();

            Settings.Default.SettingsSaving += SettingsSaving;
        }
예제 #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (var control = new PlayerControllerService())
            {
                control.Player.OnAboutToPromptUserToQuitEvent += Application.Exit;

                // Hotkey service
                using (var hotkeyService = new HotkeyService())
                {
                    control.RegisterHotkeyService(hotkeyService);

                    var selectSongVisualService = new VisualService
                    {
                        Form = new SelectSongForm(control.Player),
                        MenuEntry = "&Select song"
                    };
                    hotkeyService.RegisterHotKey("SelectSong",
                        (o, e) => selectSongVisualService.Activate());

                    // Tray service
                    using (var trayService = new TrayService(new[] { selectSongVisualService,
                        new VisualService {
                            Form = new MainForm(control),
                            MenuEntry = "Show &MiniPlayer"
                        },
                        new VisualService {
                            Form = new SettingsForm(),
                            MenuEntry = "S&ettings"
                        }
                    }))
                    {
                        control.RegisterNotificationService(trayService);
                        using (new OSDService(control))
                        {
                            Application.Run();
                        }
                    }
                }
            }
        }