public List<IResource> GetResources(int folderId) { IResource libraryItem1 = new LibraryItem { Name = "Library item 1", Description = "Library item 1 description" }; IResource libraryItem2 = new LibraryItem { Name = "Library item 2", Description = "Library item 2 description" }; IResource libraryItem3 = new LibraryItem { Name = "Library item 3", Description = "Library item 3 description" }; IResource libraryItem4 = new LibraryItem { Name = "Library item 4", Description = "Library item 4 description" }; // Just return a List of simple concepts for now return new List<IResource> { libraryItem1, libraryItem2, libraryItem3, libraryItem4 }; }
private void ResultsForm_Load(object sender, EventArgs e) { LibraryItem testShow = new LibraryItem(); string bar = "______________________________________________"; testShow.itemName = "Harry Potter and the Balance of Earth"; testShow.ISBN = "9-999-999-9-999"; testShow.isElectronic = false; testShow.author = "Al Gore"; testShow.publisher = "Penguin"; testShow.publishDate = "2013"; string result = ""; result = result + "Name: " + testShow.itemName + "\n" + bar + "\n" + "ISBN: "+ testShow.ISBN + "\n" + "Is Electroinc? " + testShow.isElectronic.ToString() + "\n" + "Author: " + testShow.author + "\n" + "Publisher:" + testShow.publisher + "\n" + "Published On: " + testShow.publishDate + "\n" + bar; richTextBox1.Text = result; }
public LibraryProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, CoreDispatcher coreDispatcher, LibraryItem item, IShellPage instance) { ViewModel = viewModel; TokenSource = tokenSource; Dispatcher = coreDispatcher; Library = item; AppInstance = instance; GetBaseProperties(); ViewModel.PropertyChanged += ViewModel_PropertyChanged; }
protected LibraryItemDecorator(LibraryItem libraryItem) { LibraryItem = libraryItem; }
// j2tta sisse sellep2rast, et n2idata kuidas meetodi olemasolu kontrollitakse (reflektsioon). muidu m6ttetu test. private bool HasMethod(LibraryItem objectToCheck, string methodName) { var type = objectToCheck.GetType(); return(type.GetMethod(methodName) != null); }
public void NavigateToLibraryItemDetailsPage(LibraryItem item) { MainWindow.NavigateToPage(new LibraryItemDetailsPage(item)); }
public void removeFromLibrary(LibraryItem item) { libraryItemList.Remove(item); }
public ThrowAction(LibraryItem library) { _mode = Mode.Interrupt; _libraryItems = new[] { library }; }
public void DeleteLibraryItem(LibraryItem libraryItem) { _db.DeleteLibraryItem(libraryItem); }
public bool DeleteLibraryItem(LibraryItem libraryItem) { _db.Remove(libraryItem); _db.SaveChangesAsync(); return(true); }
public bool AddLibraryItem(LibraryItem libraryItem) { _db.Add(libraryItem); _db.SaveChangesAsync(); return(true); }
public void ExitPlayback(LibraryItem video, PlaybackExitReason reason) { OnPlaybackComplete?.Invoke(this, new PlaybackExitEventArgs(reason, video)); }
// Constructors public Borrowable( LibraryItem libraryItem ) : base( libraryItem ) {}
protected Decorator(LibraryItem libraryItem) { this.LibraryItem = libraryItem; }
void OnGUIOld() { Library library = ArchimatixEngine.library; Event e = Event.current; switch (e.type) { case EventType.MouseDown: //Debug.Log("Down"); break; case EventType.DragUpdated: //Debug.Log("Drag and Drop sorting not supported... yet"); break; case EventType.DragPerform: Debug.Log("Drag and Drop sorting not supported... yet"); break; } //showDetailItem.target = EditorGUILayout.ToggleLeft("Show extra fields", showDetailItem.target); GUIStyle labelstyle = GUI.skin.GetStyle("Label"); labelstyle.alignment = TextAnchor.UpperLeft; labelstyle.fixedWidth = 300; //GUILayout.BeginHorizontal(); // WINDOW TITLE string libtype = (showClass == 3 ? "3D":"2D"); EditorGUILayout.BeginHorizontal(); labelstyle.fontSize = 24; GUILayout.Label("Archimatix " + libtype + " Library"); labelstyle.fontSize = 12; EditorGUILayout.Space(); if (GUILayout.Button("Refresh")) { ArchimatixEngine.createLibraryFromJSONFiles(); } EditorGUILayout.Space(); if (showClass == 3) { if (GUILayout.Button("Switch to 2D")) { showClass = 2; } } else { if (GUILayout.Button("Switch to 3D")) { showClass = 3; } } EditorGUILayout.EndHorizontal(); //GUILayout.FlexibleSpace(); //GUILayout.Space(10); //GUILayout.EndHorizontal(); //labelstyle.fontSize = 9; //GUILayout.Space(16); // SCROLL_VIEW GUIStyle shadowDown = new GUIStyle(); shadowDown.normal.background = bgTex; GUIStyle shadowUp = new GUIStyle(); shadowUp.normal.background = bgTexUp; // BEGIN FILTER BAR EditorGUILayout.BeginHorizontal(); GUILayout.BeginVertical(GUILayout.Width(100), GUILayout.Height(25)); GUILayout.EndVertical(); GUILayout.Space(20); // FILTERS EditorGUI.BeginChangeCheck(); showFilters.target = EditorGUILayout.ToggleLeft("Show Filters", showFilters.target); if (EditorGUI.EndChangeCheck()) { ArchimatixEngine.library.isFiltered = showFilters.target; } GUILayout.FlexibleSpace(); // SEARCH GUILayout.Label("Search"); EditorGUI.BeginChangeCheck(); GUI.SetNextControlName("TF_SEARCH"); searchString = GUILayout.TextField(searchString, GUILayout.Width(130)); if (EditorGUI.EndChangeCheck()) { string[] words = searchString.Split(' '); ArchimatixEngine.library.filterResultsUsingSearch(new List <string>(words)); lastTextField = "TF_SEARCH"; } if (GUILayout.Button("x", GUILayout.Width(20))) { GUI.FocusControl("dummy"); searchString = ""; ArchimatixEngine.library.filteredResults = null; } if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return)) { GUI.FocusControl(lastTextField); e.Use(); } GUILayout.Space(20); EditorGUILayout.EndHorizontal(); // \ END FILTER BAR if (EditorGUILayout.BeginFadeGroup(showFilters.faded) && ArchimatixEngine.library.categories != null) { // COLUMN LABELS GUILayout.BeginHorizontal(); foreach (KeyValuePair <string, List <string> > kv in ArchimatixEngine.library.categories) { GUILayout.Label(kv.Key, GUILayout.Width(130)); } GUILayout.EndHorizontal(); GUILayout.Label(" ", shadowDown); filtersScrollPosition = EditorGUILayout.BeginScrollView(filtersScrollPosition, GUILayout.Width(position.width), GUILayout.Height(filtersHeight)); // TAG CATEGORIES GUILayout.BeginHorizontal(); if (queryTags == null) { queryTags = new List <string>(); } foreach (KeyValuePair <string, List <string> > kv in library.categories) { GUILayout.BeginVertical(GUILayout.Width(130)); //GUILayout.Label (kv.Key); foreach (string tag in kv.Value) { //GUILayout.Label ("- "+tag); EditorGUI.BeginChangeCheck(); EditorGUILayout.ToggleLeft(tag, queryTags.Contains(tag), GUILayout.Width(130)); if (EditorGUI.EndChangeCheck()) { if (queryTags.Contains(tag)) { queryTags.Remove(tag); } else { queryTags.Add(tag); } library.filterResultsUsing(queryTags); } } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); // TAG CATEGORIES EditorGUILayout.EndScrollView(); GUILayout.Label(" ", shadowUp); GUILayout.Space(16); } EditorGUILayout.EndFadeGroup(); // CATALOG List <LibraryItem> libraryItems = null; //if (showClass == 1) /* * if (ArchimatixEngine.library.filteredResults.Count > 0) * { * * * libraryItems = ArchimatixEngine.library.filteredResults; * } */ GUILayout.Label(" ", shadowDown); int currentFiltersHeight = (showFilters.target ? filtersHeight + 36 : 0); Vector2 scrollPos = EditorGUILayout.BeginScrollView(libraryScrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height - 120 - currentFiltersHeight)); if (Vector2.Distance(scrollPos, libraryScrollPosition) > 1) { //Debug.Log ("NOT SCROLLING TO TARGET"); scrollingToTarget = false; libraryScrollPosition = scrollPos; } else if (scrollingToTarget) { libraryScrollPosition = Vector2.Lerp(libraryScrollPosition, libraryScrollTargetPosition, .05f); //Debug.Log ("SCROLLING TO TARGET "+Vector2.Distance(libraryScrollPosition, libraryScrollTargetPosition)); if (Vector2.Distance(libraryScrollPosition, libraryScrollTargetPosition) < 50) { scrollingToTarget = false; } } if (Event.current.type == EventType.Layout) { columnCount = (int)Math.Floor(position.width / (thumbnailSize + 20)); if (columnCount == 0) { columnCount = 1; } rowCount = libraryItems.Count / columnCount; rowCount++; cellCount = rowCount * columnCount; } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); bool showDetailRow = false; LibraryItem libraryItem; for (int i = 0; i < cellCount; i++) { if (i >= libraryItems.Count) { break; } libraryItem = libraryItems[i]; if (i % columnCount == 0 && i > 0) { GUILayout.EndHorizontal(); if (showDetailRow) { showDetailRow = false; doDetailView(); } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); } // MENU BUTTON EditorGUILayout.BeginVertical(); // ---------------------------- //Debug.Log("LIBRARY: " + poList.Count); if (i < libraryItems.Count) { if (detailItem == libraryItem) { showDetailRow = true; } // THE BIG CLICK if (GUILayout.Button(libraryItems[i].icon, GUILayout.Width(thumbnailSize), GUILayout.Height(thumbnailSize))) { if (Event.current.shift) { //Make a new Model For Sure AXEditorUtilities.createNewModel(); Library.instantiateParametricObject(libraryItem.readIntoLibraryFromRelativeAXOBJPath); } else { Library.instantiateParametricObject(libraryItem.readIntoLibraryFromRelativeAXOBJPath); } } } // LABEL AND DELETE BUTTON EditorGUILayout.BeginHorizontal(); string name = ""; if (i < libraryItems.Count) { name = libraryItem.Name; } GUILayout.Label(name, GUILayout.Width(thumbnailSize - 20), GUILayout.Height(16)); if (i < libraryItems.Count) { if (editingLibrary) { if (GUILayout.Button("-", GUILayout.Width(16))) { Library.removeLibraryItem(libraryItem); } } else { if (GUILayout.Button("i", GUILayout.Width(16))) { if (detailItem == libraryItem && showDetailItem.faded == 1) { //detailItem = ""; showDetailItem.target = false; libraryScrollTargetPosition = libraryScrollPosition + new Vector2(0, -thumbnailSize); scrollingToTarget = true; } else { detailScreen(libraryItem); showDetailItem.target = true; int row = (int)Mathf.Floor(i / columnCount); //if (row != currentRow) //{ libraryScrollTargetPosition = libraryScrollPosition + new Vector2(0, +thumbnailSize * 2); scrollingToTarget = true; //} //else //scrollingToTarget = false; currentRow = row; } } } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(8); // ------------------------------ EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); if (showDetailRow) { showDetailRow = false; doDetailView(); } GUILayout.Space(256); EditorGUILayout.EndScrollView(); //GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); if (editingLibrary) { if (GUILayout.Button("Done", GUILayout.Width(32))) { editingLibrary = false; } } else { if (GUILayout.Button("Edit", GUILayout.Width(32))) { editingLibrary = true; } } GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); thumbnailSize = EditorGUILayout.IntSlider(thumbnailSize, 32, 256, GUILayout.Width(300)); if (EditorGUI.EndChangeCheck()) { showDetailRow = false; detailItem = null; } EditorGUILayout.EndHorizontal(); labelstyle.fixedWidth = 0; }
public void AddLibraryItem(LibraryItem libraryItem) { _db.AddLibraryItem(libraryItem); }
public void detailScreen(LibraryItem li) { detailItem = li; GUI.FocusControl("dummy"); }
public bool IsAvailableForLending(LibraryItem item, DateTime lendingDate) { var alreadyExistingLending = this.lendings.Where(x => x.Item.ID == item.ID).FirstOrDefault(); return(alreadyExistingLending == null); }
public async Task <StorageFile> GetStorageFile(LibraryItem item) { StorageFolder folder = await GetStorageFolderForItem(item); return(await folder.TryGetItemAsync(GetFileNameFromFullPath(item.FilePath)) as StorageFile); }
public ModifyIsPlayedAction(LibraryItem library) { _libraryItem = library; }
public void Delete(LibraryItem item) { _library.Delete(item); }
public UnGroupAction(LibraryItem[] selectLibraries) { _libraries = selectLibraries; }
internal Uri GetUri(LibraryItem libraryItemToPlay) => new Uri(_cloudBaseUri, libraryItemToPlay.FilePath);
public void RunWorkflow() { WorkflowResult finalResult = new WorkflowResult(); String LastItemRun = ""; int LastRunResultID = 0; try { RunWorkflow run = db.RunWorkflows.Where(r => r.RunID == RunID).FirstOrDefault(); run.StartTime = DateTime.Now; db.SaveChanges(); List <vwRunItem> items = db.vwRunItems.Where(i => i.RunID == RunID).OrderBy(i => i.RunOrder).ToList(); RunPayload pl = run.RunPayloads.FirstOrDefault(); foreach (vwRunItem item in items) { DateTime StartTime = DateTime.Now; LibraryItem li = db.LibraryItems.Where(l => l.ItemID == item.ItemID).FirstOrDefault(); if (!String.IsNullOrEmpty(item.HtmlAnswers)) { pl = util.SetPayload(RunID, li.ItemID, item.HtmlAnswers); } LastItemRun = li.ItemName; WorkflowItem wfi = db.WorkflowItems.Where(w => w.ItemID == item.ItemID).FirstOrDefault(); RunResult rr = new RunResult { ResultString = "", RunID = RunID, ResultID = 1, TimeStarted = DateTime.Now, WFItemID = wfi.WFItemID }; db.RunResults.Add(rr); db.SaveChanges(); LastRunResultID = rr.RunResultID; Assembly assembly = Assembly.LoadFrom(li.LibraryPath); Type type = assembly.GetType("ItemToRun.RunWorkflowItem"); object instanceOfMyType = Activator.CreateInstance(type); var result = type.InvokeMember("RunItem", BindingFlags.Default | BindingFlags.InvokeMethod, null, instanceOfMyType, new Object[] { run.EmpID, pl == null ? new RunPayload() : pl }); IEnumerable <PropertyInfo> props = result.GetType().GetRuntimeProperties(); int ResultID = Convert.ToInt32(props.ElementAt(0).GetValue(result, null)); String ResultText = props.ElementAt(1).GetValue(result, null).ToString(); DateTime TimeDone = Convert.ToDateTime(props.ElementAt(2).GetValue(result, null)); RunResult rrDone = db.RunResults.Where(r => r.RunResultID == rr.RunResultID).FirstOrDefault(); rrDone.TimeCompleted = DateTime.Now; rrDone.ResultID = ResultID; rrDone.ResultString = ResultText; db.SaveChanges(); finalResult = new WorkflowResult { Success = true, ResultString = "" }; } } catch (Exception ex) { finalResult = new WorkflowResult { Success = false, ResultString = String.Format("There was an error during the run in the {0} item.", LastItemRun), FullError = ex }; RunResult rrError = db.RunResults.Where(r => r.RunResultID == LastRunResultID).FirstOrDefault(); rrError.ResultID = 4; rrError.ResultString = String.Format("Error: {0}", ex.Message); rrError.TimeCompleted = DateTime.Now; db.SaveChanges(); } }
//Constructor public Borrowable(LibraryItem libraryItem) : base(libraryItem) { }
public LibraryItem Update(LibraryItem buyer) { throw new NotImplementedException(); }
public abstract void OnExport(string fileName, LibraryItem item);
// INDIVIDUAL LIBRARY ITEM public static void LibraryItemEdit_OnGUI(LibraryItem li) { // CLICKABLE THUMBNAIL EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); float rightMargin = 300; if (GUILayout.Button(li.icon, GUILayout.Width(thumbnailSize), GUILayout.Height(thumbnailSize))) { if (Event.current.shift) { //Make a new Model For Sure AXEditorUtilities.createNewModel(); } AX.Library.instantiateParametricObject(li.readIntoLibraryFromRelativeAXOBJPath); } EditorGUILayout.BeginVertical(); // NAME EditorGUILayout.BeginHorizontal(); GUILayout.Label("Name", LibraryEditorWindow.richRightLabelStyle); if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label(li.Name, LibraryEditorWindow.nameLabelStyle); } else { GUI.SetNextControlName("LibraryItemEdit_Text_" + li.guid + "_name"); li.Name = GUILayout.TextField(li.Name, LibraryEditorWindow.textfieldStyle, new GUILayoutOption[] { GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin), GUILayout.MinWidth(200) }); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); // AUTHOR EditorGUILayout.BeginHorizontal(); GUILayout.Label("Author", LibraryEditorWindow.richRightLabelStyle); if (string.IsNullOrEmpty(li.author)) { li.author = ""; } if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label(li.author); } else { GUI.SetNextControlName("LibraryItemEdit_Text_" + li.guid + "_author"); li.author = GUILayout.TextField(li.author, new GUILayoutOption[] { GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin), GUILayout.MinWidth(200) }); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); // DESCRIPTION EditorGUILayout.BeginHorizontal(); GUILayout.Label("Description", LibraryEditorWindow.richRightLabelStyle); if (string.IsNullOrEmpty(li.description)) { li.description = ""; } if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label(li.description, LibraryEditorWindow.descripLabelStyle, new GUILayoutOption[] { GUILayout.Height(50), GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin), GUILayout.MinWidth(200) }); } else { GUI.SetNextControlName("LibraryItemEdit_Text_" + li.guid + "_description"); li.description = GUILayout.TextArea(li.description, LibraryEditorWindow.textareaStyle, new GUILayoutOption[] { GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin), GUILayout.MinWidth(200), GUILayout.Height(50) }); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); // TAGS EditorGUILayout.BeginHorizontal(); GUILayout.Label("Tags", LibraryEditorWindow.richRightLabelStyle); if (string.IsNullOrEmpty(li.tags)) { li.tags = ""; } if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label(li.tags); } else { GUI.SetNextControlName("LibraryItemEdit_Text_" + li.guid + "_tags"); li.tags = GUILayout.TextField(li.tags, new GUILayoutOption[] { GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin), GUILayout.MinWidth(200) }); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); // DOCUMENTATION_URL EditorGUILayout.BeginHorizontal(); GUILayout.Label("Documentation", LibraryEditorWindow.richRightLabelStyle); if (string.IsNullOrEmpty(li.documentationURL)) { li.documentationURL = ""; } if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label(li.documentationURL); } else { GUI.SetNextControlName("LibraryItemEdit_Text_" + li.guid + "_documentationURL"); li.documentationURL = GUILayout.TextField(li.documentationURL, new GUILayoutOption[] { GUILayout.Width(LibraryEditorWindow.rect.width - rightMargin) }); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); // VISIBLE IN SIDE_BAR EditorGUILayout.BeginHorizontal(); GUILayout.Label("In Sidebar Menu", LibraryEditorWindow.richRightLabelStyle); EditorGUI.BeginChangeCheck(); li.includeInSidebarMenu = EditorGUILayout.Toggle("", li.includeInSidebarMenu); if (EditorGUI.EndChangeCheck()) { ArchimatixEngine.library.saveLibraryMetadata(); li.saveToFile(); } EditorGUILayout.EndHorizontal(); // FOOTER MENU EditorGUILayout.BeginHorizontal(); if (LibraryEditorWindow.editingLibraryItem != li) { GUILayout.Label("", LibraryEditorWindow.richRightLabelStyle); // EDIT if (GUILayout.Button("Edit")) { li.cacheSelf(); LibraryEditorWindow.editingLibraryItem = li; } } else { // DELETE_ITEM GUILayout.Label("", LibraryEditorWindow.richRightLabelStyle, new GUILayoutOption[] { GUILayout.MaxWidth(16) }); if (GUILayout.Button("Delete Item")) { Library.removeLibraryItem(li); } EditorGUILayout.Space(); // CANCEL if (GUILayout.Button("Cancel")) { li.revertFromCache(); LibraryEditorWindow.editingLibraryItem = null; } EditorGUILayout.Space(); // REVERT if (GUILayout.Button("Revert")) { li.revertFromCache(); } EditorGUILayout.Space(); // SAVE if (GUILayout.Button("Save")) { li.saveToFile(); li.cacheSelf(); LibraryEditorWindow.editingLibraryItem = null; } EditorGUILayout.Space(); GUILayout.FlexibleSpace(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
protected Decorator(LibraryItem <T> item) { Item = item; }
public void UpdateLibrary(LibraryItem library) { Library = library; GetBaseProperties(); GetSpecialProperties(); }
public UIChaptersEnabledVideoView(LibraryItem video, CGRect frame, ChaptersEnabledVideoView videoView) { this.videoView = videoView; this.video = video; AutoresizingMask = UIViewAutoresizing.All; ContentMode = UIViewContentMode.ScaleAspectFill; if (!string.IsNullOrEmpty(video.LocalFilePath)) { Logger.Log("UIChaptersEnabledVideoView.ctor: video.LocalFilePath = '" + video.LocalFilePath + "'"); MPNowPlayingInfoCenter.DefaultCenter.NowPlaying = new MPNowPlayingInfo() { Title = video.Title }; var linkPath = LocalLibraryService.Instance.GetLinkForMediaItem(video); moviePlayer = new MPMoviePlayerViewController(NSUrl.FromFilename(string.IsNullOrEmpty(linkPath) ? video.LocalFilePath : linkPath)) { View = { ContentMode = UIViewContentMode.ScaleAspectFill, AutoresizingMask = UIViewAutoresizing.All }, MoviePlayer = { RepeatMode = MPMovieRepeatMode.None, ControlStyle = MPMovieControlStyle.Fullscreen, ScalingMode = MPMovieScalingMode.AspectFit, AllowsAirPlay = true } }; Frame = moviePlayer.View.Frame = frame; Add(moviePlayer.View); playbackDidFinishNotification = MPMoviePlayerController.Notifications.ObservePlaybackDidFinish(playBackFinishedHandler); NSNotificationCenter.DefaultCenter.RemoveObserver(moviePlayer, UIApplication.DidEnterBackgroundNotification, null); willEnterForegroundNotification = UIApplication.Notifications.ObserveWillEnterForeground(willEnterForegroundHandler); didEnterBackgroundNotification = UIApplication.Notifications.ObserveDidEnterBackground(didEnterBackgroundHandler); var bookmarkTime = (int)video.BookmarkTime; if ((bookmarkTime == -2) || (bookmarkTime == 0)) { bookmarkTime = -1; } if (videoView.SkipAdvertisements) { bool hasBookmarkTimeValue = false; for (int i = 0; i < video.Chapters.Count; i++) { Chapter chapter = video.Chapters[i]; chapter.IsSkipped = false; if (!hasBookmarkTimeValue && (chapter.Type != ChapterType.Advertisement)) { int chapterStartTime = (int)chapter.StartTime; if (chapterStartTime != 0) { bookmarkTime = chapterStartTime; } hasBookmarkTimeValue = true; } } } if ((videoView.SkipAdvertisements) || ((bookmarkTime > 0) && UIDevice.CurrentDevice.CheckSystemVersion(8, 4))) { playbackStateDidChangeNotification = MPMoviePlayerController.Notifications.ObservePlaybackStateDidChange(playbackStateDidChange); } if (bookmarkTime > 0) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 4)) { initialPlaybackTime = TimeSpan.FromSeconds(bookmarkTime); } else { moviePlayer.MoviePlayer.InitialPlaybackTime = bookmarkTime; } } if (moviePlayer.MoviePlayer.IsPreparedToPlay) { moviePlayer.MoviePlayer.Play(); } else { playbackIsPreparedToPlayNotification = MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange(playBackIsPreparedToPlayHandler); moviePlayer.MoviePlayer.PrepareToPlay(); } } else { exitPlayback(PlaybackExitReason.Error); } }
// Constructor public Decorator(LibraryItem libraryItem) { this.libraryItem = libraryItem; }
public Decorator(LibraryItem libraryItem) { _libraryItem = libraryItem; }
public void UpdateLibraryItem(LibraryItem libraryItem) { _db.UpdateLibraryItem(libraryItem); }
// Constructor public Decorator(LibraryItem libraryItem) { this.LibraryItem = libraryItem; }
public LibraryItem GetItemById(int id) { LibraryItem li = null; using (IDbConnection connection = Common.CreateConnection()) { connection.Open(); IDbCommand cmd = connection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "GetItemById"; IDbDataParameter itemDbId = Common.CreateParameter("@id", DbType.Int32, id); cmd.Parameters.Add(itemDbId); var reader = cmd.ExecuteReader(); while (reader.Read()) { string type = (string)reader["Type"]; if (type == "patent") { Patent patent = new Patent() { Country = (string)reader["country"], DateOfPublication = (DateTime)reader["date_of_publication"], Id = (int)reader["library_item_ID"], Name = (string)reader["title"], Note = (string)reader["note"], NumberOfPages = (int)reader["number_of_pages"], RegNumber = (string)reader["reg_number"], SubmissionDocuments = (DateTime)reader["date_of_submission"], YearOfPublishing = (int)reader["YearOfPublication"], }; XElement xmlAuthor = XElement.Parse((string)reader["authors"]); patent.Authors = new HashSet <Author>(Common.GetAuthorsFromXML(xmlAuthor)); li = patent; } else if (type == "paper") { PaperIssue pi = new PaperIssue() { CityOfPublishing = (string)reader["cityOfPublication"], DateOfIssue = (DateTime)reader["dateOfIssue"], Id = (int)reader["library_item_ID"], IssueNumber = (int)reader["number_of_issue"], Note = (string)reader["note"], NumberOfPages = (int)reader["number_of_pages"], Paper = new Paper() { Id = (int)reader["id"], Issn = reader["ISSN"] as string, Name = (string)reader["title"] }, Publisher = new Publisher { Id = (int)reader["publisher_Id"], PublisherName = (string)reader["publisherName"], }, YearOfPublishing = (int)reader["YearOfPublication"], }; li = pi; } else if (type == "book") { Book book = new Book() { CityOfPublishing = (string)reader["city_of_publishing"], Id = (int)reader["library_item_ID"], ISBN = reader["ISBN"] as string, Name = (string)reader["title"], NumberOfPages = (int)reader["number_of_pages"], Note = (string)reader["note"], Publisher = new Publisher() { Id = (int)reader["publisher_Id"], PublisherName = (string)reader["publisherName"] }, YearOfPublishing = (int)reader["YearOfPublication"] }; XElement xmlAuthor = XElement.Parse((string)reader["authors"]); book.Authors = new HashSet <Author>(Common.GetAuthorsFromXML(xmlAuthor)); li = book; } else { throw new Exception("Unexpected type of an object in database"); } } } return(li); }
public MoveLibraryFileAction(string moveDestDirectory, LibraryItem[] selectLibraries) { _moveDestDirectory = moveDestDirectory; _selectLibraries = selectLibraries; }
public Utilities.ItemRunResult RunItem(int EmpID, RunPayload RunPayload) { DataLayer.EPSEntities db = new DataLayer.EPSEntities(); Utilities util = new Utilities(); try { Employee emp = db.Employees.Where(e => e.EmpID == EmpID).FirstOrDefault(); String domain = util.GetParam("ADDomain", "Active Directory domain"); String adminName = util.GetParam("ADUsername", "Active Directory admin user"); String password = util.GetParam("ADPassword", "Active Directory admin user password"); String ou = util.GetParam("DisabledUsersOU", "Active Directory Disabled Users OU path"); String myName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; LibraryItem li = db.LibraryItems.Where(l => l.LibraryPath.EndsWith(myName + ".dll")).FirstOrDefault(); PrincipalContext context = new PrincipalContext(ContextType.Domain, domain, adminName, password); UserPrincipal user = UserPrincipal.FindByIdentity(context, emp.Username); if (user == null) { return(new Utilities.ItemRunResult { ResultID = 4, ResultText = String.Format("{0} could not be found in Active Directory.", emp.Username), TimeDone = DateTime.Now }); } Boolean isInOUAlready = false; DirectoryEntry userOU = new DirectoryEntry("LDAP://" + user.DistinguishedName, adminName, password); DirectoryEntry disabledOU = new DirectoryEntry("LDAP://" + ou, adminName, password); String OUCheckUser = userOU.Path.ToString(); if (OUCheckUser.EndsWith(disabledOU.Path.Replace("LDAP://", ""))) { isInOUAlready = true; } if (isInOUAlready == true) { return(new Utilities.ItemRunResult { ResultID = 5, ResultText = String.Format("{0} is already in the Disabled Users OU.", emp.Username), TimeDone = DateTime.Now }); } String plPath = userOU.Path.Replace(String.Format("CN={0} {1},", emp.FirstName, emp.LastName), ""); userOU.MoveTo(disabledOU); userOU.Close(); String htmlAnswers = String.Format("{1}:UserOUPath={0}", plPath, li.ItemID); RunWorkflow run = db.RunWorkflows.Where(r => r.EmpID == EmpID).OrderByDescending(r => r.StartTime).FirstOrDefault(); util.SetPayload(run.RunID, li.ItemID, htmlAnswers); return(new Utilities.ItemRunResult { ResultID = 2, ResultText = String.Format("{0} {1} was moved to the Disabled Users OU in Active Directory.", emp.FirstName, emp.LastName), TimeDone = DateTime.Now }); } catch (Exception ex) { return(new Utilities.ItemRunResult { ResultID = 4, ResultText = String.Format("Error: {0}", ex.Message), TimeDone = DateTime.Now }); } }
public DeleteLibraryAction(LibraryItem[] selectLibraries, bool isDeleteFile) { _selectLibraryItems = selectLibraries; _isDeleteFile = isDeleteFile; }
public ModifyIsFavoriteAction(LibraryItem library) { _libraryItem = library; }