Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="aViewInfo">
        /// A <see cref="UIViewInfo"/>
        /// </param>
        /// <param name="aOptionExtendedTrackInfo">
        /// A <see cref="OptionBool"/>
        /// </param>
        public ViewWidgetTrackMetadata(UIViewInfo aViewInfo, OptionBool aOptionExtendedTrackInfo)
        {
            iViewInfo = aViewInfo;

            iOptionExtendedTrackInfo = aOptionExtendedTrackInfo;
            iOptionExtendedTrackInfo.EventValueChanged += OptionExtendedTrackInfoChanged;
        }
Exemple #2
0
        public UiOptions(IHelper aHelper)
        {
            iWindowWidth     = new OptionDouble("windowwidth", "WindowWidth", "", 1024);
            iWindowHeight    = new OptionDouble("windowheight", "WindowHeight", "", 600);
            iWindowLocationX = new OptionDouble("windowx", "WindowLocationX", "", -1);
            iWindowLocationY = new OptionDouble("windowy", "WindowLocationY", "", -1);

            iBrowserSplitterLocationLeft  = new OptionInt("browsersplitterleft", "BrowserSplitterLocationLeft", "", 652);
            iBrowserSplitterLocationRight = new OptionInt("browsersplitterright", "BrowserSplitterLocationRight", "", 404);
            iFullscreen    = new OptionBool("fullscreen", "Fullscreen", "", false);
            iMiniMode      = new OptionBool("minimode", "MiniMode", "", false);
            iContainerView = new OptionUint("containerview", "ContainerView", "", 0);
            iContainerViewSizeThumbsView = new OptionDouble("containerviewsizethumbs", "ContainerViewSizeThumbs", "", 150);
            iContainerViewSizeListView   = new OptionDouble("containerviewsizelist", "ContainerViewSizeList", "", 100);

            iOptionDialogSettings = new OptionDialogSettings();

            aHelper.AddOption(iWindowWidth);
            aHelper.AddOption(iWindowHeight);
            aHelper.AddOption(iWindowLocationX);
            aHelper.AddOption(iWindowLocationY);
            aHelper.AddOption(iBrowserSplitterLocationLeft);
            aHelper.AddOption(iBrowserSplitterLocationRight);
            aHelper.AddOption(iFullscreen);
            aHelper.AddOption(iMiniMode);
            aHelper.AddOption(iContainerView);
            aHelper.AddOption(iContainerViewSizeThumbsView);
            aHelper.AddOption(iContainerViewSizeListView);
            aHelper.AddOption(iOptionDialogSettings);
        }
        private static List <IOption> SetupOptionsView()
        {
            var expectedOptionBool = new OptionBool
            {
                Name  = "bool",
                Value = false
            };
            var expectedOptionInt = new OptionInt
            {
                Name  = "int",
                Value = 10
            };
            var expectedOptionAutocompletebox = new OptionAutocomplete
            {
                Name  = "auto",
                Value = "new text"
            };
            var expectedOptions = new List <IOption>
            {
                expectedOptionBool,
                expectedOptionInt,
                expectedOptionAutocompletebox
            };

            return(expectedOptions);
        }
Exemple #4
0
        public UiOptions(IHelper aHelper)
        {
            iWindowWidth       = new OptionInt("windowwidth", "WindowWidth", "", 1024);
            iWindowHeight      = new OptionInt("windowheight", "WindowHeight", "", 600);
            iWindowLocationX   = new OptionInt("windowx", "WindowLocationX", "", -1);
            iWindowLocationY   = new OptionInt("windowy", "WindowLocationY", "", -1);
            iSplitterLocation  = new OptionInt("splitterx", "SplitterLocation", "", 502);
            iFullscreen        = new OptionBool("fullscreen", "Fullscreen", "", false);
            iMiniMode          = new OptionBool("minimode", "MiniMode", "", false);
            iMiniModeWidth     = new OptionInt("minimodewidth", "MiniModeWidth", "", Screen.PrimaryScreen.WorkingArea.Width / 2);
            iMiniModeLocationX = new OptionInt("minimodex", "MiniModeLocationX", "", Screen.PrimaryScreen.WorkingArea.Width / 2);
            iMiniModeLocationY = new OptionInt("minimodey", "MiniModeLocationY", "", Screen.PrimaryScreen.WorkingArea.Height - 100);
            iAlbumView         = new OptionUint("albumview", "AlbumView", "", 0);
            iContainerView     = new OptionUint("containerview", "ContainerView", "", 0);
            iContainerViewSize = new OptionUint("containerviewsize", "ContainerViewSize", "", 0);

            aHelper.AddOption(iWindowWidth);
            aHelper.AddOption(iWindowHeight);
            aHelper.AddOption(iWindowLocationX);
            aHelper.AddOption(iWindowLocationY);
            aHelper.AddOption(iSplitterLocation);
            aHelper.AddOption(iFullscreen);
            aHelper.AddOption(iMiniMode);
            aHelper.AddOption(iMiniModeWidth);
            aHelper.AddOption(iMiniModeLocationX);
            aHelper.AddOption(iMiniModeLocationY);
            aHelper.AddOption(iAlbumView);
            aHelper.AddOption(iContainerView);
            aHelper.AddOption(iContainerViewSize);
        }
        public OptionPageSetup(HelperKinskyJukebox aHelper)
            : base("Setup")
        {
            iHelper = aHelper;

            iCollectionLocation = new OptionFolderPath("scandirectory", "Scan Directory", "Select the directory to scan for music (root directory of your music collection)", "");
            Add(iCollectionLocation);

            iCollectionHttpLocation = new OptionUri("scanurl", "URL of Scan Directory", "Web accessible address of your scan directory." + Environment.NewLine + "If you are using a NAS based webserver, please enter a valid http location (i.e. http://<ip address of nas>/<music share>)." + Environment.NewLine + "Click the 'Test' button to insure this location opens in a web browser and points to your Scan Directory (root directory of your music collection)." + Environment.NewLine + "Otherwise, you can allow Kinsky Jukebox to run as an Http server by ticking this option box (valid network interface must be selected)." + Environment.NewLine + "Kinsky Jukebox would need to remain running during music playback as it would be serving the music to your DS device.", "http://");
            iCollectionHttpLocation.IncludeTestButton();
            Add(iCollectionHttpLocation);

            iUseHttpServer = new OptionBool("usehttpserver", "Use KinskyJukebox as Http Server", "Use Kinsky Jukebox in place of a dedicated http server for your music (valid network interface must be selected, Kinsky Jukebox would need to remain running during music playback as it would be serving the music to your DS device). URL of scan directory is ignored if this setting is enabled.", false);
            Add(iUseHttpServer);

            iCompilationsFolder = new OptionFolderName("compliationsfoldername", "Compilations Folder Name", "Select the folder where your compilation albums are stored. By default any folder name containing 'compilation' or 'various' will be classed as a compilation folder." + Environment.NewLine + "Should reside within your Scan Directory (root directory of your music collection).", "");
            Add(iCompilationsFolder);

            iRandomize = new OptionBool("randomiselargeplaylists", "Randomize Large Playlists", "Randomize playlists larger than " + MediaCollection.kPlaylistMaxTracks + " tracks. Otherwise the first " + MediaCollection.kPlaylistMaxTracks + " tracks only will be used.", true);
            Add(iRandomize);

            // linked options
            iCollectionHttpLocation.Enabled   = !iUseHttpServer.Native;
            EventUseHttpServerChanged        += UseHttpServerChanged;
            iUseHttpServer.Enabled            = (iHelper.Stack.Status.State == EStackState.eOk);
            iHelper.Stack.EventStatusChanged += EventStackStatusChanged; // linked to iUseHttpServer
        }
Exemple #6
0
        public Model(HelperKinsky aHelper)
        {
            aHelper.SetStackExtender(this);
            aHelper.Stack.EventStatusChanged += StatusChanged;

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

            iLocalPlaylists  = new LocalPlaylists(aHelper, true);
            iRemotePlaylists = new RemotePlaylists(aHelper);
            iLibrary         = new MediaProviderLibrary(aHelper);
            iSupport         = new MediaProviderSupport(iHttpServer);

            PluginManager pluginManager = new PluginManager(aHelper, iHttpClient, iSupport);

            iLocator = new ContentDirectoryLocator(pluginManager, this);

            OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);
            OptionBool optionRemotePlaylists = iLocator.Add(RemotePlaylists.kRootId, iRemotePlaylists);

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);

            aHelper.AddOptionPage(iLocator.OptionPage);

            iPlaySupport     = new PlaySupport();
            iSaveSupport     = new SaveSupport(aHelper, iRemotePlaylists, optionRemotePlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);
        }
Exemple #7
0
 public OptionParser()
 {
     iOptions = new List<Option>();
     iPosArgs = new List<string>();
     iHelpOption = new OptionBool("-h", "--help", "show this help message and exit");
     AddOption(iHelpOption);
 }
        public ApplicationOptions(IHelper aHelper)
        {
            iLastBoxSelected = new OptionString("lastboxselected", "Last Box Selected", "Store last device selected by the user", "");
            aHelper.AddOption(iLastBoxSelected);

            iViewDetails = new OptionBool("viewdetails", "View Details", "Show device list in detail rather than by Icons", false);
            aHelper.AddOption(iViewDetails);
        }
        public OptionPageOrganisation()
            : base("Organisation")
        {
            iSortTypeNew = new OptionBool("sortnew", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eNew), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eNew) + " category", true);
            Add(iSortTypeNew);

            iNewMusicCutoffDays = new OptionNumber("newcutoff", "New music cutoff (days)", "Music files created/modified before the specified cutoff will included when scanning by 'New'", 14, 1, 999);
            Add(iNewMusicCutoffDays);

            iSortTypeArtistAlbum = new OptionBool("sortartistalbum", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtistAlbum), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtistAlbum) + " category", true);
            Add(iSortTypeArtistAlbum);

            iSortByYear = new OptionBoolEnum("albumarrangement", "Album Arrangement", "Albums can either be arranged alphabetically or by year (as Year/Album, oldest to newest like a discography)", false, "Arrange Albums by Year", "Arrange Albums Alphabetically");
            Add(iSortByYear);

            iSortTypeArtist = new OptionBool("sortartist", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtist), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtist) + " category", false);
            Add(iSortTypeArtist);

            iIgnoreCompilations = new OptionBoolEnum("groupcompilations", "Group Compilation Artists", "Group compilation artists as 'Various' or retain artist names (only applies when scanning by 'Artist', done automatically when scanning by 'Artist/Album')", false, "Group as 'Various'", "Retain Artist Names");
            Add(iIgnoreCompilations);

            iSortTypeAlbum = new OptionBool("sortalbum", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbum), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbum) + " category", false);
            Add(iSortTypeAlbum);

            iSortTypeGenre = new OptionBool("sortgenre", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eGenre), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eGenre) + " category", false);
            Add(iSortTypeGenre);

            iSortTypeComposer = new OptionBool("sortcomposer", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eComposer), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eComposer) + " category", false);
            Add(iSortTypeComposer);

            iSortTypeConductor = new OptionBool("sortconductor", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eConductor), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eConductor) + " category", false);
            Add(iSortTypeConductor);

            iSortTypeArtistAz = new OptionBool("sortartistaz", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtistAz), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eArtistAz) + " category", false);
            Add(iSortTypeArtistAz);

            iSortTypeTitleAz = new OptionBool("sorttitleaz", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eTitleAz), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eTitleAz) + " category", false);
            Add(iSortTypeTitleAz);

            iSortTypeAlbumArtistAlbum = new OptionBool("sortalbumartistalbum", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbumArtistAlbum), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbumArtistAlbum) + " category", false);
            Add(iSortTypeAlbumArtistAlbum);

            iSortTypeAlbumArtist = new OptionBool("sortalbumartist", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbumArtist), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAlbumArtist) + " category", false);
            Add(iSortTypeAlbumArtist);

            iSortTypeAll = new OptionBool("sortall", "Sort by " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAll), "When sorting your scanned collection, include a " + MediaCollection.SortTypeToString(MediaCollection.SortType.eAll) + " category", false);
            Add(iSortTypeAll);

            iIncludeLocalRadio = new OptionBoolEnum("localradio", "Local Radio", "Creates a group of playlists of local radio stations (provided by TuneIn Radio) if selected", false, "Create Local Radio Playlists", "Ignore");
            Add(iIncludeLocalRadio);

            // linked options
            iNewMusicCutoffDays.Enabled = iSortTypeNew.Native;
            EventSortTypeNewChanged    += SortTypeNewChanged;
            iIgnoreCompilations.Enabled = iSortTypeArtist.Native;
            EventSortTypeArtistChanged += SortTypeArtistChanged;
        }
Exemple #10
0
        public void SetOption(OptionBool aOption)
        {
            if (iOption != null)
            {
                iOption.EventValueChanged -= OptionValueChanged;
            }

            iOption = aOption;
            iOption.EventValueChanged += OptionValueChanged;

            SetState(iOption.Native);
        }
Exemple #11
0
        public void OptionBool_Clone()
        {
            var optionBool = new OptionBool
            {
                Name  = "Durable",
                Value = true
            };

            var cloneOptionBool = optionBool.Clone() as OptionBool;

            Assert.AreEqual(optionBool.Name, cloneOptionBool.Name);
            Assert.AreEqual(optionBool.Value, cloneOptionBool.Value);
        }
Exemple #12
0
        public void OptionBool_Default()
        {
            var optionBool = new OptionBool();

            Assert.IsNull(optionBool.Name);
            optionBool.Name = "Durable";
            Assert.AreEqual("Durable", optionBool.Name);

            Assert.IsFalse(optionBool.Value);
            optionBool.Value = true;
            Assert.IsTrue(optionBool.Value);

            Assert.IsTrue(optionBool.Default);
        }
Exemple #13
0
        public void OptionBool_CompareTo()
        {
            var optionBool = new OptionBool
            {
                Name  = "Durable",
                Value = true
            };

            var expectedValue = optionBool.CompareTo(null);

            Assert.AreEqual(-1, expectedValue);

            expectedValue = optionBool.CompareTo(new object { });
            Assert.AreEqual(-1, expectedValue);

            expectedValue = optionBool.CompareTo(optionBool);
            Assert.AreEqual(0, expectedValue);
        }
Exemple #14
0
        private void ValueChanged(object sender, EventArgs e)
        {
            IContainer root = null;

            iMutex.WaitOne();

            OptionBool option = sender as OptionBool;
            Key        key    = new Key(option.Id);

            if (option.Native)
            {
                if (iDisabledContentDirectories.TryGetValue(key, out root))
                {
                    iDisabledContentDirectories.Remove(key);
                    iEnabledContentDirectories.Add(key, root);
                    root.EventContentAdded   += PluginContentChanged;
                    root.EventContentRemoved += PluginContentChanged;
                    root.EventContentUpdated += PluginContentChanged;
                }
            }
            else
            {
                if (iEnabledContentDirectories.TryGetValue(key, out root))
                {
                    iEnabledContentDirectories.Remove(key);
                    iDisabledContentDirectories.Add(key, root);
                    root.EventContentAdded   -= PluginContentChanged;
                    root.EventContentRemoved -= PluginContentChanged;
                    root.EventContentUpdated -= PluginContentChanged;
                }
            }

            iMutex.ReleaseMutex();

            if (option.Native && root != null && EventContentAdded != null)
            {
                EventContentAdded(this, EventArgs.Empty);
            }

            if (!option.Native && root != null && EventContentRemoved != null)
            {
                EventContentRemoved(this, new EventArgsContentRemoved(root.Metadata.Id));
            }
        }
Exemple #15
0
        public Preferences(Helper aHelper)
        {
            iOptionPagePrivacy = new OptionPagePrivacy(aHelper);
            aHelper.AddOptionPage(iOptionPagePrivacy);

            iOptionReceiverList        = new OptionString("linn.songcaster", "Media player list", "List of media players that have ever been seen", new MediaPlayerConfiguration().Save());
            iOptionSelectedReceiverUdn = new OptionString("songcast.selectedreceiverudn", "Selected Receiver UDN", "The UDN of the currently selected Songcast receiver", string.Empty);
            iOptionSubnetAddress       = new OptionUint("songcaster.subnet", "Subnet", "Subnet to songcast over", 0);
            iOptionMulticast           = new OptionBool("songcast.usemulticast", "Multicast", "Send audio over multicast rather than unicast", false);
            iOptionChannel             = new OptionUint("songcaster.channel", "Channel", "Multcast channel to send audio over", 0);
            iOptionUseMusicLatency     = new OptionBool("songcast.usemusiclatency", "Use Music Latency", "Send audio using the music latency rather than video latency", true);
            iOptionMusicLatencyMs      = new OptionUint("songcast.musiclatencyms", "Music Latency (ms)", "Songcast music latency", kDefaultMusicLatencyMs);
            iOptionVideoLatencyMs      = new OptionUint("songcast.videolatencyms", "Video Latency (ms)", "Songcast video latency", kDefaultVideoLatencyMs);
            iOptionRotaryVolumeControl = new OptionBool("songcast.rotaryvolumecontrol", "Rotary volume control", "Whether to use rotary or rocker volume control", true);

            aHelper.AddOption(iOptionReceiverList);
            aHelper.AddOption(iOptionSelectedReceiverUdn);
            aHelper.AddOption(iOptionSubnetAddress);
            aHelper.AddOption(iOptionMulticast);
            aHelper.AddOption(iOptionChannel);
            aHelper.AddOption(iOptionUseMusicLatency);
            aHelper.AddOption(iOptionMusicLatencyMs);
            aHelper.AddOption(iOptionVideoLatencyMs);
            aHelper.AddOption(iOptionRotaryVolumeControl);

            if (iOptionChannel.Native == 0)
            {
                // channel has not been set - assign a random value
                Random r       = new Random();
                int    byte1   = r.Next(254) + 1; // in range [1,254]
                int    byte2   = r.Next(254) + 1; // in range [1,254]
                int    channel = byte1 << 8 | byte2;
                iOptionChannel.Native = (uint)channel;
            }
            iTrackerAccount = kTrackerAccountDev;
            if (aHelper.BuildType == EBuildType.Release)
            {
                iTrackerAccount = kTrackerAccountRelease;
            }
            else if (aHelper.BuildType == EBuildType.Beta)
            {
                iTrackerAccount = kTrackerAccountBeta;
            }
        }
Exemple #16
0
        public ApplicationOptions(IHelper aHelper)
        {
            iLeftSplitterLocation = new OptionInt("leftsplitter", "Left Splitter Location", "Graphical location in pixels of left splitter", 300);
            aHelper.AddOption(iLeftSplitterLocation);

            iRightSplitterLocation = new OptionInt("rightsplitter", "Right Splitter Location", "Graphical location in pixels of right splitter", 300);
            aHelper.AddOption(iRightSplitterLocation);

            iWindowWidth = new OptionInt("width", "Window Width", "Width of application window in pixels", 900);
            aHelper.AddOption(iWindowWidth);

            iWindowHeight = new OptionInt("height", "Window Height", "Height of application window in pixels", 600);
            aHelper.AddOption(iWindowHeight);

            iWindowMaximised = new OptionBool("maximised", "Window Maximised", "Flag to determine if the application window is maximised", false);
            aHelper.AddOption(iWindowMaximised);

            iWindowMinimised = new OptionBool("minimised", "Window Minimised", "Flag to determine if the application window is minimised", false);
            aHelper.AddOption(iWindowMinimised);

            iPrintPagesPerSheetIndex = new OptionInt("printpagespersheet", "Print Pages Per Sheet Index", "Index value of pages per sheet selection for printing a catalog (last selected by user)", 0);
            aHelper.AddOption(iPrintPagesPerSheetIndex);

            iPrintPageLayout = new OptionEnum("printpagelayout", "Print Page Layout", "Page layout selection for printing a catalog (last selected by user)");
            iPrintPageLayout.AddDefault(kPotraitTrackDetails);
            iPrintPageLayout.Add(kLandscapeTrackDetails);
            iPrintPageLayout.Add(kPotrait);
            iPrintPageLayout.Add(kLandscape);
            aHelper.AddOption(iPrintPageLayout);

            iPrintOrderBooklet = new OptionBool("printorderbooklet", "Print Order Booklet", "Booklet order selection for printing a catalog (last selected by user)", false);
            aHelper.AddOption(iPrintOrderBooklet);

            iPrintDocumentType = new OptionEnum("printdoctype", "Print Document Type", "Document type selection for printing a catalog (last selected by user)");
            iPrintDocumentType.AddDefault(kPdf);
            iPrintDocumentType.Add(kRtf);
            aHelper.AddOption(iPrintDocumentType);

            iPrintSections = new OptionListString("printsections", "Print Sections", "User selected sections to print when creating a catalog", new List <string>()
            {
                kToc
            });
            aHelper.AddOption(iPrintSections);
        }
        public void SetupForTest()
        {
            var optionBool  = new OptionBool();
            var optionsList = new List <IOption> {
                optionBool
            };

            var mockServer = new Mock <IServer>();

            var mockResourceRepository = new Mock <IResourceRepository>();

            mockResourceRepository.Setup(resourceRepository => resourceRepository.FindOptionsBy(mockServer.Object, "")).Returns(optionsList);

            mockServer.Setup(server => server.ResourceRepository).Returns(mockResourceRepository.Object);

            var mockShellViewModel = new Mock <IShellViewModel>();

            mockShellViewModel.Setup(shellViewModel => shellViewModel.ActiveServer).Returns(mockServer.Object);

            CustomContainer.Register(mockShellViewModel.Object);
        }
Exemple #18
0
        public OptionPageGeneral(string aName)
            : base(aName)
        {
            iOptionShowTechnicalInfo = new OptionBool("trackinfo", "Extended track info",
                                                      "Show extended track information for the current track",
                                                      true);
            Add(iOptionShowTechnicalInfo);

            iOptionShowToolTips = new OptionBool("tooltips", "Show tooltips",
                                                 "Show tooltips for the application",
                                                 true);
            Add(iOptionShowToolTips);

            iOptionEnableRocker = new OptionBool("rocker", "Enable rocker controls",
                                                 "Enable rocker controls for controlling volume and seeking",
                                                 false);
            Add(iOptionEnableRocker);

            iOptionPlaylistGrouping = new OptionBool("groupplaylist", "Group playlist items by album",
                                                     "Allow grouping of items within the playlist window",
                                                     true);
            Add(iOptionPlaylistGrouping);
        }
Exemple #19
0
        public OptionPageGeneral()
            : base("General")
        {
            bool isUnix = (Environment.OSVersion.Platform == PlatformID.Unix);

            iTransparency = new OptionBool("windowtransparency", "Window transparency", "Enable transparency in the application", !isUnix);
            Add(iTransparency);

            iWindowBorder = new OptionBool("windowborder", "Window border", "Show the main window border", isUnix);
            Add(iWindowBorder);

            iHideMouseCursor = new OptionBool("hidemouse", "Hide mouse cursor", "Hide the mouse cursor", false);
            Add(iHideMouseCursor);

            iShowTrackInfo = new OptionBool("trackinfo", "Show technical track information", "Show technical information about the currently playing track", true);
            Add(iShowTrackInfo);

            iUseRotaryControls = new OptionBool("rotarycontrols", "Use rotary controls for volume and seeking", "Use rotary controls for volume and seeking", true);
            Add(iUseRotaryControls);

            iShowToolTips = new OptionBool("tooltips", "Show Tool Tips", "Enable tool tips for the application", true);
            Add(iShowToolTips);
        }
Exemple #20
0
        public SaveSupport(HelperKinsky aHelper, SharedPlaylists aSharedPlaylists, OptionBool aOptionSharedPlaylists, LocalPlaylists aLocalPlaylists, OptionBool aOptionLocalPlaylists)
        {
            iInvoker = aHelper.Invoker;

            iOptionSaveLocation = new OptionString("savelocation", "Save Location", "Location to save playlists to", "Local Playlists");
            aHelper.AddOption(iOptionSaveLocation);

            iOptionSaveLocation.EventValueChanged += SaveLocationChanged;

            iSharedPlaylists = aSharedPlaylists;
            iSharedPlaylists.EventContentAdded   += PlaylistsChanged;
            iSharedPlaylists.EventContentRemoved += PlaylistsChanged;
            iSharedPlaylists.EventContentUpdated += PlaylistsChanged;

            iOptionSharedPlaylists = aOptionSharedPlaylists;
            iOptionSharedPlaylists.EventValueChanged += PlaylistsChanged;

            iLocalPlaylists       = aLocalPlaylists;
            iOptionLocalPlaylists = aOptionLocalPlaylists;

            iOptionLocalPlaylists.EventValueChanged += PlaylistsChanged;

            PlaylistsChanged(this, EventArgs.Empty);
        }
Exemple #21
0
        public Preferences(Helper aHelper)
        {
            iOptionPagePrivacy = new OptionPagePrivacy(aHelper);
            aHelper.AddOptionPage(iOptionPagePrivacy);

            iOptionFirmwareBeta       = new OptionBool("konfig.firmwarebeta", "Participate in firmware beta programme", "Include beta firmware when checking for available updates", false);
            iOptionNetwork            = new OptionUint("konfig.network", "Network", "Network to use", 0);
            iOptionSelectedProductUdn = new OptionString("konfig.selectedproductudn", "Selected product UDN", "UDN of the product to automatically select for configuration", string.Empty);
            iOptionSendDsCrashData    = new OptionBool("konfig.senddscrashdata", "Send DS crash data to Linn", "Automatically send DS crash data to Linn", false);

            aHelper.AddOption(iOptionFirmwareBeta);
            aHelper.AddOption(iOptionNetwork);
            aHelper.AddOption(iOptionSelectedProductUdn);
            aHelper.AddOption(iOptionSendDsCrashData);
            iTrackerAccount = kTrackerAccountDev;
            if (aHelper.BuildType == EBuildType.Release)
            {
                iTrackerAccount = kTrackerAccountRelease;
            }
            else if (aHelper.BuildType == EBuildType.Beta)
            {
                iTrackerAccount = kTrackerAccountBeta;
            }
        }
        public OptionPageGeneral(string aName)
            : base(aName)
        {
            iOptionExtendedTrackInfo = new OptionBool("trackinfo", "Extended track info", "Show extended track information for the current track", true);
            Add(iOptionExtendedTrackInfo);

            iOptionEnableRocker = new OptionBool("rocker", "Button controls", "Enable button controls for controlling volume and seeking", false);
            Add(iOptionEnableRocker);

            iOptionEnableLargeControls = new OptionBool("largecontrols", "Large controls", "Enable large controls for controlling volume and seeking", false);
            //Add(iOptionEnableLargeControls);

            iOptionGroupTracks = new OptionBool("groupplaylist", "Group playlist tracks", "Grouping tracks by album within the playlist window", true);
            Add(iOptionGroupTracks);

            iOptionAutoLock = new OptionEnum("autolock", "Prevent auto-lock", "When to prevent auto-lock");
            iOptionAutoLock.AddDefault("Never");
            iOptionAutoLock.Add("When charging");
            iOptionAutoLock.Add("Always");
            Add(iOptionAutoLock);

            iOptionAutoSendCrashLog = new OptionBool("autosendcrashlog", "Auto send crash log", "Automatically send crash logs to Linn", false);
            Add(iOptionAutoSendCrashLog);
        }
Exemple #23
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Ticker tick = new Ticker();

            helper.Helper.SetStackExtender(this);
            helper.Helper.Stack.EventStatusChanged += StatusChanged;

            ArtworkCacheInstance.Instance = new ArtworkCache();

            controlRotaryVolume.ViewBar.FontSize          = 15.0f;
            controlRotaryVolume.ViewBar.InnerCircleRadius = 30.0f;
            controlRotaryVolume.ViewBar.OuterCircleRadius = 35.0f;
            iViewWidgetVolumeControl = new ViewWidgetVolumeControl(controlRotaryVolume);

            iViewWidgetVolumeButtons = new ViewWidgetVolumeButtons("VolumeButtons", null);
            iViewWidgetVolumeButtons.RepeatInterval = 0.1f;

            iViewWidgetVolumeRotary = new ViewWidgetVolumeRotary("VolumeRotary", null);

            iVolumeController = new VolumeControllerIpad(iViewWidgetVolumeButtons, iViewWidgetVolumeRotary, controlVolume);
            iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
            viewController.SetVolumeController(iVolumeController);

            controlRotaryTime.ViewBar.FontSize          = 15.0f;
            controlRotaryTime.ViewBar.InnerCircleRadius = 30.0f;
            controlRotaryTime.ViewBar.OuterCircleRadius = 35.0f;
            iViewWidgetTime = new ViewWidgetTime(controlRotaryTime, viewHourGlass);

            iViewWidgetTimeButtons = new ViewWidgetTimeButtons("TimeButtons", null, iViewWidgetTime);
            iViewWidgetTimeButtons.RepeatInterval = 0.1f;

            iViewWidgetTimeRotary = new ViewWidgetTimeRotary("TimeRotary", null, iViewWidgetTime);

            iTimeController = new TimeControllerIpad(iViewWidgetTimeButtons, iViewWidgetTimeRotary, controlTime);
            iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            viewController.SetTimeController(iTimeController);

            controlVolume.Hidden = false;
            controlTime.Hidden   = false;

            helper.OptionEnableRocker.EventValueChanged += delegate(object sender, EventArgs e) {
                iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
                iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            };

            Reachability.LocalWifiConnectionStatus();
            Reachability.ReachabilityChanged += delegate(object sender, EventArgs e) {
                helper.Helper.Interface.NetworkChanged();
            };

            new Action(delegate {
                Ticker ticker = new Ticker();

                iViewMaster = new ViewMaster();

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

                iLibrary         = new MediaProviderLibrary(helper.Helper);
                iSharedPlaylists = new SharedPlaylists(helper.Helper);
                iLocalPlaylists  = new LocalPlaylists(helper.Helper, false);
                iLocalPlaylists.SaveDirectory.ResetToDefault();

                iConfigController = new ConfigControllerIpad(helper.Helper);
                iPlaySupport      = new PlaySupport();

                MediaProviderSupport support = new MediaProviderSupport(iHttpServer);
                PluginManager pluginManager  = new PluginManager(helper.Helper, iHttpClient, support);

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

                iSaveSupport     = new SaveSupport(helper.Helper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
                iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);

                helper.Helper.AddOptionPage(iLocator.OptionPage);

                InvokeOnMainThread(delegate {
                    AddViews();
                });

                iModel    = new Model(iViewMaster, iPlaySupport);
                iMediator = new Mediator(helper.Helper, iModel);

                OnFinishedLaunching();

                UserLog.WriteLine(string.Format("FinishedLaunching background tasks in {0} ms", ticker.MilliSeconds));
            }).BeginInvoke(null, null);

            Trace.Level = Trace.kKinskyTouch;

            // If you have defined a view, add it here:
            navigationController.View.Frame = new RectangleF(PointF.Empty, viewBrowser.Frame.Size);
            viewBrowser.InsertSubview(navigationController.View, 0);

            /*ArtworkTileViewFactory f = new ArtworkTileViewFactory(iLibrary);
             * NSBundle.MainBundle.LoadNib("ArtworkTileView", f, null);
             * viewController.View.AddSubview(f.View);
             * f.Initialise();*/

            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            UserLog.WriteLine(string.Format("FinishedLaunching in {0} ms", tick.MilliSeconds));

            return(true);
        }
Exemple #24
0
        private void KompactModeChanged(object sender, EventArgs e)
        {
            OptionBool kompactMode = ModelMain.Instance.Helper.KompactMode;

            MenuItemKompactMode.State = kompactMode.Native ? NSCellStateValue.NSOnState : NSCellStateValue.NSOffState;
        }
Exemple #25
0
        private static IOption PropertyToOption(object instance, PropertyInfo prop, IOptionConvertParameter topLevelInstance)
        {
            var helptextAttr = prop.GetCustomAttributes().Where(o => o is HelpTextAttribute).Cast <HelpTextAttribute>().FirstOrDefault();
            var tooltipAttr  = prop.GetCustomAttributes().Where(o => o is TooltipAttribute).Cast <TooltipAttribute>().FirstOrDefault();

            if (prop.PropertyType.IsAssignableFrom(typeof(string)))
            {
                var attr   = prop.GetCustomAttributes().Where(o => o is DataProviderAttribute).Cast <DataProviderAttribute>().FirstOrDefault();
                var result = new OptionAutocomplete()
                {
                    Name  = prop.Name,
                    Value = (string)prop.GetValue(instance)
                };
                if (attr != null)
                {
                    result.Suggestions = ((IOptionDataList)attr.Get()).Options;
                }
                if (helptextAttr != null)
                {
                    result.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    result.Tooltip = tooltipAttr.Get();
                }
                result.PropertyChanged += (o, e) => { prop.SetValue(instance, ((OptionAutocomplete)o).Value); topLevelInstance?.Notify(); };

                return(result);
            }
            else if (prop.PropertyType.IsAssignableFrom(typeof(int)))
            {
                var optionInt = new OptionInt
                {
                    Name  = prop.Name,
                    Value = (int)prop.GetValue(instance)
                };
                if (helptextAttr != null)
                {
                    optionInt.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    optionInt.Tooltip = tooltipAttr.Get();
                }

                optionInt.PropertyChanged += (o, e) => { prop.SetValue(instance, ((OptionInt)o).Value); topLevelInstance?.Notify(); };
                return(optionInt);
            }
            else if (prop.PropertyType.IsAssignableFrom(typeof(IWorkflow)))
            {
                var workflow       = (IWorkflow)prop.GetValue(instance);
                var optionWorkflow = new OptionWorkflow
                {
                    Name     = prop.Name,
                    Workflow = new WorkflowWithInputs {
                        Name = workflow.Name, Value = workflow.Value, Inputs = workflow.Inputs
                    },
                };
                if (helptextAttr != null)
                {
                    optionWorkflow.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    optionWorkflow.Tooltip = tooltipAttr.Get();
                }
                optionWorkflow.PropertyChanged += (o, e) =>
                {
                    if (e.PropertyName == nameof(OptionWorkflow.Workflow))
                    {
                        prop.SetValue(instance, ((OptionWorkflow)o).Workflow);
                    }
                    topLevelInstance?.Notify();
                };
                return(optionWorkflow);
            }
            else if (prop.PropertyType.IsAssignableFrom(typeof(bool)))
            {
                var optionBool = new OptionBool
                {
                    Name  = prop.Name,
                    Value = (bool)prop.GetValue(instance),
                };
                if (helptextAttr != null)
                {
                    optionBool.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    optionBool.Tooltip = tooltipAttr.Get();
                }
                optionBool.PropertyChanged += (o, e) => { prop.SetValue(instance, ((OptionBool)o).Value); topLevelInstance?.Notify(); };

                return(optionBool);
            }
            else if (prop.PropertyType.IsEnum)
            {
                var values = new List <KeyValuePair <string, int> >();
                foreach (var option in Enum.GetValues(prop.PropertyType))
                {
                    var key = Enum.GetName(prop.PropertyType, option);
                    values.Add(new KeyValuePair <string, int>(key, (int)option));
                }

                var result = new OptionEnum
                {
                    Values = values,
                    Name   = prop.Name,
                    Value  = (int)prop.GetValue(instance),
                };
                if (helptextAttr != null)
                {
                    result.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    result.Tooltip = tooltipAttr.Get();
                }
                result.PropertyChanged += (o, e) => { prop.SetValue(instance, ((OptionEnum)o).Value); topLevelInstance?.Notify(); };

                return(result);
            }
            else
            {
                var attrs            = prop.GetCustomAttributes();
                var optionTypeUXAttr = attrs.Where(o => o is OptionUXAttribute).Cast <OptionUXAttribute>().FirstOrDefault();
                var fieldValueAttr   = attrs.Where(o => o is DataValueAttribute).Cast <DataValueAttribute>().FirstOrDefault();
                var dataProviderAttr = attrs.Where(o => o is MultiDataProviderAttribute).Cast <MultiDataProviderAttribute>().FirstOrDefault();

                if (fieldValueAttr == null)
                {
                    throw new Exception("FieldValueAttribute required");
                }
                var fieldValueName = fieldValueAttr.Get();

                var propertyValue = prop.GetValue(instance);
                var types         = prop.PropertyType.GetProperties();
                var fieldNameProp = types.First(type => type.Name == fieldValueName);
                if (fieldNameProp == null)
                {
                    throw new Exception("property does not exist");
                }
                if (!fieldNameProp.PropertyType.IsEnum)
                {
                    throw new Exception("currently only enums supported");
                }
                if (propertyValue is null)
                {
                    throw NullException;
                }

                IOptionMultiData returnVal;
                var enumValue = fieldNameProp.GetValue(propertyValue);

                Orientation?orientation = null;
                if (optionTypeUXAttr?.Get() == typeof(OptionRadioButtons))
                {
                    var orientationAttr = attrs.Where(o => o is OrientationAttribute).Cast <OrientationAttribute>().FirstOrDefault();
                    if (orientationAttr != null)
                    {
                        orientation = orientationAttr.Get();
                    }
                    returnVal = new OptionRadioButtons
                    {
                        Name  = prop.Name,
                        Value = Enum.GetName(fieldNameProp.PropertyType, enumValue),
                    };
                }
                else
                { // optionTypeUXAttr is OptionCombobox
                    returnVal = new OptionCombobox
                    {
                        Name  = prop.Name,
                        Value = Enum.GetName(fieldNameProp.PropertyType, enumValue),
                    };
                }
                if (helptextAttr != null)
                {
                    returnVal.HelpText = helptextAttr.Get();
                }
                if (tooltipAttr != null)
                {
                    returnVal.Tooltip = tooltipAttr.Get();
                }

                var optionCount = 0;
                if (dataProviderAttr != null)
                {
                    var optionTypes = dataProviderAttr.Get();
                    foreach (var optionType in optionTypes)
                    {
                        object value = propertyValue != null && propertyValue.GetType() == optionType.GetType() ? propertyValue : optionType;

                        var type = optionType.GetType();
                        returnVal.Options[type.Name] = OptionConvertor.Convert(value, topLevelInstance).Where(o => o.Name != fieldValueName);
                    }
                    optionCount = optionTypes.Length;
                }
                if (returnVal is OptionRadioButtons optionRadioButton)
                {
                    var calcOrientation = optionCount == 2 ? Orientation.Horizontal : Orientation.Vertical;
                    optionRadioButton.Orientation = orientation ?? calcOrientation;

                    returnVal.PropertyChanged += (o, e) => { prop.SetValue(instance, ExtractValueFromOptionMultiData(instance, prop, (OptionRadioButtons)o)); topLevelInstance?.Notify(); };
                }
                else
                {
                    returnVal.PropertyChanged += (o, e) => { prop.SetValue(instance, ExtractValueFromOptionMultiData(instance, prop, (OptionCombobox)o)); topLevelInstance?.Notify(); };
                }
                return(returnVal);
            }
            throw UnhandledException;
        }
Exemple #26
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;
        }
Exemple #27
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            CreateNotificationView();
            Xamarin.Insights.Identify(Helper.OptionInstallId.Value, null);
            ObjCRuntime.Class.ThrowOnInitFailure = false;

            Ticker tick = new Ticker();

            helper.Helper.SetStackExtender(this);
            helper.Helper.Stack.EventStatusChanged += StatusChanged;

            viewControllerRooms.StandbyButtonOffsetX = 5;

            ArtworkCacheInstance.Instance = new ArtworkCache();

            controlRotaryVolume.ViewBar.FontSize          = 12.0f;
            controlRotaryVolume.ViewBar.InnerCircleRadius = 25.0f;
            controlRotaryVolume.ViewBar.OuterCircleRadius = 30.0f;
            iViewWidgetVolumeControl = new ViewWidgetVolumeControl(controlRotaryVolume);

            iViewWidgetVolumeRotary = new ViewWidgetVolumeRotary("VolumeRotary", null);

            iViewWidgetVolumeButtons = new ViewWidgetVolumeButtons("VolumeButtons", null);
            iViewWidgetVolumeButtons.RepeatInterval = 0.1f;

            iVolumeController = new VolumeControllerIphone(viewControllerNowPlaying, iViewWidgetVolumeRotary, iViewWidgetVolumeButtons, controlVolume, controlTime, scrollView);
            iVolumeController.SetRockers(helper.OptionEnableRocker.Native);

            controlRotaryTime.ViewBar.FontSize          = 12.0f;
            controlRotaryTime.ViewBar.InnerCircleRadius = 25.0f;
            controlRotaryTime.ViewBar.OuterCircleRadius = 30.0f;
            iViewWidgetTime = new ViewWidgetTime(controlRotaryTime, viewHourGlass);

            iViewWidgetTimeRotary = new ViewWidgetTimeRotary("TimeRotary", null, iViewWidgetTime);

            iViewWidgetTimeButtons = new ViewWidgetTimeButtons("TimeButtons", null, iViewWidgetTime);
            iViewWidgetTimeButtons.RepeatInterval = 0.1f;

            iTimeController = new TimeControllerIphone(viewControllerNowPlaying, iViewWidgetTimeRotary, iViewWidgetTimeButtons, controlTime, controlVolume, scrollView);
            iTimeController.SetRockers(helper.OptionEnableRocker.Native);

            helper.OptionEnableRocker.EventValueChanged += delegate(object sender, EventArgs e) {
                iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
                iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            };

            Reachability.LocalWifiConnectionStatus();
            Reachability.ReachabilityChanged += delegate(object sender, EventArgs e) {
                OnReachabilityChanged();
            };

            new Action(delegate {
                Ticker ticker = new Ticker();

                iViewMaster = new ViewMaster();

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

                iLibrary         = new MediaProviderLibrary(helper.Helper);
                iSharedPlaylists = new SharedPlaylists(helper.Helper);
                iLocalPlaylists  = new LocalPlaylists(helper.Helper, false);
                iLocalPlaylists.SaveDirectory.ResetToDefault();

                iPlaySupport = new PlaySupport();
                MediaProviderSupport support = new MediaProviderSupport(iHttpServer);
                PluginManager pluginManager  = new PluginManager(helper.Helper, iHttpClient, support);

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

                iSaveSupport     = new SaveSupport(helper.Helper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
                iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);

                helper.Helper.AddOptionPage(iLocator.OptionPage);

                InvokeOnMainThread(delegate {
                    AddViews();
                });

                iModel    = new Model(iViewMaster, iPlaySupport);
                iMediator = new Mediator(helper.Helper, iModel);

                OnFinishedLaunching();

                UserLog.WriteLine(string.Format("FinishedLaunching background tasks in {0} ms", ticker.MilliSeconds));
            }).BeginInvoke(null, null);

            //Trace.Level = Trace.kKinskyTouch;

            // If you have defined a view, add it here:
            navigationController.View.Frame = new CGRect(CGPoint.Empty, viewBrowser.Frame.Size);
            viewBrowser.InsertSubview(navigationController.View, 0);

            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            UserLog.WriteLine(string.Format("FinishedLaunching in {0} ms", tick.MilliSeconds));

            return(true);
        }
Exemple #28
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));
        }
Exemple #29
0
        public HelperKinskyDesktop(string[] aArgs, Rect aScreenRect, IInvoker aInvoker)
            : base(aArgs, aInvoker)
        {
            float goldenRatio  = 0.6180339887f;
            float windowWidth  = aScreenRect.Width * goldenRatio;
            float windowHeight = windowWidth * goldenRatio;

            iOptionPageGeneral = new OptionPageGeneral("General");
            AddOptionPage(iOptionPageGeneral);

            iOptionWindowX = new OptionFloat("windowx", "WindowX", "Main window's x position", aScreenRect.Origin.X + (aScreenRect.Width - windowWidth) * 0.5f);
            AddOption(iOptionWindowX);

            iOptionWindowY = new OptionFloat("windowy", "WindowY", "Main window's y position", aScreenRect.Origin.Y + (aScreenRect.Height - windowHeight) * 0.5f);
            AddOption(iOptionWindowY);

            iOptionWindowWidth = new OptionFloat("windowwidth", "WindowWidth", "Main window's width", windowWidth);
            AddOption(iOptionWindowWidth);

            iOptionWindowHeight = new OptionFloat("windowheight", "WindowHeight", "Main window's height", windowHeight);
            AddOption(iOptionWindowHeight);

            iOptionSplitterFraction = new OptionFloat("splitterfraction", "SplitterFraction", "Splitter position in range [0, 1]", goldenRatio);
            AddOption(iOptionSplitterFraction);

            iOptionFullscreen = new OptionBool("fullscreen", "Fullscreen", "Fullscreen mode", false);
            AddOption(iOptionFullscreen);

            iOptionKompactMode = new OptionBool("kompactmode", "KompactMode", "Kompact mode", false);
            AddOption(iOptionKompactMode);

            iOptionContainerView = new OptionUint("containerview", "ContainerView", "Container View", 0);
            AddOption(iOptionContainerView);

            iOptionContainerSizeThumbs = new OptionFloat("containersizethumbs", "ContainerSizeThumbs", "Image size for browser thumbnail view", 0.3f);
            AddOption(iOptionContainerSizeThumbs);

            iOptionContainerSizeList = new OptionFloat("containersizelist", "ContainerSizeList", "Image size for browser list view", 0.3f);
            AddOption(iOptionContainerSizeList);

            iOptionPageUpdates = new OptionPageUpdates(this);
            AddOptionPage(iOptionPageUpdates);

            // check for valid window coordinates - reset to defaults if:
            // - the window width is greater than 1.5 times the screen width OR
            // - the window height is greater than 1.5 times the screen height OR
            // - the window rect does not intersect the screen rect
            if (iOptionWindowWidth.Native > 1.5f * aScreenRect.Width ||
                iOptionWindowHeight.Native > 1.5f * aScreenRect.Height ||
                !aScreenRect.Intersects(new Rect(iOptionWindowX.Native, iOptionWindowY.Native, iOptionWindowWidth.Native, iOptionWindowHeight.Native)))
            {
                iOptionWindowX.ResetToDefault();
                iOptionWindowY.ResetToDefault();
                iOptionWindowWidth.ResetToDefault();
                iOptionWindowHeight.ResetToDefault();
            }

            // check validity of other options
            if (iOptionSplitterFraction.Native < 0.0f || iOptionSplitterFraction.Native > 1.0f)
            {
                iOptionSplitterFraction.ResetToDefault();
            }
            if (iOptionContainerSizeThumbs.Native < 0.0f || iOptionContainerSizeThumbs.Native > 1.0f)
            {
                iOptionContainerSizeThumbs.ResetToDefault();
            }
            if (iOptionContainerSizeList.Native < 0.0f || iOptionContainerSizeList.Native > 1.0f)
            {
                iOptionContainerSizeList.ResetToDefault();
            }
        }
Exemple #30
0
        private OptionBool Add(Key aKey, IContainer aRoot)
        {
            OptionBool option = null;

            try
            {
                iMutex.WaitOne();

                int index = 0;
                for (int i = 0; i < iOptionPage.Options.Count; ++i, ++index)
                {
                    if (iOptionPage.Options[i].Name.CompareTo(aKey.Id) > 0)
                    {
                        break;
                    }
                }

                // This code can be removed once there is a decent way to install and uninstall plugins
                if (aKey.Id != "Library")
                {
                    bool state = true;
                    if (aKey.Id == "Movie Trailers" || aKey.Id == "Shoutcast" || aKey.Id == "WFMU")
                    {
                        state = false;
                    }

                    option = new OptionBool(aKey.Id, aKey.Id, "Enable or disable " + aKey.Id + " plugin", state);
                    option.EventValueChanged += ValueChanged;
                    iOptionPage.Insert(index, option);

                    if (option.Native)
                    {
                        iEnabledContentDirectories.Add(aKey, aRoot);
                        aRoot.EventContentAdded   += PluginContentChanged;
                        aRoot.EventContentRemoved += PluginContentChanged;
                        aRoot.EventContentUpdated += PluginContentChanged;
                    }
                    else
                    {
                        iDisabledContentDirectories.Add(aKey, aRoot);
                    }
                }
                else
                {
                    iEnabledContentDirectories.Add(aKey, aRoot);
                    aRoot.EventContentAdded   += PluginContentChanged;
                    aRoot.EventContentRemoved += PluginContentChanged;
                    aRoot.EventContentUpdated += PluginContentChanged;
                }
            }
            finally
            {
                iMutex.ReleaseMutex();
            }

            if (option != null && option.Native && EventContentAdded != null)
            {
                EventContentAdded(this, EventArgs.Empty);
            }

            return(option);
        }
Exemple #31
0
        internal void InitialiseStack()
        {
            OptionPage generalOptionsPage = new OptionPage("General");

            iHideCursorOption = new OptionBool("hidecursor", "Hide Cursor", "Hide Cursor", false);
            generalOptionsPage.Add(iHideCursorOption);
            iRotaryControlsOption = new OptionBool("rotarycontrol", "Use rotary controls", "Use rotary controls", true);
            generalOptionsPage.Add(iRotaryControlsOption);
            iShowToolTipsOption = new OptionBool("tooltips", "Show tooltips", "Show tooltips", true);
            generalOptionsPage.Add(iShowToolTipsOption);
            iShowExtendedTrackInfoOption = new OptionBool("trackinfo", "Extended track info", "Show extended track information", true);
            generalOptionsPage.Add(iShowExtendedTrackInfoOption);
            iGroupPlaylistOption = new OptionBool("groupplaylist", "Group playlist items by album", "Allows grouping of items within the playlist window", false);
            generalOptionsPage.Add(iGroupPlaylistOption);
            iTransparentOption = new OptionBool("customwindow", "Transparent window (requires restart)", "Toggles custom window", true);
            generalOptionsPage.Add(iTransparentOption);
            iSoftwareRenderingOption = new OptionBool("softwarerendering", "Force software rendering (requires restart)", "Disables hardware rendering for troublesome display cards", false);
            generalOptionsPage.Add(iSoftwareRenderingOption);
            iHelper.AddOptionPage(generalOptionsPage);

            iOptionPageUpdates = new OptionPageUpdates(iHelper);
            iHelper.AddOptionPage(iOptionPageUpdates);



            OptionPage fontsOptionPage = new OptionPage("Fonts");

            iFontsOption = new OptionEnum("fontsize", "Font size", "Font size");
            iFontsOption.AddDefault(kFontOptionNormal);
            iFontsOption.Add(kFontOptionLarge);
            fontsOptionPage.Add(iFontsOption);

            iHideCursorOption.EventValueChanged            += OnOptionChanged;
            iRotaryControlsOption.EventValueChanged        += OnOptionChanged;
            iShowToolTipsOption.EventValueChanged          += OnOptionChanged;
            iShowExtendedTrackInfoOption.EventValueChanged += OnOptionChanged;
            iFontsOption.EventValueChanged              += OnOptionChanged;
            iTransparentOption.EventValueChanged        += OnOptionChanged;
            iOptionPageUpdates.EventBetaVersionsChanged += OnUpdatesChanged;
            iOptionPageUpdates.EventAutoUpdateChanged   += OnUpdatesChanged;

            iHelper.AddOptionPage(fontsOptionPage);

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

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

            iSupport = new MediaProviderSupport(iHttpServer);

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

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

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
            iHelper.AddOptionPage(iLocator.OptionPage);

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

            iHelper.ProcessOptionsFileAndCommandLine();
            SetUpdateTypes();
        }