예제 #1
0
        public PlaylistWidget(DropConverter aDropConverter, IPlaylistSupport aSupport, UiOptions aUiOptions)
        {
            InitializeComponent();
            iUiOptions     = aUiOptions;
            iDropConverter = aDropConverter;
            iDragHelper    = new DragHelper(lstPlaylist);
            iDragHelper.EventDragInitiated += new EventHandler <MouseEventArgs>(iDragHelper_EventDragInitiated);

            lstPlaylist.SelectionMode = SelectionMode.Extended;
            iSupport = aSupport;
            DragScroller scroller = new DragScroller(lstPlaylist, delegate(DragEventArgs e)
            {
                return(GetEffects(e));
            });

            scroller.ItemsDropped += new EventHandler <DragScroller.EventArgsItemsDropped>(Scroller_ItemsDropped);
        }
예제 #2
0
        private void LoadStack(bool aCreatedNew)
        {
            iWindowLoaded.WaitOne();
            Linn.Kinsky.Model model = new Linn.Kinsky.Model(iViewMaster, iPlaySupport);
            iMediator = new Mediator(iHelper, model);

            Dispatcher.Invoke((Action) delegate()
            {
                iSystrayForm              = new SystrayForm(this);
                iSystrayForm.EventClosed += window_Closed;
                iSystrayForm.Text         = this.Title;
            });

            // create the drop converter for the browser views
            DropConverter browseDropConverter = new DropConverter();

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

            // create the drop converter 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());

            Dispatcher.Invoke((Action) delegate()
            {
                if (!aCreatedNew)
                {
                    double newX    = iUIOptions.WindowLocation.X + 10;
                    double newY    = iUIOptions.WindowLocation.Y + 10;
                    Point midpoint = new Point(newX + (Width / 2), newY + (Height / 2));
                    if (PointToScreen(midpoint).X >= SystemParameters.VirtualScreenWidth)
                    {
                        newX = 0;
                    }
                    if (PointToScreen(midpoint).Y >= SystemParameters.VirtualScreenHeight)
                    {
                        newY = 0;
                    }
                    Left = newX;
                    Top  = newY;
                    //iUIOptions.WindowLocation = new Point(Left, Top);
                }
                iSystrayForm.Initialise(iViewMaster);
                viewKinsky.Initialise(this, iHelper, iLocator, iViewSaveSupport, iPlaySupport, browseDropConverter, viewDropConverter, iViewMaster, iUIOptions, iGroupPlaylistOption, iHelper.Senders);

                SetThemeOverrides();
                kompactMenuItem.IsChecked = iUIOptions.MiniMode;
                mainWindowChrome.MiniModeActiveChanged += new EventHandler(mainWindowChrome_MiniModeActiveChanged);
            });

            EReleaseQuality currentBuildType = EReleaseQuality.Stable;

            if (iHelper.Title.ToLowerInvariant().Contains("nightly"))
            {
                currentBuildType = EReleaseQuality.Nightly;
            }
            else if (iHelper.Title.ToLowerInvariant().Contains("beta"))
            {
                currentBuildType = EReleaseQuality.Beta;
            }
            else if (iHelper.Title.ToLowerInvariant().Contains("development"))
            {
                currentBuildType = EReleaseQuality.Development;
            }
            else if (iHelper.Title.ToLowerInvariant().Contains("developer"))
            {
                currentBuildType = EReleaseQuality.Developer;
            }

            var appName = iHelper.Product;

            iAutoUpdate = new AutoUpdate(iHelper,
                                         AutoUpdate.DefaultFeedLocation(appName, "Windows"),
                                         1000 * 60 * 60,
                                         iAutoUpdateType,
                                         appName,
                                         kApplicationTarget,
                                         kUpdateVersion,
                                         currentBuildType);
            iAutoUpdate.EventUpdateFound += iAutoUpdate_EventUpdateFound;

            iHelper.SetStackExtender(this);
            iHelper.Stack.SetStatusHandler(new StackStatusHandlerWpf(iHelper.Title, iSystrayForm.NotifyIcon));

            Dispatcher.BeginInvoke((Action) delegate()
            {
                HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
                source.AddHook(HandleSessionEvents);
                if (!WTSRegisterSessionNotification((new WindowInteropHelper(this)).Handle, NOTIFY_FOR_THIS_SESSION))
                {
                    UserLog.WriteLine("Could not register for user session changes.");
                }
                iInitialSessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId;
                iSessionConnected = true;
                iSessionHookAdded = true;
                StartStack();
            });
            // show the options dialog if specified by the user
            if (iHelper.Stack.StatusHandler.ShowOptions)
            {
                Dispatcher.BeginInvoke((Action) delegate()
                {
                    ShowOptionsDialog(true);
                });
            }
        }
예제 #3
0
        internal void Initialise(KinskyDesktop aKinskyDesktop,
                                 HelperKinsky aHelperKinsky,
                                 ContentDirectoryLocator aLocator,
                                 IViewSaveSupport aSaveSupport,
                                 IPlaylistSupport aPlaylistSupport,
                                 DropConverter aBrowseDropConverter,
                                 DropConverter aViewDropConverter,
                                 ViewMaster aViewMaster,
                                 UiOptions aUIOptions,
                                 OptionBool aPlaylistGroupingOption,
                                 ModelSenders aSenders
                                 )
        {
            iHelperKinsky        = aHelperKinsky;
            iLocator             = aLocator;
            iBrowseDropConverter = aBrowseDropConverter;
            iViewMaster          = aViewMaster;
            iUIOptions           = aUIOptions;
            iSenders             = aSenders;
            iPlaylistSupport     = aPlaylistSupport;
            aPlaylistSupport.EventIsDraggingChanged += new EventHandler <EventArgs>(aPlaylistSupport_EventIsDraggingChanged);
            iViewDropConverter = aViewDropConverter;
            iBrowser           = new Browser(new Location(iLocator.Root));

            ViewWidgetButton upButtonWidgetBrowser = new ViewWidgetButton(buttonUpBrowser);

            breadcrumbBrowser.SetButtonUpDirectory(upButtonWidgetBrowser);

            iNavigationController = new NavigationController(iBrowser, iLocator, breadcrumbBrowser, iHelperKinsky);

            iBookmarks = new ViewWidgetBookmarks(iHelperKinsky,
                                                 iHelperKinsky.BookmarkManager,
                                                 lstBookmarks,
                                                 iBrowser,
                                                 popupBookmarksList,
                                                 popupAddBookmark,
                                                 buttonShowBookmarksList,
                                                 buttonShowAddBookmark,
                                                 buttonAddBookmark,
                                                 buttonCancelAddBookmark,
                                                 txtTitle,
                                                 txtBreadcrumb,
                                                 pnlAddBookmark,
                                                 iNavigationController);

            iBrowserWidget = new ViewWidgetBrowser(iPlaylistSupport,
                                                   iBrowseDropConverter,
                                                   buttonChangeSize,
                                                   buttonToggleListView,
                                                   iUIOptions,
                                                   sliderSize,
                                                   iNavigationController,
                                                   iBookmarks);
            pnlBrowser.Children.Add(iBrowserWidget);

            iRoomSelector = new ViewWidgetSelectorRoom(lstRooms, ctlSelectRoom, btnStandbyAll);
            IPlaylistWidget playlistMediaRenderer = new PlaylistWidget(aViewDropConverter, aPlaylistSupport, iUIOptions);
            IPlaylistWidget playlistRadio         = new PlaylistWidget(aViewDropConverter, aPlaylistSupport, iUIOptions);
            IPlaylistWidget playlistReceiver      = new PlaylistWidget(aViewDropConverter, aPlaylistSupport, iUIOptions);

            iViewWidgetPlaylistMediaRenderer = new ViewWidgetPlaylistMediaRenderer(pnlPlaylist, playlistMediaRenderer, aSaveSupport, aPlaylistSupport, aPlaylistGroupingOption.Native);
            iViewWidgetPlaylistRadio         = new ViewWidgetPlaylistRadio(pnlPlaylist, playlistRadio, aSaveSupport);
            iViewWidgetPlaylistAux           = new ViewWidgetPlaylistAux(pnlPlaylist);
            iViewWidgetPlaylistDiscPlayer    = new ViewWidgetPlaylistDiscPlayer(pnlPlaylist);
            iViewWidgetPlaylistReceiver      = new ViewWidgetPlaylistReceiver(pnlPlaylist, playlistReceiver, aSaveSupport, iSenders);

            iViewWidgetButtonStandby  = new ViewWidgetButtonStandby(this);
            iViewWidgetButtonSave     = new ViewWidgetButtonSave(buttonSave, aViewDropConverter, aSaveSupport);
            iViewWidgetButtonWasteBin = new ViewWidgetButtonWasteBin(buttonDelete, aViewDropConverter);

            iViewWidgetPlayMode = new ViewWidgetPlayMode(buttonRepeat, buttonShuffle);

            iViewWidgetTransportControl = new ViewWidgetTransportControl(aKinskyDesktop, threeKArray, aViewDropConverter, aPlaylistSupport);

            iViewWidgetPlayNowNextLater = new ViewWidgetPlayNowNextLater(aViewDropConverter, aPlaylistSupport, buttonPlayNow, buttonPlayNext, buttonPlayLater);

            iViewWidgetVolumeControl = new ViewWidgetVolumeControl(aKinskyDesktop, rotaryControlVolume, rockerControlVolume);
            iViewWidgetMediaTime     = new ViewWidgetMediaTime(rotaryControlMediaTime, rockerControlMediaTime);
            iViewWidgetTrack         = new ViewWidgetTrack(viewWidgetTrackDisplay, new IPlaylistWidget[] { playlistMediaRenderer, playlistRadio, playlistReceiver });
            SplitBarPositionLeft     = new GridLength(iUIOptions.BrowserSplitterLocationLeft, GridUnitType.Star);
            SplitBarPositionRight    = new GridLength(iUIOptions.BrowserSplitterLocationRight, GridUnitType.Star);
            iSourceSelector          = new ViewWidgetSelectorSource(lstSources, ctlSelectSource);

            iMediatorHouse = new MediatorHouse(iRoomSelector,
                                               iSourceSelector,
                                               pnlPlaylist,
                                               lstRooms,
                                               lstSources,
                                               buttonSelectRoom,
                                               buttonSelectSource,
                                               popupRoomSelection,
                                               popupSourceSelection,
                                               btnStandbyAll);;

            aPlaylistGroupingOption.EventValueChanged += (d, e) =>
            {
                iViewWidgetPlaylistMediaRenderer.SetGroupByAlbum(aPlaylistGroupingOption.Native);
            };

            iInitialised = true;
        }