コード例 #1
0
        public static string ToFriendlyName(this LibraryType libraryType)
        {
            string baseName = libraryType.ToString();

            // Walk through the string and find all of the capital characters
            List <int> capitalIndexes = new List <int>();

            for (int i = 0; i < baseName.Length; ++i)
            {
                if (char.IsUpper(baseName[i]))
                {
                    capitalIndexes.Add(i);
                }
            }

            string scoredName = baseName;

            foreach (int capitalIndex in capitalIndexes)
            {
                if (capitalIndex > 0)
                {
                    scoredName = baseName.Insert(capitalIndex, "_");
                }
            }

            return(scoredName.ToLower());
        }
コード例 #2
0
        public Library AddLibrary(string name, LibraryType type)
        {
            var r = new Library(name, type);

            targets_.Add(r);
            return(r);
        }
コード例 #3
0
        public static async Task <Library> Create(LibraryType libraryType)
        {
            var result = new Library(libraryType);
            await result.Load();

            return(result);
        }
コード例 #4
0
        public IActionResult Get(LibraryType type, string field, string[] libraryIds)
        {
            var filters = _filterService.GetFilterValues(type, field, libraryIds);
            var convert = _mapper.Map <FilterValuesViewModel>(filters);

            return(Ok(convert));
        }
コード例 #5
0
        public List <LibraryGroupInfo> GetAll(LibraryType type)
        {
            //var list = await _repository.GetAllAsync(Q
            //    .Where(Attr.Type, type.GetValue())
            //    .OrderByDesc(nameof(LibraryGroup.Id))
            //    .CachingGet(CacheKey(type))
            //);
            //return list.ToList();

            var list = new List <LibraryGroupInfo>();

            var sqlString = $@"SELECT {nameof(LibraryGroupInfo.Id)}, 
                {Attr.Type}, 
                {nameof(LibraryGroupInfo.GroupName)}
            FROM {TableName} ORDER BY {nameof(LibraryGroupInfo.Id)}";

            using (var rdr = ExecuteReader(sqlString))
            {
                while (rdr.Read())
                {
                    list.Add(GetLibraryGroupInfo(rdr));
                }
                rdr.Close();
            }

            return(list);
        }
コード例 #6
0
        public int[] GetPlaylistIds(LibraryType type)
        {
            //Console.WriteLine ("I am in GetPlaylistIds");
            long primary_source_id = 0;

            switch (type)
            {
            case LibraryType.Music:
                primary_source_id = ServiceManager.SourceManager.MusicLibrary.DbId;
                break;

            case LibraryType.Video:
                primary_source_id = ServiceManager.SourceManager.VideoLibrary.DbId;
                break;
            }

            int array_size = ServiceManager.DbConnection.Query <int> (
                "SELECT COUNT(*) FROM CorePlaylists WHERE PrimarySourceID = ?", primary_source_id
                );

            IEnumerable <int> ids = ServiceManager.DbConnection.QueryEnumerable <int> (
                "SELECT PlaylistID FROM CorePlaylists WHERE PrimarySourceID = ?", primary_source_id
                );

            int[] playlist_ids = new int[array_size];
            int   index        = 0;

            foreach (int id in ids)
            {
                playlist_ids[index++] = id;
            }

            return(playlist_ids);
        }
コード例 #7
0
ファイル: LockFileLookup.cs プロジェクト: johnbeisner/remote1
        public LockFileLookup(LockFile lockFile)
        {
            _packages = new Dictionary <KeyValuePair <string, NuGetVersion>, LockFileLibrary>(PackageCacheKeyComparer.Instance);
            _projects = new Dictionary <string, LockFileLibrary>(StringComparer.OrdinalIgnoreCase);

            foreach (var library in lockFile.Libraries)
            {
                // TODO-ARM: Workaround for JIT bug on arm processors. See https://github.com/dotnet/coreclr/issues/10780
                if (string.Empty == null)
                {
                    throw new Exception();
                }

                var libraryType = LibraryType.Parse(library.Type);

                if (libraryType == LibraryType.Package)
                {
                    _packages[new KeyValuePair <string, NuGetVersion>(library.Name, library.Version)] = library;
                }
                if (libraryType == LibraryType.Project)
                {
                    _projects[library.Name] = library;
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Gets all exports required by the project, of the specified <see cref="LibraryType"/>, NOT including the project itself
 /// </summary>
 /// <returns></returns>
 public IEnumerable <LibraryExport> GetDependencies(LibraryType type)
 {
     // Export all but the main project
     return(ExportLibraries(library =>
                            library != _rootProject &&
                            LibraryIsOfType(type, library)));
 }
コード例 #9
0
 public SendToConfirm(LibraryType AddType, LibraryType ToType)
 {
     InitializeComponent();
     DialogResult            = 2;
     this.labelControl1.Text = "Create a new " + ToType.ToString().ToLower() + " or add " + AddType.ToString().ToLower() + " to existing " + ToType.ToString().ToLower() + ".";
     this.Text = "Create New " + ToType.ToString();
 }
コード例 #10
0
ファイル: LibraryExporter.cs プロジェクト: krwq/cli-1
 /// <summary>
 /// Gets all exports required by the project, of the specified <see cref="LibraryType"/>, NOT including the project itself
 /// </summary>
 /// <returns></returns>
 public IEnumerable<LibraryExport> GetDependencies(LibraryType type)
 {
     // Export all but the main project
     return ExportLibraries(library =>
         library != _rootProject &&
         LibraryIsOfType(type, library));
 }
コード例 #11
0
        public static FileLibraryItem Create(LibraryType type, string path)
        {
            if (!string.IsNullOrEmpty(path) || File.Exists(path))
            {
                return(null);
            }

            FileLibraryItem item = null;

            if (type == LibraryType.Image)
            {
                item = new ImageInfo();
            }
            else if (type == LibraryType.Video)
            {
                item = new VideoInfo();
            }
            else
            {
                return(null);
            }

            item.Path = path;

            return(item);
        }
コード例 #12
0
        public async Task <bool> NewLibraryAsync(LibraryType libraryType)
        {
            try
            {
                App.HideNavigation();

                // ENGINE
                var engine  = Engines.Engine.Get(libraryType);
                var library = await engine.NewLibrary();

                if (library == null)
                {
                    return(false);
                }

                // ADD LIBRARY
                library.ID = Guid.NewGuid().ToString();
                if (!await this.AddLibraryAsync(library))
                {
                    return(false);
                }

                // STORE LIBRARY
                this.SaveLibrary(library);
                this.SaveLibraries();

                // LIBRARY SERVICE
                using (var services = new Services.LibraryService(library))
                { await services.InitializeLibrary(); }
                Services.LibraryService.RefreshLibrary(library);

                return(true);
            }
            catch (Exception ex) { Helpers.AppCenter.TrackEvent(ex); return(false); }
        }
コード例 #13
0
 public static int GetImageIndex(LibraryType type)
 {
     if (_lib2ImageIndex.ContainsKey(type))
     {
         return(_lib2ImageIndex[type]);
     }
     return(0);
 }
コード例 #14
0
 public static NodeType GetNodeType(LibraryType type)
 {
     if (_lib2Node.ContainsKey(type))
     {
         return(_lib2Node[type]);
     }
     return(NodeType.None);
 }
コード例 #15
0
        public async Task <LibraryType> Add(LibraryType libraryType)
        {
            await _context.AddAsync(libraryType);

            await _context.SaveChangesAsync();

            throw new NotImplementedException();
        }
コード例 #16
0
        public static async Task <LibraryFolder> CreateAsync(string Path, LibraryType Type)
        {
            StorageFolder PinFolder = await StorageFolder.GetFolderFromPathAsync(Path);

            BitmapImage Thumbnail = await PinFolder.GetThumbnailBitmapAsync(ThumbnailMode.SingleItem);

            return(new LibraryFolder(PinFolder, Thumbnail, Type));
        }
コード例 #17
0
        public static async Task <SteamAppNewsCommand> Create(Library library, LibraryType libraryType)
        {
            var result = new SteamAppNewsCommand(library, libraryType);

            result._steamNewsClient = await SteamNewsClient.Create();

            return(result);
        }
コード例 #18
0
ファイル: SQLite.cs プロジェクト: codecopy/RX-Explorer
 /// <summary>
 /// 保存在文件夹和库区域显示的文件夹路径
 /// </summary>
 /// <param name="Path">文件夹路径</param>
 /// <returns></returns>
 public async Task SetLibraryPathAsync(string Path, LibraryType Type)
 {
     using (SqliteCommand Command = new SqliteCommand("Insert Or Ignore Into Library Values (@Path,@Type)", Connection))
     {
         Command.Parameters.AddWithValue("@Path", Path);
         Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
         await Command.ExecuteNonQueryAsync().ConfigureAwait(false);
     }
 }
コード例 #19
0
 public void UpdateLibrary(string NewPath, LibraryType Type)
 {
     using (SqliteCommand Command = new SqliteCommand("Update Library Set Path=@NewPath Where Type=@Type", Connection))
     {
         Command.Parameters.AddWithValue("@NewPath", NewPath);
         Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
         Command.ExecuteNonQuery();
     }
 }
コード例 #20
0
 /// <summary>
 /// 保存在文件夹和库区域显示的文件夹路径
 /// </summary>
 /// <param name="Path">文件夹路径</param>
 /// <returns></returns>
 public void SetLibraryPath(string Path, LibraryType Type)
 {
     using (SqliteCommand Command = new SqliteCommand("Insert Or Ignore Into Library Values (@Path,@Type)", Connection))
     {
         Command.Parameters.AddWithValue("@Path", Path);
         Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
         Command.ExecuteNonQuery();
     }
 }
コード例 #21
0
        public async Task <LibraryType> Edit(LibraryType libraryType)
        {
            _context.Update(libraryType);
            await _context.SaveChangesAsync();

            return(libraryType);

            throw new NotImplementedException();
        }
コード例 #22
0
 public LibraryPropertys(MemoryLibraryItem Target)
 {
     if (Target != null)
     {
         this._Type   = Target.Type;
         this._Name   = Target.Name;
         this._Length = Target.Length;
     }
 }
コード例 #23
0
ファイル: SQLite.cs プロジェクト: codecopy/RX-Explorer
 public async Task UpdateLibraryAsync(string NewPath, LibraryType Type)
 {
     using (SqliteCommand Command = new SqliteCommand("Update Library Set Path=@NewPath Where Type=@Type", Connection))
     {
         Command.Parameters.AddWithValue("@NewPath", NewPath);
         Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
         await Command.ExecuteNonQueryAsync().ConfigureAwait(false);
     }
 }
コード例 #24
0
        public FilterValues CalculateFilterValues(LibraryType type, string field, string[] libraryIds)
        {
            switch (type)
            {
            case LibraryType.Movies: return(CalculateMovieFilterValues(field, libraryIds));

            //TODO Add show filters here
            default: return(null);
            }
        }
コード例 #25
0
        /// <summary>
        /// Returns the item or null if the id does not exist or does not match the type.
        /// </summary>
        public GraphItem <RemoteResolveResult> GetItemById(string id, LibraryType libraryType)
        {
            if (_lookup.TryGetValue(id, out var node) &&
                node.Key.Type == libraryType)
            {
                return(node);
            }

            return(null);
        }
コード例 #26
0
ファイル: SQLite.cs プロジェクト: githubassets/RX-Explorer
 public async Task UpdateLibraryAsync(string NewPath, LibraryType Type)
 {
     using (SQLConnection Connection = await ConnectionPool.GetConnectionFromDataBasePoolAsync().ConfigureAwait(false))
         using (SqliteCommand Command = Connection.CreateDbCommandFromConnection <SqliteCommand>("Update Library Set Path=@NewPath Where Type=@Type"))
         {
             _ = Command.Parameters.AddWithValue("@NewPath", NewPath);
             _ = Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
             _ = await Command.ExecuteNonQueryAsync().ConfigureAwait(false);
         }
 }
コード例 #27
0
ファイル: SQLite.cs プロジェクト: githubassets/RX-Explorer
 /// <summary>
 /// 保存在文件夹和库区域显示的文件夹路径
 /// </summary>
 /// <param name="Path">文件夹路径</param>
 /// <returns></returns>
 public async Task SetLibraryPathAsync(string Path, LibraryType Type)
 {
     using (SQLConnection Connection = await ConnectionPool.GetConnectionFromDataBasePoolAsync().ConfigureAwait(false))
         using (SqliteCommand Command = Connection.CreateDbCommandFromConnection <SqliteCommand>("Insert Or Ignore Into Library Values (@Path,@Type)"))
         {
             _ = Command.Parameters.AddWithValue("@Path", Path);
             _ = Command.Parameters.AddWithValue("@Type", Enum.GetName(typeof(LibraryType), Type));
             _ = await Command.ExecuteNonQueryAsync().ConfigureAwait(false);
         }
 }
コード例 #28
0
 public LibraryCommandStructure(Library library, LibraryType libraryType, DiscordClient discordClient, BotCommand runCommand)
 {
     _botCommands = new List <BotCommand>
     {
         new AddCommand(library, libraryType),
         new RemoveCommand(library, libraryType),
         runCommand,
         new ShowAllCommand(library, libraryType, discordClient)
     };
 }
コード例 #29
0
        public void OpenPDF(LibraryType DocumentType, string MediaURL, string FileName, int NavigationRoot = 0, Action<bool> completed = null)
        {
            PSPDFKitGlobal.Initialize (Forms.Context, MainActivity.LicenseKey);

            const string permission = Manifest.Permission.WriteExternalStorage;
            if (ContextCompat.CheckSelfPermission(Forms.Context, permission) == (int)Permission.Granted)
            {
                var docUri = ExtractAsset (Forms.Context, "LAN-1433-BEN.pdf");
                ShowPdfDocument (docUri,"");
            }
        }
コード例 #30
0
        public void Delete(LibraryType type, int groupId)
        {
            if (groupId <= 0)
            {
                return;
            }

            var sqlString = $"DELETE FROM {TableName} WHERE {nameof(LibraryGroupInfo.Id)} = {groupId}";

            ExecuteNonQuery(sqlString);
        }
コード例 #31
0
ファイル: Slot.cs プロジェクト: KwestDev/TestTask
 void Start()
 {
     if (transform.parent.gameObject.name.Equals("LinksLibrary"))
     {
         _LibraryType = LibraryType.LinkLibrary;
     }
     else
     {
         _LibraryType = LibraryType.ChainLibrary;
     }
 }
コード例 #32
0
        public MetadataProvider(DBusActivity activity, LibraryType type) : base()
        {
            lock (class_lock) {
                instance_count++;
                myindex = instance_count;
            }

            //this.myservice = service;
            this.activity = activity;
            this.Id       = (int)type;
        }
コード例 #33
0
        public MetadataProvider(DBusActivity activity, LibraryType type)
            : base()
        {
            lock (class_lock) {
                instance_count++;
                myindex = instance_count;
            }

            //this.myservice = service;
            this.activity = activity;
            this.Id = (int) type;
        }
コード例 #34
0
ファイル: LibraryRepository.cs プロジェクト: djeebus/MusicHub
        public LibraryInfo Create(string userId, LibraryType type, string path, string username, string password)
        {
            var guid = Guid.Parse(userId);

            var dbLibrary = new DbLibrary
            {
                Id = Guid.NewGuid(),
                Path = path,
                Username = username,
                Password = password,
                Type = type,
                UserId = guid,
            };

            this._db.Libraries.Add(dbLibrary);
            this._db.SaveChanges();

            return dbLibrary.ToModel();
        }
コード例 #35
0
 public void PlayVideo(LibraryType DocumentType, string MediaURL, Action<bool> completed = null)
 {
     var videoPlayer = new VideoViewController (MediaURL);
     UIWindow window = UIApplication.SharedApplication.KeyWindow;
     if (DocumentType == LibraryType.MyDocuments) {
         var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [1];
         var navcontroller = rootController as UINavigationController;
         if (navcontroller != null) {
             videoPlayer.HidesBottomBarWhenPushed = true;
             navcontroller.PushViewController (videoPlayer, true);
         }
     } else {
         var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [3];
         var navcontroller = rootController as UINavigationController;
         if (navcontroller != null) {
             videoPlayer.HidesBottomBarWhenPushed = true;
             navcontroller.PushViewController (videoPlayer, true);
         }
     }
 }
コード例 #36
0
        private bool TablatureLibraryItemVisible(LibraryType selectedLibrary, TablatureLibraryItem<TablatureFile> item)
        {
            var libraryMatch =
                selectedLibrary == LibraryType.Playlist ||
                selectedLibrary == LibraryType.AllTabs ||
                (selectedLibrary == LibraryType.MyTabs && item.File.SourceType == TablatureSourceType.UserCreated) ||
                (selectedLibrary == LibraryType.MyDownloads && item.File.SourceType == TablatureSourceType.Download) ||
                (selectedLibrary == LibraryType.MyImports && item.File.SourceType == TablatureSourceType.FileImport) ||
                (selectedLibrary == LibraryType.MyFavorites && item.Favorited) ||
                (selectedLibrary == LibraryType.TabType && sidemenu.SelectedNode.Tag.ToString() == item.File.Type.ToString());

            var searchValue = txtLibraryFilter.Text;

            if (libraryMatch)
            {
                return searchValue == null || (item.File.Artist.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 ||
                                               item.File.Title.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 ||
                                               item.FileInfo.FullName.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 ||
                                               (item.File.Comment != null && item.File.Comment.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0) ||
                                               item.File.Contents.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0);
            }

            return false;
        }
コード例 #37
0
        public DetailsPopup(ProductCatalog item, LibraryType type)
        {
            this.BackgroundImage = ImageConstants.backgroundImage;
            var thumb = new Image {
                WidthRequest = 150,
                HeightRequest = 200,
                Source = GetSource (item.ThumbPath),
                BackgroundColor = ColorConstants.SemiOpaqueBackground

            };

            downloadlabel =
                new Label {
                Text = item.DownloadDate == null ? "" : string.Format ("{0}", ((DateTime)item.DownloadDate).ToString ("d")),
                FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                TextColor = Color.White,
            };

            var publishedlabel = new StackLayout {
                HorizontalOptions = LayoutOptions.Start,
                //Padding = 20,
                Orientation = StackOrientation.Vertical,
                Children = {
                    new CustomLabel {
                        Text = "Publication Date:",
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Italic,
                    },
                    new CustomLabel {
                        Text = item.PublicationDate == null ? "" : string.Format ("{0}", ((DateTime)item.PublicationDate).ToString ("d")),
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Bold,
                    },
                }
            };

            var namelabel = new StackLayout {
                HorizontalOptions = LayoutOptions.Start,
                //Padding = 20,
                Orientation = StackOrientation.Vertical,
                Children = {
                    new CustomLabel {
                        Text = "File Name:",
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Italic,
                    },
                    new CustomLabel {
                        Text = item.FileName,
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Bold,
                    },
                }
            };

            var description = new StackLayout {
                HorizontalOptions = LayoutOptions.Start,
                //Padding = 20,
                Orientation = StackOrientation.Vertical,
                Children = {
                    new CustomLabel {
                        Text = "Description:",
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Italic,
                    },
                    new CustomLabel {
                        Text = item.Description,
                        FontSize = (Device.Idiom == TargetIdiom.Phone)
                            ? Device.GetNamedSize (NamedSize.Small, typeof(Label))
                            : Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                        TextColor = Color.White,
                        FontAttributes = FontAttributes.Bold,
                    },
                }
            };

            //Read Online Button
            var readOnline = new Button () {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                BackgroundColor = Color.FromHex ("#006699"),
                TextColor = Color.White,
                HeightRequest = 40,
                WidthRequest = 140,
            };

            var download = new Button () {

                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                BackgroundColor = Color.FromHex ("#006699"),
                TextColor = Color.White,
                HeightRequest = 40,
                WidthRequest = 140,
            };

            if (item.DownloadDate == null) {
                if (item.MimeType.StartsWith ("mp4")) {
                    readOnline.Text = Translation.Localize ("PlayOnlineText");
                } else {
                    readOnline.Text = Translation.Localize ("ReadOnlineText");
                }
                download.Text = Translation.Localize ("DownloadText");
            } else {
                if (item.MimeType.StartsWith ("mp4")) {
                    readOnline.Text = Translation.Localize ("PlayOfflineText");
                } else {
                    readOnline.Text = Translation.Localize ("ReadOfflineText");
                }
                download.Text = Translation.Localize ("DeleteText");
            }

            readOnline.Clicked += (sender, e) => {

                var btn = ((Button)sender);

                var pdfService = DependencyService.Get<IPdfService> ();
                if (pdfService == null)
                    return;

                if (item.MimeType.StartsWith ("mp4")) {
                    var page = (Page)Activator.CreateInstance (typeof(VideoView), item);
                    this.ParentView.Navigation.PushAsync (page, true);
                } else {

                    pdfService.OpenPDF (type, item.FilePath, item.FileName, 0, null);
                }

            };

            download.Clicked += async (sender, e) => {

                var currentitem = db.GetCatalogsByID (item.Id);

                if (currentitem.DownloadDate == null) {

                    if (GlobalVariables.WifiDownloadOnly) {
                        if (!App.IsWifiReachable ()) {
                            await this.DisplayAlert ("", GlobalVariables.WifiConnectionOnlyAlert, "Ok");
                            return;
                        }
                    }

                    var textToDisplay =
                        currentitem.MimeType.StartsWith ("mp4")
                        ? Translation.Localize ("DownloadVideoMessage")
                        : Translation.Localize ("DownloadDocumentMessage");

                    var confirm = await this.DisplayAlert ("", textToDisplay, Translation.Localize ("Yes"), Translation.Localize ("No"));

                    if (confirm) {

                        var pdfService = DependencyService.Get<IDownloadService> ();
                        if (pdfService == null)
                            return;

                        pdfService.DownloadData (currentitem, (string filePath) => {
                            if (filePath != "") {

                                currentitem.FilePath = filePath;
                                currentitem.ThumbPath = filePath.Replace (".pdf", ".jpeg").Replace (".mp4", ".jpeg");
                                db.InsertDownloadItem (currentitem);
                                if (currentitem.MimeType.StartsWith ("mp4"))
                                    readOnline.Text = Translation.Localize ("PlayOfflineText");
                                else
                                    readOnline.Text = Translation.Localize ("ReadOfflineText");
                                //
                                download.Text = Translation.Localize ("DeleteText");

                                downloadlabel.Text = DateTime.Now.ToString ("d");
                            }
                        });
                    }
                } else {

                    var textToDisplay =
                        currentitem.MimeType.StartsWith ("mp4")
                        ? Translation.Localize ("DeleteVideoMessage")
                        : Translation.Localize ("DeleteDocumentMessage");

                    var confirm = await this.DisplayAlert ("", textToDisplay, Translation.Localize ("Yes"), Translation.Localize ("No"));

                    if (confirm) {

                        var deleteService = DependencyService.Get<IDeleteService> ();
                        if (deleteService == null)
                            return;

                        deleteService.DeleteFile (currentitem.FilePath, (bool completed) => {
                            if (completed == true) {
                                db.DeleteDownloadItem (currentitem.Id);
                                if (item.MimeType.StartsWith ("mp4"))
                                    readOnline.Text = Translation.Localize ("PlayOnlineText");
                                else
                                    readOnline.Text = Translation.Localize ("ReadOnlineText");

                                download.Text = Translation.Localize ("DownloadText");

                                downloadlabel.Text = "";
                            }
                        });
                    }
                }

            };

            var leftheader = new StackLayout {
                HorizontalOptions = LayoutOptions.Start,
                Orientation = StackOrientation.Vertical,
                Children = {
                    thumb,
                    downloadlabel,
                }
            };

            var rightheader = new StackLayout {
                HorizontalOptions = LayoutOptions.Center,
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness (0, 10, 0, 20),
                Children = {
                    //publicationlabel,
                    readOnline,
                    download
                }
            };

            var headerView = new StackLayout {
                Padding = 10,
                HorizontalOptions = LayoutOptions.Start,
                Orientation = StackOrientation.Horizontal,
                Children = {
                    leftheader,
                    rightheader,
                }
            };

            var detailsView = new StackLayout {
                Padding = 10,
                HorizontalOptions = LayoutOptions.Start,
                Orientation = StackOrientation.Vertical,
                Children = {
                    publishedlabel, namelabel, description
                }
            };

            scrollView = new ScrollView ();
            scrollView.Content = new StackLayout {
                BackgroundColor = Color.FromRgba (255, 255, 255, 0.1),
                Padding = 0,
                Children = { headerView, detailsView }
            };

            Content = scrollView;
        }
コード例 #38
0
ファイル: ProjectContextBuilder.cs プロジェクト: pdelvo/cli
 public LibraryKey(string name, LibraryType libraryType)
 {
     Name = name;
     LibraryType = libraryType;
 }
コード例 #39
0
ファイル: Library.cs プロジェクト: nielsvh/BoggleClone
 public TimeSpan BuildLibrary(LibraryType type)
 {
     this.currentType = type;
     Stopwatch stopwatch = Stopwatch.StartNew();
     switch (type)
     {
         case LibraryType.TREE:
             BuildTreeLibrary();
             break;
         case LibraryType.HASH_TABLE:
             BuildHashLibrary();
             break;
         case LibraryType.ARRAY:
             BuildArrayLibrary();
             break;
     }
     stopwatch.Stop();
     return stopwatch.Elapsed;
 }
コード例 #40
0
        public ObjectPath CreateMetadataProvider (LibraryType type)
        {
            if (activity == null || !permission_granted) {
                return new ObjectPath ("");
            }

            MetadataProvider provider = new MetadataProvider (activity, type);
            activity.RegisterDBusObject (provider, provider.ObjectPath);
            return new ObjectPath (provider.ObjectPath);
            //return ServiceManager.DBusServiceManager.RegisterObject (new MetadataProvider (this, type));
        }
コード例 #41
0
        public int[] GetPlaylistIds (LibraryType type)
        {
            //Console.WriteLine ("I am in GetPlaylistIds");
            int primary_source_id = 0;

            switch (type) {
                case LibraryType.Music:
                    primary_source_id = ServiceManager.SourceManager.MusicLibrary.DbId;
                    break;
                case LibraryType.Video:
                    primary_source_id = ServiceManager.SourceManager.VideoLibrary.DbId;
                    break;
            }

            int array_size = ServiceManager.DbConnection.Query<int> (
                "SELECT COUNT(*) FROM CorePlaylists WHERE PrimarySourceID = ?", primary_source_id
            );

            IEnumerable <int> ids = ServiceManager.DbConnection.QueryEnumerable <int> (
                "SELECT PlaylistID FROM CorePlaylists WHERE PrimarySourceID = ?", primary_source_id
            );

            int[] playlist_ids = new int[array_size];
            int index = 0;
            foreach (int id in ids) {
                playlist_ids[index++] = id;
            }

            return playlist_ids;

        }
コード例 #42
0
ファイル: FileSystemLibrary.cs プロジェクト: Veggie13/Genesis
 public ILibrary Export(LibraryType type, IEnumerable<string> names)
 {
     throw new NotImplementedException();
 }
コード例 #43
0
        public void OpenPDF(LibraryType DocumentType, string MediaURL, string FileName, int NavigationRoot = 0, Action<bool> completed = null)
        {
            UIWindow window = UIApplication.SharedApplication.KeyWindow;

            var uid = MediaURL.Substring (MediaURL.LastIndexOf ("/") + 1, MediaURL.Length - 1 - MediaURL.LastIndexOf ("/")).Replace (".pdf", "") + FileName;
            if (DocumentType == LibraryType.NewsLetter) {
                PSPDFDocument document;
                if (!MediaURL.StartsWith ("http")) {
                    var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
                    var directoryname = Path.Combine (documents, "Downloads");
                    MediaURL = Path.Combine (directoryname, MediaURL);
                    document = new PSPDFDocument (NSUrl.FromFilename (new Uri (MediaURL).ToString ()));
                } else {
                    document = new PSPDFDocument (NSUrl.FromString (MediaURL));
                }
                document.Uid = uid;
                var pdfViewer = new ViewerPageController (document);
                var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [2];
                var navcontroller = rootController as UINavigationController;
                if (navcontroller != null) {
                    pdfViewer.HidesBottomBarWhenPushed = true;
                    navcontroller.PushViewController (pdfViewer, true);
                }
            } else if (DocumentType == LibraryType.MyDocuments) {
                var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
                var directoryname = Path.Combine (documents, "Downloads");
                var path = Path.Combine (directoryname, MediaURL);
                var document = new PSPDFDocument (NSUrl.FromFilename (new Uri (path).ToString ()));
                document.Uid = uid;
                var pdfViewer = new ViewerPageController (document);
                var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [3];
                var navcontroller = rootController as UINavigationController;
                if (navcontroller != null) {
                    pdfViewer.HidesBottomBarWhenPushed = true;
                    navcontroller.PushViewController (pdfViewer, true);
                }
            } else if (DocumentType == LibraryType.Search) {
                PSPDFDocument document;
                if (!MediaURL.StartsWith ("http")) {
                    var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
                    var directoryname = Path.Combine (documents, "Downloads");
                    MediaURL = Path.Combine (directoryname, MediaURL);
                    document = new PSPDFDocument (NSUrl.FromFilename (new Uri (MediaURL).ToString ()));
                } else {
                    document = new PSPDFDocument (NSUrl.FromString (MediaURL));
                }
                document.Uid = uid;
                var pdfViewer = new ViewerPageController (document);
                var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [NavigationRoot];
                var navcontroller = rootController as UINavigationController;
                if (navcontroller != null) {
                    pdfViewer.HidesBottomBarWhenPushed = true;
                    navcontroller.PushViewController (pdfViewer, true);
                }
            } else {
                PSPDFDocument document;
                if (!MediaURL.StartsWith ("http")) {
                    var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
                    var directoryname = Path.Combine (documents, "Downloads");
                    MediaURL = Path.Combine (directoryname, MediaURL);
                    document = new PSPDFDocument (NSUrl.FromFilename (new Uri (MediaURL).ToString ()));
                } else {
                    document = new PSPDFDocument (NSUrl.FromString (MediaURL));
                }
                document.Uid = uid;
                var pdfViewer = new ViewerPageController (document);
                var rootController = window.RootViewController.ChildViewControllers [0].ChildViewControllers [1];
                var navcontroller = rootController as UINavigationController;
                if (navcontroller != null) {
                    pdfViewer.HidesBottomBarWhenPushed = true;
                    navcontroller.PushViewController (pdfViewer, true);
                }
            }
        }
コード例 #44
0
        public SearchView(LibraryType type)
        {
            //this.BackgroundImage = ImageConstants.backgroundImage;
            BindingContext = new SearchViewModel ();
            categoryType = type;

            var searchBar = new SearchBar ();
            searchBar.SearchButtonPressed += OnSearchBarButtonPressed;
            searchBar.TextChanged += (sender, e) => {
                //var changedSearchBar = (SearchBar)sender;
                if (e.NewTextValue == null) {
                    //this only happens when user taps "Cancel" on iOS
                    ViewModel.LoadItemsCommand.Execute (null);
                    searchlistView.ItemsSource = ViewModel.SearchItems;
                    searchlistView.IsVisible = true;
                    resultlistView.IsVisible = false;
                }
            };

            searchlistView = new ListView () {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate (typeof(SearchItemTemplate)),
                SeparatorColor = Color.Transparent,
                BackgroundColor = Color.Transparent,
            };

            resultlistView = new ListView () {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate (typeof(ResultsItemTemplate)),
                //SeparatorColor = Color.Transparent,
                BackgroundColor = Color.Transparent,
            };

            searchlistView.ItemTapped += (sender, e) => {
                var search = (Search)e.Item;
                ViewModel.SearchText = search.SearchText;

                if(categoryType != LibraryType.MyDocuments){
                    ViewModel.LoadResultsCommand.Execute (null);
                    resultlistView.ItemsSource = ViewModel.Files;
                }
                else{
                    ViewModel.LoadDownloadedSearchResultsCommand.Execute (null);
                    resultlistView.ItemsSource = ViewModel.DownloadedFiles;
                }

                searchlistView.IsVisible = false;
                resultlistView.IsVisible = true;
            };

            resultlistView.ItemTapped += (sender, e) => {
                if(categoryType == LibraryType.MyDocuments){
                    var fileItem = (Downloads)e.Item;
                    var page = new DocumentDetails (fileItem);
                    this.Navigation.PushAsync (page,true);
                }
                else{
                    var fileItem = (ProductCatalog)e.Item;
                    var page = new DetailsPopup (fileItem,type);
                    this.Navigation.PushAsync (page,true);
                }
            };

            Content = new PopupLayout {
                //VerticalOptions = LayoutOptions.Center,
                Content = new StackLayout {
                    //BackgroundColor = Color.Black,
                    Children = { searchBar, searchlistView, resultlistView }
                }
            };

            resultlistView.IsVisible = false;
            Title = Translation.Localize("SearchLabel");
        }
コード例 #45
0
ファイル: LibraryExporter.cs プロジェクト: krwq/cli-1
 private static bool LibraryIsOfType(LibraryType type, LibraryDescription library)
 {
     return type.Equals(LibraryType.Unspecified) || // No type filter was requested
            library.Identity.Type.Equals(type);     // OR, library type matches requested type
 }
コード例 #46
0
ファイル: DefaultJukebox.cs プロジェクト: djeebus/MusicHub
        public void CreateLibrary(string userId, LibraryType libraryType, string path, string username, string password)
        {
            var info = _libraryRepository.Create(userId, libraryType, path, username, password);

            _spider.QueueLibrary(info);
        }