public TrailerItem(IModelItem owner) : base(owner) { this.Invoked += delegate(object sender, EventArgs args) { this.PlayMovie(); }; //this.Description = title.Caption; //this.Invoked += delegate(object sender, EventArgs args) //{ // //am I being silly here copying this? // List<TitleFilter> newFilter = new List<TitleFilter>(); // foreach (TitleFilter filt in filter) // { // newFilter.Add(filt); // } // newFilter.Add(new TitleFilter(title.Category.FilterType, title.Name)); // OMLProperties properties = new OMLProperties(); // properties.Add("Application", OMLApplication.Current); // properties.Add("I18n", I18n.Instance); // Command CommandContextPopOverlay = new Command(); // properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); // Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(newFilter, title.Description); // properties.Add("Page", gallery); // OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); //}; }
public GenreItem(Library.GalleryItem title, IModelItem owner, List<TitleFilter> filter) : base(owner) { this.Description = title.Name; this.DefaultImage=title.MenuCoverArt; this.Metadata = string.Format("{0} titles", title.ForcedCount); this.Invoked += delegate(object sender, EventArgs args) { //am I being silly here copying this? List<TitleFilter> newFilter = new List<TitleFilter>(); foreach (TitleFilter filt in filter) { newFilter.Add(filt); } newFilter.Add(new TitleFilter(title.Category.FilterType, title.Name)); OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); properties.Add("I18n", I18n.Instance); Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(newFilter, title.Description); properties.Add("Page", gallery); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; }
public StartMenuCommand(IModelItem Owner, StartMenuHelper helper, StartMenuItem Item) : base(Owner) { this.entryPoint = Item; this.edit = new Command(this); //this.edit.Invoked += new EventHandler(edit_Invoked); this.edit.Invoked += delegate(object Sender, EventArgs Args) { //navigate to edit page Dictionary<string, object> properties = new Dictionary<string, object>(); Library.Code.V3.StartMenuItemSettings page = new Library.Code.V3.StartMenuItemSettings(entryPoint, helper); properties["Page"] = page; properties["Application"] = OMLApplication.Current; OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_StartMenuItemSettings", properties); }; this.moveUp = new Command(this); this.moveUp.Invoked += delegate(object Sender, EventArgs Args) { helper.MoveItemUp(this.entryPoint); }; this.moveDown = new Command(this); this.moveDown.Invoked += delegate(object Sender, EventArgs Args) { helper.MoveItemDown(this.entryPoint); }; }
public CollectionItem(Title title, IModelItem owner) : base(owner) { this._titleObj = title; //this.InternalMovieItem = new Library.MovieItem(title, null); this.ItemType = 0; if(OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon) this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay"; if (this._titleObj.WatchedCount == 0) this.isUnwatched = true; DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1); //invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) this.MetadataTop = releaseDate.Year.ToString(); else this.MetadataTop = ""; this.ItemId = 1; string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero)); this.StarRating = starRating; string extendedMetadata = string.Empty; this.SortName = title.SortName; //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17"); this.Metadata = _titleObj.ParentalRating; if (string.IsNullOrEmpty(_titleObj.ParentalRating)) this.Metadata = "Not Rated"; if (_titleObj.Runtime.ToString() != "0") this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString()); this.Tagline = _titleObj.Synopsis; this.Description = title.Name; //TODO: not sure how to read this yet... //temporarially disabled due to bug in eagerloading //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString(); this.Invoked += delegate(object sender, EventArgs args) { //stub details for CollectionItem CollectionPage page = new CollectionPage(this); OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); //properties.Add("UISettings", new UISettings()); //properties.Add("Settings", new Settings()); properties.Add("I18n", I18n.Instance); //v3 main gallery //Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(new List<OMLEngine.TitleFilter>(), "OML"); ////description //gallery.Description = "OML"; Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); properties.Add("Page", page); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; }
public TrailerGenreItem(IModelItem owner) : base(owner) { this.trailers = new List<TrailerItem>(); this.Invoked += delegate(object sender, EventArgs args) { //this.PlayMedia(); }; }
private void addItem(IModelItem item, int index) { ModelListViewItem view_item = TemplateItem.CreateItem(); view_item.DataSource = item; view_item.ParentList = this; lock (ItemStack.Children) { if (index > -1) ItemStack.Children.Insert(index, view_item); else ItemStack.Children.Add(view_item); } if (item.IsSelected) SelectedItems.Add(item); }
public DVDChangerItem(DiscDataEx disc, IModelItem owner) : base(owner) { this.disc = disc; if (!string.IsNullOrEmpty(disc.Title)) this.Description = disc.Title; else this.Description = disc.VolumeLabel; //slow load the rest try { DvdInfo.BeginGetDvdInfo(disc.DiscId, new AsyncCallback(AddComplete), null); } catch { } }
public FavoritesCommand(IModelItem Owner, UserFilter Filter) : base(Owner) { this.filter = Filter; this.edit = new Command(this); this.edit.Invoked += delegate(object Sender, EventArgs Args) { //navigate to edit page Dictionary<string, object> properties = new Dictionary<string, object>(); Library.Code.V3.FavoritesItemSettings page = new Library.Code.V3.FavoritesItemSettings(this.filter, false); properties["Page"] = page; properties["Application"] = OMLApplication.Current; OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_FavoritesItemSettings", properties); }; }
private void removeItem(IModelItem item, int index) { lock (ItemStack.Children) { ModelListViewItem match = null; foreach (ModelListViewItem i in ItemStack.Children) { if (i.DataSource == item) { match = i; break; } } item.IsSelected = false; lock (SelectedItems) { if (SelectedItems.Contains(item)) SelectedItems.Remove(item); } if (match != null) { ItemStack.Children.Remove(match); } } }
public GenreItem(UserFilter title, IModelItem owner, List<TitleFilter> filter) : base(owner) { this.Description = title.Name; this.Invoked += delegate(object sender, EventArgs args) { OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); properties.Add("I18n", I18n.Instance); Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(filter, title.Name); properties.Add("Page", gallery); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; }
/// <summary> /// Copies the node style for the paste-operation because <see cref="RotatableNodeStyleDecorator"/> should not be shared. /// </summary> public void Paste(IGraphClipboardContext context, IModelItem item, object userData) { var node = item as INode; if (node == null) { return; } var styleWrapper = node.Style as RotatableNodeStyleDecorator; if (styleWrapper != null) { if (context.TargetGraph.GetFoldingView() != null) { context.TargetGraph.GetFoldingView().Manager.MasterGraph.SetStyle(node, styleWrapper.Clone() as INodeStyle); } else { context.TargetGraph.SetStyle(node, styleWrapper.Clone() as INodeStyle); } } }
protected virtual void WriteConstruction(string ident, IModelItem modelItem, TextWriter writer, int pos) { KifObject kifObject = modelItem as KifObject; IList <IModelItem> items = kifObject.getChildren(); writer.Write(ident); for (int i = 0; i < items.Count; i++) { IModelItem item = items[i]; if (item.isLeaf()) { writer.Write(item.ToString()); if (i < items.Count - 1 && item != LB && items[i + 1] != RB) { writer.Write(" "); } } else { WriteConstruction(calcIdent(ident, pos + 1), item, writer, pos + 1); } } }
/// <summary> /// Returns whether or not to pasting of the given item is possible. /// </summary> public bool ShouldPaste(IGraphClipboardContext context, IModelItem item, object userData) { return(true); }
public DiscCommand(IModelItem Owner) : base(Owner) { this.load = new Command(this); this.load.Invoked += new EventHandler(load_Invoked); }
/// <summary> /// Returns whether or not to cutting the given item is possible. /// </summary> public bool ShouldCut(IGraphClipboardContext context, IModelItem item) { return(true); }
public object GetSourceObject([NotNull] IModelItem item) { return(item.Tag); }
public ProgressCommand(IModelItem owner) : base(owner) { }
/// <summary> /// Validates entity for unit tests only. /// </summary> /// <param name="entity"></param> /// <param name="entityEntry">It can be null if it is enough for business rules of current entity.</param> public void ValidateModelItem(IModelItem entity, DbEntityEntry entityEntry = null) { if (BusinessRuleExecutorFactory == null) return; var executor = BusinessRuleExecutorFactory.Create(); var validationResults = executor.ExecuteBusinessResult(entity, entityEntry).ToArray(); if (validationResults.Any(x => x != BusinessRuleValidationResult.Success)) { throw new BusinessRuleValidationException(validationResults); } }
public IEnumerable <BusinessRuleValidationResult> ExecuteBusinessResult(IModelItem entity, DbEntityEntry entityEntry) { return(businessRules.Where(x => Reflection.GetGenericParameters(x).Contains(entity.GetType())) .SelectMany(businessRule => businessRule.Validate(entity, entityEntry))); }
static bool HasValidColorTag(IModelItem element) { return(element.Tag is Color); }
private void ErrorInternal(string message, IModelItem item) { _outputLog.Error(FormatLogMessage(message)); AttachMessage(message, BuildMessageType.Error, item); }
public EpisodeItem(Title title, IModelItem owner) : base(owner) { this._titleObj = title; //this.InternalMovieItem = new Library.MovieItem(title, null); this.ItemType = 0; if(OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon) this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay"; if (this._titleObj.WatchedCount == 0) this.isUnwatched = true; DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1); //invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) this.MetadataTop = releaseDate.Year.ToString(); else this.MetadataTop = ""; this.ItemId = 1; string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero)); this.StarRating = starRating; string extendedMetadata = string.Empty; this.SortName = title.SortName; //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17"); this.Metadata = _titleObj.ParentalRating; if (string.IsNullOrEmpty(_titleObj.ParentalRating)) this.Metadata = "Not Rated"; if (_titleObj.Runtime.ToString() != "0") this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString()); this.Tagline = _titleObj.Synopsis; this.Description = title.Name; //TODO: not sure how to read this yet... //temporarially disabled due to bug in eagerloading //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString(); this.Invoked += delegate(object sender, EventArgs args) { //to test v3 Library.Code.V3.DetailsPage page = new Library.Code.V3.DetailsPage(); page.Description = "episode details"; page.Title = this.Description; page.Summary = _titleObj.Synopsis; page.Background = this.DefaultImage; page.Details = new Library.Code.V3.ExtendedDetails(); page.Details.CastArray = new ArrayListDataSet(); string directors = string.Empty; int directorCount = 0; foreach (Person director in _titleObj.Directors) { Library.Code.V3.CastCommand directorCommand = new Library.Code.V3.CastCommand(); directorCommand.Role = " "; directorCommand.Description = director.full_name; directorCommand.Invoked += new EventHandler(actorCommand_Invoked); if (directorCount == 0) { directorCommand.CastType = "TitleAndDesc"; directorCommand.GroupTitle = "DIRECTOR"; directorCommand.ActorId = 1;//not sure how this works in oml } else directorCommand.CastType = "Desc"; page.Details.CastArray.Add(directorCommand); directorCount++; AppendSeparatedValue(ref directors, director.full_name, "; "); } if (!string.IsNullOrEmpty(directors)) page.Details.Director = string.Format("Directed By: {0}", directors); string cast = string.Empty; int actorCount = 0; foreach (Role kvp in _titleObj.ActingRoles) { Library.Code.V3.CastCommand actorCommand = new Library.Code.V3.CastCommand(); actorCommand.Description = kvp.PersonName; actorCommand.ActorId = 1;//not sure how this works in oml actorCommand.Invoked += new EventHandler(actorCommand_Invoked); actorCommand.Role = kvp.RoleName; if (actorCount == 0) { //add the title "CAST" actorCommand.CastType = "TitleAndDesc"; actorCommand.GroupTitle = "CAST"; } else actorCommand.CastType = "Desc"; page.Details.CastArray.Add(actorCommand); actorCount++; AppendSeparatedValue(ref cast, kvp.PersonName, "; "); } //foreach (string castmember in this.InternalMovieItem.Actors) //{ // AppendSeparatedValue(ref cast, castmember, "; "); //} if (!string.IsNullOrEmpty(cast)) page.Details.Cast = string.Format("Cast Info: {0}", cast); if (this.StarRating != "0") page.Details.StarRating = new Image(string.Format("resx://Library/Library.Resources/V3_Controls_Common_Stars_{0}", starRating)); //strip invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) page.Details.YearString = releaseDate.Year.ToString(); page.Details.Studio = _titleObj.Studio; string genres = string.Empty; if (_titleObj.Genres.Count > 0) { foreach (string genre in _titleObj.Genres) { AppendSeparatedValue(ref genres, genre, ", "); } } AppendSeparatedValue(ref genres, this.Metadata, ", "); page.Details.GenreRatingandRuntime = genres; //fixes double spacing issues page.Details.Summary = _titleObj.Synopsis.Replace("\r\n", "\n"); page.Commands = new ArrayListDataSet(page); //default play command Command playCmd = new Command(); playCmd.Description = "Play"; playCmd.Invoked += new EventHandler(playCmd_Invoked); page.Commands.Add(playCmd); if (page.Details.CastArray.Count > 0) { Command command = new Command(); command.Description = "Cast + More"; command.Invoked += delegate(object castSender, EventArgs castArgs) { Dictionary<string, object> castProperties = new Dictionary<string, object>(); castProperties["Page"] = page; castProperties["Application"] = Library.OMLApplication.Current; Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPageCastCrew", castProperties); }; page.Commands.Add(command); } page.Watched = new BooleanChoice(this, "Watched"); //is this the right way? // yes :) if (_titleObj.WatchedCount > 0) page.Watched.Value = true; else page.Watched.Value = false; page.Watched.ChosenChanged += new EventHandler(Watched_ChosenChanged); this.SetFanArtImage(page.Details, _titleObj); Dictionary<string, object> properties = new Dictionary<string, object>(); properties["Page"] = page; properties["Application"] = Library.OMLApplication.Current; if (page.Details.FanArt!=null) Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_FanArtDetailsPage", properties); else Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_EpisodeDetailsPage", properties); }; }
/// <summary> /// Validates the entity to ensure this business rule is applied before /// being saved to the database /// </summary> /// <param name="entity">The entity to validate.</param> /// <param name="entityEntry"> /// The original entity entry from the validation call. /// Can be null when the rule is called from outside the context /// </param> /// <returns>A collection of errors, or an empty collection if the business rule succeeded</returns> public IEnumerable <BusinessRuleValidationResult> Validate(IModelItem entity, DbEntityEntry entityEntry) { return(ExecuteValidation((TEntity)entity, entityEntry)); }
public void HideModelItem(IModelItem modelItem) => HideModelItems(new[] { modelItem });
public IDiagramShape ShowModelItem(IModelItem modelItem) => ShowModelItems(new[] { modelItem }).FirstOrDefault();
public SeasonItem(Title title, IModelItem owner) : base(owner) { this._titleObj = title; //this.InternalMovieItem = new Library.MovieItem(title, null); this.ItemType = 0; if (OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon) { this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay"; } if (this._titleObj.WatchedCount == 0) { this.isUnwatched = true; } DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1); //invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) { this.MetadataTop = releaseDate.Year.ToString(); } else { this.MetadataTop = ""; } this.ItemId = 1; string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero)); this.StarRating = starRating; string extendedMetadata = string.Empty; this.SortName = title.SortName; //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17"); this.Metadata = _titleObj.ParentalRating; if (string.IsNullOrEmpty(_titleObj.ParentalRating)) { this.Metadata = "Not Rated"; } if (_titleObj.Runtime.ToString() != "0") { this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString()); } this.Tagline = _titleObj.Synopsis; this.Description = title.Name; //TODO: not sure how to read this yet... //temporarially disabled due to bug in eagerloading //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString(); this.Invoked += delegate(object sender, EventArgs args) { //stub details for CollectionItem SeasonPage page = new SeasonPage(this); OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); //properties.Add("UISettings", new UISettings()); //properties.Add("Settings", new Settings()); properties.Add("I18n", I18n.Instance); //v3 main gallery //Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(new List<OMLEngine.TitleFilter>(), "OML"); ////description //gallery.Description = "OML"; Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); properties.Add("Page", page); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; }
/// <summary> /// Adds no additional state to the cut-operation. /// </summary> public object Cut(IGraphClipboardContext context, IModelItem item) { return(null); }
public void Error(IModelItem item, string message, params object[] args) { ErrorInternal(string.Format(message, args), item); }
public override IPersistentObject GetAsPersistentObject(IModelItem item) { return MigrationReportPersistentAdapter.GetPersistentObject((MigrationReport) item); }
private void AttachMessage(string message, BuildMessageType type, IModelItem item) { _report.Messages.Add( new MigrationReportMessage( type, message, (_sourcePlugin != null ? _sourcePlugin.Type.ToString() : null), (_sourcePlugin != null ? string.Format("{0}:{1} ({2} {3})", _sourcePlugin.Family, _sourcePlugin.Name, _sourcePlugin.Company, _sourcePlugin.CompanyVersion) : null), (item != null ? item.Url : null))); }
public object GetSourceObject([NotNull] IModelItem item) { return(graphBuilder.GetSourceObject(item)); }
public MarketplaceReportFavouriteArtistsCommand(IModelItem owner) : base(owner) { }
public MovieItem(Title title, IModelItem owner) : base(owner) { this._titleObj = title; this.setCoverArtThemeId(title.Name); //this.InternalMovieItem = new Library.MovieItem(title, null); this.ItemType = 0; if (OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon) { this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay"; } if (this._titleObj.WatchedCount == 0) { this.isUnwatched = true; } DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1); //invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) { this.MetadataTop = releaseDate.Year.ToString(); } else { this.MetadataTop = ""; } this.ItemId = 1; string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero)); this.StarRating = starRating; string extendedMetadata = string.Empty; this.SortName = title.SortName; //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17"); this.Metadata = _titleObj.ParentalRating; if (string.IsNullOrEmpty(_titleObj.ParentalRating)) { this.Metadata = "Not Rated"; } if (_titleObj.Runtime.ToString() != "0") { this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString()); } this.Tagline = _titleObj.Synopsis; this.Description = title.Name; //TODO: not sure how to read this yet... //temporarially disabled due to bug in eagerloading //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString(); this.Invoked += delegate(object sender, EventArgs args) { //to test v3 Library.Code.V3.DetailsPage page = new Library.Code.V3.DetailsPage(); page.Description = "movie details"; page.Title = this.Description; page.Summary = _titleObj.Synopsis; page.Background = this.DefaultImage; page.Details = new Library.Code.V3.ExtendedDetails(); page.Details.CastArray = new ArrayListDataSet(); string directors = string.Empty; int directorCount = 0; foreach (Person director in _titleObj.Directors) { Library.Code.V3.CastCommand directorCommand = new Library.Code.V3.CastCommand(); directorCommand.Role = " "; directorCommand.Description = director.full_name; directorCommand.Invoked += new EventHandler(actorCommand_Invoked); if (directorCount == 0) { directorCommand.CastType = "TitleAndDesc"; directorCommand.GroupTitle = "DIRECTOR"; directorCommand.ActorId = 1;//not sure how this works in oml } else { directorCommand.CastType = "Desc"; } page.Details.CastArray.Add(directorCommand); directorCount++; AppendSeparatedValue(ref directors, director.full_name, "; "); } if (!string.IsNullOrEmpty(directors)) { page.Details.Director = string.Format("Directed By: {0}", directors); } string cast = string.Empty; int actorCount = 0; foreach (Role kvp in _titleObj.ActingRoles) { Library.Code.V3.CastCommand actorCommand = new Library.Code.V3.CastCommand(); actorCommand.Description = kvp.PersonName; actorCommand.ActorId = 1;//not sure how this works in oml actorCommand.Invoked += new EventHandler(actorCommand_Invoked); actorCommand.Role = kvp.RoleName; if (actorCount == 0) { //add the title "CAST" actorCommand.CastType = "TitleAndDesc"; actorCommand.GroupTitle = "CAST"; } else { actorCommand.CastType = "Desc"; } page.Details.CastArray.Add(actorCommand); actorCount++; AppendSeparatedValue(ref cast, kvp.PersonName, "; "); } //foreach (string castmember in this.InternalMovieItem.Actors) //{ // AppendSeparatedValue(ref cast, castmember, "; "); //} if (!string.IsNullOrEmpty(cast)) { page.Details.Cast = string.Format("Cast Info: {0}", cast); } if (this.StarRating != "0") { page.Details.StarRating = new Image(string.Format("resx://Library/Library.Resources/V3_Controls_Common_Stars_{0}", starRating)); } //strip invalid dates if (releaseDate.Year != 1 && releaseDate.Year != 1900) { page.Details.YearString = releaseDate.Year.ToString(); } page.Details.Studio = _titleObj.Studio; string genres = string.Empty; if (_titleObj.Genres.Count > 0) { foreach (string genre in _titleObj.Genres) { AppendSeparatedValue(ref genres, genre, ", "); } } AppendSeparatedValue(ref genres, this.Metadata, ", "); page.Details.GenreRatingandRuntime = genres; //fixes double spacing issues page.Details.Summary = _titleObj.Synopsis.Replace("\r\n", "\n"); page.Commands = new ArrayListDataSet(page); //default play command Command playCmd = new Command(); playCmd.Description = "Play"; playCmd.Invoked += new EventHandler(playCmd_Invoked); page.Commands.Add(playCmd); if (page.Details.CastArray.Count > 0) { Command command = new Command(); command.Description = "Cast + More"; command.Invoked += delegate(object castSender, EventArgs castArgs) { Dictionary <string, object> castProperties = new Dictionary <string, object>(); castProperties["Page"] = page; castProperties["Application"] = Library.OMLApplication.Current; Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPageCastCrew", castProperties); }; page.Commands.Add(command); } if (Properties.Settings.Default.AllowDelete) { //delete a title Command deleteCmd = new Command(); deleteCmd.Description = "Delete"; deleteCmd.Invoked += new EventHandler(deleteCmd_Invoked); page.Commands.Add(deleteCmd); } page.Watched = new BooleanChoice(this, "Watched"); //is this the right way? // yes :) if (_titleObj.WatchedCount > 0) { page.Watched.Value = true; } else { page.Watched.Value = false; } page.Watched.ChosenChanged += new EventHandler(Watched_ChosenChanged); this.SetFanArtImage(page.Details, _titleObj); Dictionary <string, object> properties = new Dictionary <string, object>(); properties["Page"] = page; properties["Application"] = Library.OMLApplication.Current; if (page.Details.FanArt != null) { Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_FanArtDetailsPage", properties); } else { Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPage", properties); } }; }
public IEnumerable<BusinessRuleValidationResult> ExecuteBusinessResult(IModelItem entity, DbEntityEntry entityEntry) { return businessRules.Where(x => Reflection.GetGenericParameters(x).Contains(entity.GetType())) .SelectMany(businessRule => businessRule.Validate(entity, entityEntry)); }
private void LogError(IModelItem item, string text, params object[] args) { if (_context != null && _context.Log != null) { _context.Log.Error(item, text, args); } }
public Color DetermineElementColor(Color[] colors, Component component, ISet <Component> affectedComponents, Dictionary <Component, Color> color2AffectedComponent, Component largestComponent, ResultItemCollection <Component> allComponents, IGraph graph, IModelItem element) { var componentId = allComponents.ToList().IndexOf(component); if (null == IncrementalElements) { return(colors[componentId % colors.Length]); } var currentColor = ((Tag)element.Tag).CurrentColor; if (affectedComponents.Contains(component)) { if (!color2AffectedComponent.ContainsKey(component)) { Color l; if (largestComponent == component && 1 != component.InducedEdges.Count) { l = GenerateMajorColor(component); } else { l = largestComponent == component && 1 == component.InducedEdges.Count ? HasValidColorTag(element) ? (Color)element.Tag : GenerateUniqueColor(graph, colors) : element is IEdge ? (IncrementalElements[((IEdge)element).GetSourceNode()] && IncrementalElements[((IEdge)element).GetTargetNode()]) ? GenerateUniqueColor(graph, colors) : !EdgeRemoved && element.Tag is Tag && currentColor.HasValue ? currentColor.Value : GenerateUniqueColor(graph, colors) : !EdgeRemoved && element.Tag is Tag && currentColor.HasValue ? currentColor.Value : GenerateUniqueColor(graph, colors); } color2AffectedComponent[component] = l; } return(color2AffectedComponent[component]); } return(currentColor.Value); }
public TagUndoUnit(string undoName, string redoName, object oldTag, object newTag, IModelItem item) : base(undoName, redoName) { this.oldTag = oldTag; this.newTag = newTag; this.item = item; }
/// <summary> /// Creates the component in the graph after it has been dropped. /// </summary> /// <remarks>This method is called by the <see cref="ItemDropInputMode{T}.ItemCreator"/> that /// is set as default on this class.</remarks> /// <param name="context">The context for which the component should be created.</param> /// <param name="graph">The <see cref="IGraph">Graph</see> in which to create the component.</param> /// <param name="draggedGraph">The component that was dragged and should therefore be created. /// The nodes and edges of the component will be copied into the <paramref name="graph"/>.</param> /// <param name="dropTarget">The <see cref="IModelItem"/> on which the component is dropped. This is ignored here.</param> /// <param name="dropLocation">The location where the component has been dropped.</param> /// <returns>A newly created component.</returns> private IGraph CreateComponent(IInputModeContext context, IGraph graph, IGraph draggedGraph, IModelItem dropTarget, PointD dropLocation) { // move the component to the drop location var delta = dropLocation - GetCenter(draggedGraph); Move(draggedGraph, delta); // create the component and collect the dropped nodes var droppedNodes = new HashSet <INode>(); new GraphCopier().Copy(draggedGraph, item => true, graph, PointD.Origin, (original, copy) => { var node = copy as INode; if (node != null) { droppedNodes.Add(node); } }); // return the dropped component return(new FilteredGraphWrapper(graph, droppedNodes.Contains)); }
/// <summary> /// Calls <see cref="ISnapLineProvider.AddSnapLines"/> of the wrapped provider and adds custom <see cref="OrthogonalSnapLine"/>s /// for the <paramref name="item"/>. /// </summary> /// <param name="context">The context which holds the settings for the snap lines. </param> /// <param name="args">The argument to use for adding snap lines.</param> /// <param name="item">The item to add snaplines for.</param> public void AddSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, IModelItem item) { wrapped.AddSnapLines(context, args, item); // add snaplines for orthogonal labels ILabelOwner labelOwner = item as ILabelOwner; if (labelOwner != null) { foreach (ILabel label in labelOwner.Labels) { var layout = label.GetLayout(); double upX = Math.Round(layout.UpX, 6); // round UpX to it's first 6 digits if (upX == 0 || upX == 1 || upX == -1) // check if it's orthogonal // label is orthogonal { RectD bounds = layout.GetBounds(); // add snaplines to the top, bottom, left and right border of the label PointD topCenter = bounds.TopLeft + new PointD(layout.Width / 2, 0); var snapLine = new OrthogonalSnapLine(SnapLineOrientation.Horizontal, SnapLineSnapTypes.Bottom, SnapLine.SnapLineFixedLineKey, topCenter, bounds.MinX - 10, bounds.MaxX + 10, label, 100); args.AddAdditionalSnapLine(snapLine); PointD bottomCenter = bounds.BottomLeft + new PointD(layout.Width / 2, 0); snapLine = new OrthogonalSnapLine(SnapLineOrientation.Horizontal, SnapLineSnapTypes.Top, SnapLine.SnapLineFixedLineKey, bottomCenter, bounds.MinX - 10, bounds.MaxX + 10, label, 100); args.AddAdditionalSnapLine(snapLine); PointD leftCenter = bounds.TopLeft + new PointD(0, layout.Height / 2); snapLine = new OrthogonalSnapLine(SnapLineOrientation.Vertical, SnapLineSnapTypes.Right, SnapLine.SnapLineFixedLineKey, leftCenter, bounds.MinY - 10, bounds.MaxY + 10, label, 100); args.AddAdditionalSnapLine(snapLine); PointD rightCenter = bounds.TopRight + new PointD(0, layout.Height / 2); snapLine = new OrthogonalSnapLine(SnapLineOrientation.Vertical, SnapLineSnapTypes.Left, SnapLine.SnapLineFixedLineKey, rightCenter, bounds.MinY - 10, bounds.MaxY + 10, label, 100); args.AddAdditionalSnapLine(snapLine); } } } }
private void WarnInternal(string message, IModelItem item) { _outputLog.Warn(FormatLogMessage(message)); AttachMessage(message, BuildMessageType.Warning, item); }
public object Cut(IGraphClipboardContext context, IModelItem item) { // We do the same for Cut, since it's essentially just a Copy and Delete in succession. return(Copy(context, item)); }
public void Warn(IModelItem item, string message, params object[] args) { WarnInternal(string.Format(message, args), item); }
protected void fc(string prefix, IModelItem item) { }
/// <summary> /// Check whether the specified model item has been selected in the underlying /// IGraph. /// </summary> private static bool IsSelected(ISelectionModel <IModelItem> selectionModel, IModelItem item) { return(selectionModel != null && selectionModel.IsSelected(item)); }
public MarketplaceReportAConcernCommand(IModelItem owner) : base(owner) { }