コード例 #1
0
        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);
            //};
        }
コード例 #2
0
        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);
            };
        }
コード例 #3
0
        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);
            };
        }
コード例 #4
0
        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);
            };
        }
コード例 #5
0
        public TrailerGenreItem(IModelItem owner)
            : base(owner)
        {
            this.trailers = new List<TrailerItem>();

            this.Invoked += delegate(object sender, EventArgs args)
            {
                //this.PlayMedia();
            };
        }
コード例 #6
0
 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);
 }
コード例 #7
0
        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 { }
        }
コード例 #8
0
        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);
            };
        }
コード例 #9
0
 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);
         }
     }
 }
コード例 #10
0
        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);
            };
        }
コード例 #11
0
        /// <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);
                }
            }
        }
コード例 #12
0
        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);
                }
            }
        }
コード例 #13
0
 /// <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);
 }
コード例 #14
0
 public DiscCommand(IModelItem Owner)
     : base(Owner)
 {
     this.load = new Command(this);
     this.load.Invoked += new EventHandler(load_Invoked);
 }
コード例 #15
0
 /// <summary>
 /// Returns whether or not to cutting the given item is possible.
 /// </summary>
 public bool ShouldCut(IGraphClipboardContext context, IModelItem item)
 {
     return(true);
 }
コード例 #16
0
 public object GetSourceObject([NotNull] IModelItem item)
 {
     return(item.Tag);
 }
コード例 #17
0
 public ProgressCommand(IModelItem owner)
     : base(owner)
 {
 }
コード例 #18
0
ファイル: DataContext.cs プロジェクト: Natsui31/keyhub
        /// <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);
            }
        }
コード例 #19
0
 public IEnumerable <BusinessRuleValidationResult> ExecuteBusinessResult(IModelItem entity, DbEntityEntry entityEntry)
 {
     return(businessRules.Where(x => Reflection.GetGenericParameters(x).Contains(entity.GetType()))
            .SelectMany(businessRule => businessRule.Validate(entity, entityEntry)));
 }
コード例 #20
0
 static bool HasValidColorTag(IModelItem element)
 {
     return(element.Tag is Color);
 }
コード例 #21
0
 private void ErrorInternal(string message, IModelItem item)
 {
     _outputLog.Error(FormatLogMessage(message));
     AttachMessage(message, BuildMessageType.Error, item);
 }
コード例 #22
0
        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);
            };
        }
コード例 #23
0
ファイル: BusinessRule.cs プロジェクト: webkeg/keyhub
 /// <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));
 }
コード例 #24
0
 public void HideModelItem(IModelItem modelItem) => HideModelItems(new[] { modelItem });
コード例 #25
0
 public IDiagramShape ShowModelItem(IModelItem modelItem) => ShowModelItems(new[] { modelItem }).FirstOrDefault();
コード例 #26
0
        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);
            };
        }
コード例 #27
0
 /// <summary>
 /// Adds no additional state to the cut-operation.
 /// </summary>
 public object Cut(IGraphClipboardContext context, IModelItem item)
 {
     return(null);
 }
コード例 #28
0
 public void Error(IModelItem item, string message, params object[] args)
 {
     ErrorInternal(string.Format(message, args), item);
 }
コード例 #29
0
 public override IPersistentObject GetAsPersistentObject(IModelItem item)
 {
     return MigrationReportPersistentAdapter.GetPersistentObject((MigrationReport) item);
 }
コード例 #30
0
 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)));
 }
コード例 #31
0
 public object GetSourceObject([NotNull] IModelItem item)
 {
     return(graphBuilder.GetSourceObject(item));
 }
コード例 #32
0
 public MarketplaceReportFavouriteArtistsCommand(IModelItem owner)
     : base(owner)
 {
 }
コード例 #33
0
        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);
                }
            };
        }
コード例 #34
0
 public DiscCommand(IModelItem Owner)
     : base(Owner)
 {
     this.load          = new Command(this);
     this.load.Invoked += new EventHandler(load_Invoked);
 }
コード例 #35
0
 public IEnumerable<BusinessRuleValidationResult> ExecuteBusinessResult(IModelItem entity, DbEntityEntry entityEntry)
 {
     return businessRules.Where(x => Reflection.GetGenericParameters(x).Contains(entity.GetType()))
                         .SelectMany(businessRule => businessRule.Validate(entity, entityEntry));
 }
コード例 #36
0
 private void LogError(IModelItem item, string text, params object[] args)
 {
     if (_context != null && _context.Log != null)
     {
         _context.Log.Error(item, text, args);
     }
 }
コード例 #37
0
        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);
        }
コード例 #38
0
 public TagUndoUnit(string undoName, string redoName, object oldTag, object newTag, IModelItem item) : base(undoName, redoName)
 {
     this.oldTag = oldTag;
     this.newTag = newTag;
     this.item   = item;
 }
コード例 #39
0
        /// <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));
        }
コード例 #40
0
        /// <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);
                    }
                }
            }
        }
コード例 #41
0
 private void WarnInternal(string message, IModelItem item)
 {
     _outputLog.Warn(FormatLogMessage(message));
     AttachMessage(message, BuildMessageType.Warning, item);
 }
コード例 #42
0
 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));
 }
コード例 #43
0
 public void Warn(IModelItem item, string message, params object[] args)
 {
     WarnInternal(string.Format(message, args), item);
 }
コード例 #44
0
 protected void fc(string prefix, IModelItem item)
 {
 }
コード例 #45
0
 /// <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));
 }
コード例 #46
0
 public MarketplaceReportAConcernCommand(IModelItem owner)
     : base(owner)
 {
 }