Example #1
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case REMOVE_PLAYLIST_ITEMS:
                return(this.RemovePlaylistItems());

            case CROP_PLAYLIST_ITEMS:
                return(this.CropPlaylistItems());

            case LOCATE_PLAYLIST_ITEMS:
                return(this.LocatePlaylistItems());

#if NET40
                //ListView grouping is too slow under net40 due to lack of virtualization.
#else
            case TOGGLE_GROUPING:
                this.Grouping.Toggle();
                this.Configuration.Save();
                break;
#endif
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #2
0
        public async Task InvokeAsync(IInvocationComponent component)
        {
            var id = default(int);

            if (!int.TryParse(component.Id, out id))
            {
                return;
            }
            var column = this.PlaylistBrowser.GetColumns().FirstOrDefault(
                _column => _column.Id == id
                );

            if (column == null)
            {
                return;
            }
            column.Enabled = !column.Enabled;
            using (var database = this.DatabaseFactory.Create())
            {
                using (var transaction = database.BeginTransaction(database.PreferredIsolationLevel))
                {
                    var set = database.Set <PlaylistColumn>(transaction);
                    await set.AddOrUpdateAsync(column).ConfigureAwait(false);

                    transaction.Commit();
                }
            }
            await this.SignalEmitter.Send(new Signal(this, CommonSignals.PlaylistColumnsUpdated, new[] { column })).ConfigureAwait(false);
        }
        public Task InvokeAsync(IInvocationComponent component)
        {
            if (string.Equals(component.Id, SETTINGS, StringComparison.OrdinalIgnoreCase))
            {
                return(Windows.ShowDialog <PlaylistSettingsDialog>(this.Core, Strings.General_Settings));
            }
            var id = default(int);

            if (!int.TryParse(component.Id, out id))
            {
#if NET40
                return(TaskEx.FromResult(false));
#else
                return(Task.CompletedTask);
#endif
            }
            var column = this.PlaylistBrowser.GetColumns().FirstOrDefault(
                _column => _column.Id == id
                );
            if (column != null)
            {
                column.Enabled = !column.Enabled;
                this.Update(column, true);
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #4
0
 public MenuItem(IInvocableComponent component, IInvocationComponent invocation)
     : this()
 {
     this.Component  = component;
     this.Invocation = invocation;
     this.Invocation.AttributesChanged += this.OnAttributesChanged;
 }
Example #5
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case LOOKUP_TAGS:
                switch (component.Category)
                {
                case InvocationComponent.CATEGORY_LIBRARY:
                    return(this.FetchTagsLibrary());

                case InvocationComponent.CATEGORY_PLAYLIST:
                    return(this.FetchTagsPlaylist());
                }
                break;

            case LOOKUP_ARTWORK:
                switch (component.Category)
                {
                case InvocationComponent.CATEGORY_LIBRARY:
                    return(this.FetchArtworkLibrary());

                case InvocationComponent.CATEGORY_PLAYLIST:
                    return(this.FetchArtworkPlaylist());
                }
                break;
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #6
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case TOPMOST:
                this.Topmost.Toggle();
                this.Configuration.Save();
                break;

            case SHOW_ARTWORK:
                this.ShowArtwork.Toggle();
                this.Configuration.Save();
                break;

            case SHOW_PLAYLIST:
                this.ShowPlaylist.Toggle();
                this.Configuration.Save();
                break;

            case QUIT:
                return(Windows.Shutdown());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #7
0
        public virtual Task InvokeAsync(IInvocationComponent component)
        {
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #8
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            this.Bars.Value = this.Bars.Options.FirstOrDefault(option => string.Equals(option.Id, component.Id));
#if NET40
            return(TaskEx.Run(() => this.Configuration.Save()));
#else
            return(Task.Run(() => this.Configuration.Save()));
#endif
        }
Example #9
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            this.Mode.Value = this.Mode.Options.FirstOrDefault(option => string.Equals(option.Id, component.Id));
            this.Configuration.Save();
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
 public Task InvokeAsync(IInvocationComponent component)
 {
     switch (component.Id)
     {
     case TOGGLE_GROUPING:
         this.Grouping.Toggle();
         this.Configuration.Save();
         break;
     }
     return(Task.CompletedTask);
 }
Example #11
0
        protected virtual MenuItem GetItem(IList <MenuItem> items, IInvocationComponent invocation, string[] path)
        {
            var item = default(MenuItem);

            foreach (var segment in path)
            {
                item  = this.GetItem(items, invocation, segment);
                items = item.Children;
            }
            return(item);
        }
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case OPEN_ARCHIVE:
                return(this.OpenArchive());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #13
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case DESIGN:
                return(Windows.Invoke(() => this.IsDesigning = !this.IsDesigning));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #14
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            if (string.Equals(component.Id, this.ShowCounters.Id, StringComparison.OrdinalIgnoreCase))
            {
                this.ShowCounters.Toggle();
                this.Configuration.Save();
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #15
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case REFRESH_IMAGES:
                return(this.RefreshImages());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #16
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case ENCODE:
                return(this.Encode());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #17
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case CLEAR_PLAYLIST:
                return(this.Clear(this.SelectedPlaylist));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case EDIT_METADATA:
                return(this.SignalEmitter.Send(new Signal(this, CommonSignals.PluginInvocation, component)));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #19
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case TOGGLE_SORTING:
                this.Sorting.Toggle();
                this.Configuration.Save();
                break;
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #20
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case SET_LIBRARY_RATING:
                return(this.SetLibraryRating(component.Name));

            case SET_PLAYLIST_RATING:
                return(this.SetPlaylistRating(component.Name));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case NEW:
                return(this.New());

            case MANAGE:
                return(this.Manage());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #22
0
        public virtual Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case CLEAR:
                return(this.Clear());

            case EXIT:
                return(this.Exit());
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #23
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case SETTINGS:
                if (BassAsioDevice.IsInitialized && BassAsioDevice.Info != null)
                {
                    BassAsioDevice.Info.ControlPanel();
                }
                break;
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #24
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case QUIT:
                return(Windows.Invoke(() =>
                {
                    this.Disable();
                    this.OnClose(this, EventArgs.Empty);
                }));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #25
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case OPEN_CD:
                var drive = CdUtils.GetDrive(component.Name);
                if (drive == CdUtils.NO_DRIVE)
                {
                    break;
                }
                return(this.OpenCd(drive));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #26
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case PlaylistBehaviourConfiguration.ORDER_DEFAULT_OPTION:
            case PlaylistBehaviourConfiguration.ORDER_SHUFFLE_TRACKS:
            case PlaylistBehaviourConfiguration.ORDER_SHUFFLE_ALBUMS:
            case PlaylistBehaviourConfiguration.ORDER_SHUFFLE_ARTISTS:
                this.Order.Value = this.Order.GetOption(component.Id);
                this.Configuration.Save();
                break;
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #27
0
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case SHUFFLE:
                this.Shuffle.Toggle();
#if NET40
                return(TaskEx.Run(() => this.Configuration.Save()));
#else
                return(Task.Run(() => this.Configuration.Save()));
#endif
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }
Example #28
0
        public override Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case FREEZE_LEFT:
                return(Windows.Invoke(() => this.SplitterDirection = Enum.GetName(typeof(Dock), Dock.Left)));

            case FREEZE_RIGHT:
                return(Windows.Invoke(() => this.SplitterDirection = Enum.GetName(typeof(Dock), Dock.Right)));

            case COLLAPSE_LEFT:
                return(Windows.Invoke(() => this.CollapseLeft = !this.CollapseLeft));

            case COLLAPSE_RIGHT:
                return(Windows.Invoke(() => this.CollapseRight = !this.CollapseRight));
            }
            return(base.InvokeAsync(component));
        }
Example #29
0
        public override Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case FREEZE_TOP:
                return(Windows.Invoke(() => this.SplitterDirection = Enum.GetName(typeof(Dock), Dock.Top)));

            case FREEZE_BOTTOM:
                return(Windows.Invoke(() => this.SplitterDirection = Enum.GetName(typeof(Dock), Dock.Bottom)));

            case COLLAPSE_TOP:
                return(Windows.Invoke(() => this.CollapseTop = !this.CollapseTop));

            case COLLAPSE_BOTTOM:
                return(Windows.Invoke(() => this.CollapseBottom = !this.CollapseBottom));
            }
            return(base.InvokeAsync(component));
        }
        public Task InvokeAsync(IInvocationComponent component)
        {
            switch (component.Id)
            {
            case APPEND_PLAYLIST:
                return(this.AddToPlaylist(false));

            case REPLACE_PLAYLIST:
                return(this.AddToPlaylist(true));

            case SET_RATING:
                return(this.SetRating(component.Name));
            }
#if NET40
            return(TaskEx.FromResult(false));
#else
            return(Task.CompletedTask);
#endif
        }