Exemplo n.º 1
0
        public ViewSupport(OptionPageColours aOptionPageColours, OptionPageFonts aOptionPageFonts)
        {
            iOptionPageColours = aOptionPageColours;
            iOptionPageFonts   = aOptionPageFonts;

            iFontSmall  = new Font("Arial", iOptionPageFonts.SmallSize, FontStyle.Bold);
            iFontMedium = new Font("Arial", iOptionPageFonts.MediumSize, FontStyle.Bold);
            iFontLarge  = new Font("Arial", iOptionPageFonts.LargeSize, FontStyle.Bold);

            iOptionPageColours.EventChanged += OptionPageColoursChanged;
            iOptionPageFonts.EventChanged   += OptionPageFontsChanged;
        }
Exemplo n.º 2
0
        public FormKinskyDesktop(HelperKinsky aHelperKinsky)
        {
            iCurrentView = 0;

            iHelper = aHelperKinsky;

            KinskyDesktop.Properties.Resources.SetBasePath(iHelper.ExePath.FullName);

            InitializeComponent();

            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
            }

            Icon = Icon.FromHandle(Linn.Kinsky.Properties.Resources.KinskyLogo.GetHicon());

            SplitContainer.Panel1MinSize    = 200;
            SplitContainer.Panel2MinSize    = 200;
            SplitContainer.SplitterDistance = (int)(Width * 0.5f);

            Text = iHelper.Product;

            notifyIcon.Text = iHelper.Product;
            try
            {
                notifyIcon.Icon = Icon;
            }
            catch (NotImplementedException) { } // thrown on MacOSX

            kHeaderLeft   = KinskyDesktop.Properties.Resources.Wing1;
            kHeaderRight  = KinskyDesktop.Properties.Resources.Wing2;
            kHeaderFiller = KinskyDesktop.Properties.Resources.FillerTop;

            kFooterLeft   = KinskyDesktop.Properties.Resources.Wing3;
            kFooterRight  = KinskyDesktop.Properties.Resources.Wing4;
            kFooterFiller = KinskyDesktop.Properties.Resources.FillerBottom;

            kRightEdgeFiller = KinskyDesktop.Properties.Resources.RightEdgeFiller;
            kLeftEdgeFiller  = KinskyDesktop.Properties.Resources.LeftEdgeFiller;

            kMiniLeft   = KinskyDesktop.Properties.Resources.MiniWing1;
            kMiniRight  = KinskyDesktop.Properties.Resources.MiniWing2;
            kMiniFiller = KinskyDesktop.Properties.Resources.MiniFiller;

            iBrushHeaderFiller = new TextureBrush(kHeaderFiller);
            iBrushLeftFiller   = new TextureBrush(kLeftEdgeFiller);
            iBrushLeftFiller.TranslateTransform(0, kHeaderLeft.Height);
            iBrushRightFiller  = new TextureBrush(kRightEdgeFiller);
            iBrushFooterFiller = new TextureBrush(kFooterFiller);
            iBrushMiniFiller   = new TextureBrush(kMiniFiller);

            iHttpClient = new HttpClient();
            iHttpServer = new HttpServer(HttpServer.kPortKinskyDesktop);

            iUiOptions = new UiOptions(iHelper);

            iOptionPageGeneral = new OptionPageGeneral();
            iHelper.AddOptionPage(iOptionPageGeneral);

            iOptionPageColours = new OptionPageColours();
            iHelper.AddOptionPage(iOptionPageColours);

            iOptionPageFonts = new OptionPageFonts();
            iHelper.AddOptionPage(iOptionPageFonts);

            iArtworkCache = new ArtworkCache(ArtworkCache.ECacheSize.eMedium);

            iViewSupport = new ViewSupport(iOptionPageColours, iOptionPageFonts);

            iLibrary         = new MediaProviderLibrary(iHelper);
            iLocalPlaylists  = new LocalPlaylists(iHelper, true);
            iSharedPlaylists = new SharedPlaylists(iHelper);

            MediaProviderSupport mediaProviderSupport = new MediaProviderSupport(iHttpServer);

            iOptionPageGeneral.EventTransparencyChanged      += TransparencyOrBorderChanged;
            iOptionPageGeneral.EventWindowBorderChanged      += TransparencyOrBorderChanged;
            iOptionPageGeneral.EventHideMouseCursorChanged   += HideMouseCursorChanged;
            iOptionPageGeneral.EventUseRotaryControlsChanged += UseRotaryControlsChanged;
            iOptionPageGeneral.EventShowToolTipsChanged      += ShowToolTipsChanged;
            iViewSupport.EventSupportChanged += EventSupportChanged;

            iFormUserLog = new FormUserLog(Icon);

            iViewStatus                 = new FormStatus(this, iArtworkCache, iViewSupport);
            iViewStatus.UseTheme        = false;
            iViewStatus.Icon            = Icon;
            iViewStatus.Visible         = false;
            iViewStatus.TopLevel        = false;
            iViewStatus.FormBorderStyle = FormBorderStyle.None;
            iViewStatus.MouseMove      += FormKinskyDesktop_MouseMove;
            Controls.Add(iViewStatus);

            PluginManager pluginManager = new PluginManager(iHelper, iHttpClient, mediaProviderSupport);

            iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler());
            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
            OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);
            OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists);

            iSaveSupport     = new SaveSupport(iHelper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(RequestLocalPlaylistFilename, iSaveSupport);

            iPlaySupport = new PlaySupport();

            // create the DropConverter for the browse views
            DropConverter browseDropConverter = new DropConverter();

            browseDropConverter.Add(new DropConverterInternal());
            browseDropConverter.Add(new DropConverterUri());
            browseDropConverter.Add(new DropConverterFileDrop(iHttpServer, false));
            browseDropConverter.Add(new DropConverterText());

            MediatorLocation location = new MediatorLocation();

            MediatorTab tab = new MediatorTab(this, location);

            IBrowser b = new Browser(new Location(iLocator));

            tab.Add(new ViewWidgetTabPage(this, 0), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 1), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 2), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 3), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);

            location.Add(tab);

            ViewWidgetBreadcrumb breadcrumb = new ViewWidgetBreadcrumb(this, iViewSupport, location, new ViewWidgetButtonUp(this));

            location.Add(breadcrumb);

            // create the DropConverter for the other views
            DropConverter viewDropConverter = new DropConverter();

            viewDropConverter.Add(new DropConverterInternal());
            viewDropConverter.Add(new DropConverterUri());
            viewDropConverter.Add(new DropConverterFileDrop(iHttpServer, true));
            viewDropConverter.Add(new DropConverterText());

            iSourceList = new ReceiverSourceList(iHelper);

            iView  = new View(this, iArtworkCache, iViewSupport, iPlaySupport, iViewSaveSupport, viewDropConverter, iSourceList, iHelper.Senders);
            iModel = new Model(iView, iPlaySupport);

            iMediator = new Mediator(iHelper, iModel);

            iHelper.SetStackExtender(this);
            iHelper.Stack.SetStatusHandler(new StackStatusHandlerWinForms(iHelper.Title, notifyIcon));
        }