Inheritance: System.Web.UI.Page
Example #1
0
 public static async void PostFavoriteAsync(this PixivClient _, Illustration illustration)
 {
     illustration.IsLiked = true;
     await HttpClientFactory.AppApiService().AddBookmark(new AddBookmarkRequest {
         Id = illustration.Id
     });
 }
        public static async void SeedIllustrations(ApplicationDbContext db, ILogger log)
        {
            var i = db.Illustrations.FirstOrDefault();

            if (i == null)
            {
                log.LogInformation("Seeding Illustration Music");
                var illustrations = new List <Illustration>();

                i = new Illustration()
                {
                    Year        = DateTime.Now.Year,
                    Month       = DateTime.Now.Month,
                    Name        = "Lady in the Snow",
                    Description = "Young lady walking in the snow \nWe wonder how long she has to go \nAnd why she might be on this road.",
                    ImageUrl    = "Graphics/lady.jpg"
                };
                illustrations.Add(i);

                i = new Illustration()
                {
                    Year        = DateTime.Now.Year,
                    Month       = DateTime.Now.Month,
                    Name        = "Travel my friend",
                    Description = "Grap your guide and further yo must go\nuntil you don't feel the grasp of the wild take hold\nThen you can se yourself become strong.",
                    ImageUrl    = "/Graphics/destination.jpg"
                };
                illustrations.Add(i);

                db.Illustrations.AddRange(illustrations);
                await db.SaveChangesAsync();
            }
        }
Example #3
0
        /// <summary>
        /// Иллюстратор добавляет иллюстрации к уже написанным страницам книги
        /// </summary>
        /// <param name="book"></param>
        public override void MakeBook(IBook book)
        {
            Illustration illustration = new Illustration((uint)Random.Next(5, checked ((int)book.Text.PagesNum)));

            book.Illustrations.Add(illustration);
            Console.WriteLine($"Иллюстрация на {illustration.Page} страницe");
        }
Example #4
0
        public static string FormatDownloadPath(string pathWithMacro, Illustration illustration)
        {
            const char Separator = '\\';

            if (!pathWithMacro.EndsWith(Macros.MacroIllustExt))
            {
                pathWithMacro += $"{(pathWithMacro.EndsWith(".") ? string.Empty : ".")}{Macros.MacroIllustExt}";
            }
            var segments = pathWithMacro.Split(Separator, StringSplitOptions.RemoveEmptyEntries);

            // the directory and filesystem will behaves weird once removed the Select(p => p.Trim()) call, if the directory contains trailing
            // spaces, it will be separated into two directories in File Explorer, one with trailing spaces preserved, and one not, but they're
            // actually the same directory, if you deleted one of them, the other one will unable to be deleted
            return(Path.Combine(segments.Select(ReplaceMacro).Select(p => p.Trim()).Where(p => !p.IsNullOrEmpty()).ToArray()));


            string ReplaceMacro(string s)
            {
                const string Replacement = "$1";

                s = illustration switch
                {
                    { IsManga : true } => s.RegexReplace(Macros.MacroConditionIfManga, Replacement)
                    .RegexReplace(Macros.MacroConditionIfNotManga, string.Empty)
                    .RegexReplace(Macros.MacroConditionIfIllust, string.Empty)
                    .RegexReplace(Macros.MacroConditionIfNotIllust, Replacement)
                    .RegexReplace(Macros.MacroConditionIfUgoira, string.Empty)
                    .RegexReplace(Macros.MacroConditionIfNotUgoira, Replacement),
                    { IsUgoira : true } => s.RegexReplace(Macros.MacroConditionIfManga, string.Empty)
Example #5
0
 public static async void PostFavoriteAsync(this PixivClient _, Illustration illustration, RestrictPolicy restrictPolicy)
 {
     illustration.IsLiked = true;
     await HttpClientFactory.AppApiService().AddBookmark(new AddBookmarkRequest {
         Id = illustration.Id, Restrict = restrictPolicy == RestrictPolicy.Public ? "public" : "private"
     });
 }
Example #6
0
 public IllustPresenter(Illustration illustration)
 {
     Illust = illustration;
     InitializeComponent();
     LoadThumbnail();
     LoadOrigin();
 }
        /// <summary>
        /// Deep load all Illustration children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.IllustrationProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.IllustrationProvider.DeepLoading += new EntityProviderBaseCore <Illustration, IllustrationKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.IllustrationProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("Illustration instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.IllustrationProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
Example #8
0
        public async Task <IllustrationDTO> UpdateAsync(IllustrationDTO objet)
        {
            Illustration entite = MapIllustration.ToEntity(objet, false);
            var          lRet   = await _repo.UpdateAsync(entite);

            return(MapIllustrationDTO.MapDataToDTO(lRet));
        }
 public override void InsertionPolicy(Illustration item, IList <Illustration> collection)
 {
     if (item != null)
     {
         collection.AddSorted(item, IllustrationPublishDateComparator.Instance);
     }
 }
Example #10
0
 public static async Task LoadAndCacheThumbnailImageToControl(this Illustration illustration, object control)
 {
     if (Settings.Global.UseCache &&
         await AppContext.DefaultCacheProvider.TryGet(illustration) is (true, var image))
     {
         SetImageSource(control, image);
     }
 public static void EnqueueDownloadItem(Illustration illustration, DownloadOption option = null)
 {
     if (Downloading.Any(i => illustration.Id == i.DownloadContent.Id))
     {
         return;
     }
     option ??= new DownloadOption();
Example #12
0
    IEnumerator updateView()
    {
        //pnlLoading.SetActive(true);
        foreach (Transform obj in Container.transform)
        {
            GameObject.Destroy(obj.gameObject);
        }

        if (Cards == null)
        {
            Cards = GameObject.Find("CARD").GetComponent <Illustration>();
        }
        foreach (Card c in Cards.cards)
        {
            if (check(c))
            {
                GameObject obj = GameObject.Instantiate(cardPreb);
                obj.GetComponent <cardGrid>().init(c);
                obj.GetComponent <Button>().onClick.AddListener(() => {
                    btnSelect_Click(obj.GetComponent <cardGrid>().card);
                });
                obj.transform.parent = Container.transform;
            }
        }

        yield return(null);
    }
Example #13
0
 public static async void RemoveFavoriteAsync(this PixivClient _, Illustration illustration)
 {
     illustration.IsLiked = false;
     await HttpClientFactory.AppApiService().DeleteBookmark(new DeleteBookmarkRequest {
         IllustId = illustration.Id
     });
 }
Example #14
0
        private string GetCopyToLocation(Illustration illustration, string path)
        {
            string directory = Path.GetDirectoryName(path);
            string illPath   = directory + "\\" + illustration.FileName;

            return(illPath);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Year,Month,Name,Description,ImageUrl")] Illustration illustration)
        {
            if (id != illustration.IllustrationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(illustration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IllustrationExists(illustration.IllustrationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(illustration));
        }
Example #16
0
            static DownloadableIllustration CreateDownloadableIllustration(Illustration downloadContent, bool isFromMange, int index = -1)
            {
                var model = new DownloadableIllustration(downloadContent, isFromMange, index);

                model.DownloadStat.ValueChanged += (sender, args) => Application.Current.Dispatcher.Invoke(() =>
                {
                    switch (args.NewValue)
                    {
                    case DownloadStatEnum.Finished:
                        model.Freeze();
                        Downloading.Remove(model);
                        if (Downloaded.All(i => model.DownloadContent.GetDownloadUrl() != i.DownloadContent.GetDownloadUrl()))
                        {
                            Downloaded.Add(model);
                        }
                        break;

                    case DownloadStatEnum.Downloading:
                        Downloaded.Remove(model);
                        Downloading.Add(model);
                        break;

                    case var stat when stat == DownloadStatEnum.Canceled || stat == DownloadStatEnum.Queue || stat == DownloadStatEnum.Exceptional:
                        if (stat == DownloadStatEnum.Canceled)
                        {
                            Downloading.Remove(model);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                });
                return(model);
            }
Example #17
0
        private async Task <DownloadedImage> DownloadToMemoryAsync(Illustration illust, string referer, int pageNumber, int?maxBytes = null)
        {
            #region Commented Ugoira code
            //if (illust.IllustType == 2) {
            //  //https://www.pixiv.net/ajax/illust/{id}/ugoira_meta
            //  string ext = Path.GetExtension(illust.Urls.Original);
            //  string pathUgoira = illust.Urls.Original.Replace("img-original", "img-zip-ugoira").Replace($"_ugoira0{ext}", "_ugoira1920x1080.zip");
            //  Task t = new Task(() => action(Path.GetFileName(pathUgoira), 0, DownloadToMemory(pathUgoira, workUrl)));
            //}
            #endregion

            string url        = illust.Urls.Original.Replace("_p0", $"_p{pageNumber}");
            bool   isOriginal = true;
            var    message    = CreatePixivRequestMessage(url, referer);
            var    response   = await HttpClient.SendAsync(message, HttpCompletionOption.ResponseHeadersRead);

            if (maxBytes.HasValue && response.Content.Headers.ContentLength > maxBytes)
            {
                response.Dispose();
                url      = illust.Urls.Regular.Replace("_p0", $"_p{pageNumber}");
                message  = CreatePixivRequestMessage(url, referer);
                response = await HttpClient.SendAsync(message);

                isOriginal = false;
            }
            string fileName = Path.GetFileName(url);
            var    stream   = await response.Content.ReadAsStreamAsync();

            return(new DownloadedImage(fileName, pageNumber, stream, isOriginal));
        }
Example #18
0
        internal static Illustration ToEntity(IllustrationDTO objet, bool creation)
        {
            Illustration rtn = new Illustration();

            if (null != objet)
            {
                rtn.ArticleId   = objet.ArticleId;
                rtn.Description = objet.Description;
                rtn.Url         = objet.Url;


                if (creation)
                {
                    rtn.IsDeleted        = false;
                    rtn.DateCreation     = DateTime.Now;
                    rtn.DateModification = DateTime.Now;
                }
                else
                {
                    rtn.Id               = objet.Id;
                    rtn.IsDeleted        = objet.IsDeleted;
                    rtn.DateCreation     = objet.DateCreation;
                    rtn.DateModification = objet.DateModification;
                }
            }
            return(rtn);
        }
Example #19
0
 public override void LoadFromXml(SecurityElement element)
 {
     if ((element.Tag == "IllustrationConfig") && (element.Children != null))
     {
         foreach (SecurityElement element2 in element.Children)
         {
             if (element2.Tag == "Illustration")
             {
                 Illustration item = new Illustration {
                     Id        = StrParser.ParseHexInt(element2.Attribute("Id"), 0),
                     SortIndex = StrParser.ParseDecInt(element2.Attribute("SortIndex"), 0)
                 };
                 foreach (SecurityElement element3 in element2.Children)
                 {
                     if (element3.Tag == "Cost")
                     {
                         Cost cost = new Cost {
                             id    = StrParser.ParseHexInt(element3.Attribute("Id"), 0),
                             count = StrParser.ParseDecInt(element3.Attribute("Count"), 0)
                         };
                         item.Cost.Add(cost);
                     }
                     if (element3.Tag == "Fragment")
                     {
                         item.FragmentId    = StrParser.ParseHexInt(element3.Attribute("Id"), 0);
                         item.FragmentCount = StrParser.ParseDecInt(element3.Attribute("Count"), 0);
                     }
                 }
                 this._illustrations.Add(item);
             }
         }
     }
 }
Example #20
0
        public async void OpenIllustBrowser(Illustration illustration, bool record = true)
        {
            if (!illustration.FromSpotlight && record)
            {
                PixivHelper.RecordTimelineInternal(new BrowsingHistory
                {
                    BrowseObjectId        = illustration.Id,
                    BrowseObjectState     = illustration.Title,
                    BrowseObjectThumbnail = illustration.Thumbnail,
                    IllustratorName       = illustration.UserName,
                    IsReferToIllust       = true,
                    Type = "illust"
                });
            }

            IllustBrowserDialogHost.DataContext = illustration;
            await Task.Delay(100);

            IllustBrowserDialogHost.OpenControl();
            var userInfo = await HttpClientFactory.AppApiService()
                           .GetUserInformation(new UserInformationRequest {
                Id = illustration.UserId
            });

            if (await PixivIO.FromUrl(userInfo.UserEntity.ProfileImageUrls.Medium) is { } avatar)
            {
                SetImageSource(IllustBrowserUserAvatar, avatar);
            }
        }
        public async Task <Illustration> UpdateAsync(Illustration objet)
        {
            _context.Entry(await _context.Illustration.FirstOrDefaultAsync(x => x.Id == objet.Id)).CurrentValues.SetValues(objet);
            await _context.SaveChangesAsync();

            return(objet);
        }
        public async Task <Illustration> CreateAsync(Illustration objet)
        {
            using (var db = _context)
            {
                var strategy = db.Database.CreateExecutionStrategy();
                strategy.Execute(() =>
                {
                    using (var context = _context)
                    {
                        //BeginTransaction
                        using (var transaction = context.Database.BeginTransaction())
                        {
                            try
                            {
                                //Insert Amende
                                context.Illustration.Add(objet);
                                context.SaveChanges();

                                //End Transaction
                                transaction.Commit();
                            }
                            catch (Exception ex)
                            {
                                _logger.WriteError(new LogItem()
                                {
                                    Exception = ex, Message = ex.Message, Layer = "Repository"
                                });
                                transaction.Rollback();
                            }
                        }
                    }
                });
            }
            return(objet);
        }
Example #23
0
        private XElement GetManifestDependencyElement(Illustration illustration)
        {
            XNamespace ns = ManifestModifier.Namespace;

            return(new XElement(ns + "dependency",
                                new XAttribute("identifierref", illustration.Identifier)));
        }
Example #24
0
        private static DownloadableIllustration CreateDownloadableIllustration(Illustration downloadContent, string downloadPath)
        {
            var model = new DownloadableIllustration(downloadContent, downloadPath ?? DownloadPathMacros.FormatDownloadPath(Settings.Global.DownloadPath, downloadContent));

            model.State.ValueChanged += (sender, args) => Application.Current.Dispatcher.Invoke(() =>
            {
                switch (args.NewValue)
                {
                case DownloadState.Finished:
                    model.Freeze();
                    Downloading.Remove(model);
                    if (Downloaded.All(i => model.DownloadContent.GetDownloadUrl() != i.DownloadContent.GetDownloadUrl()))
                    {
                        Downloaded.Add(model);
                    }
                    break;

                case DownloadState.Downloading:
                    Downloaded.Remove(model);
                    Downloading.Add(model);
                    break;

                case DownloadState.Canceled:
                    Downloading.Remove(model);
                    break;

                case DownloadState.Queue:
                case DownloadState.Exceptional:
                    break;

                default: throw new ArgumentOutOfRangeException();
                }
            });
            return(model);
        }
Example #25
0
        /// <summary>
        /// Helper for AddIllustrationToKeywordListItem
        /// Adds illustration to KeywordListItem given a keyword
        /// </summary>
        /// <param name="illustration"></param>
        /// <param name="keyword"></param>
        /// <param name="KeywordListItemId"></param>
        private void AddIllustration(Illustration illustration, XElement keyword, string KeywordListItemId)
        {
            IEnumerable <XElement> existingHtmlElt = keyword.ElementsOrException("html")
                                                     .Where(x => x.GetAttribute("listType") == "illustration" &&
                                                            x.GetAttribute("listCode") == "TDS_WL_Illustration");

            if (existingHtmlElt != null && existingHtmlElt.Count() > 0)
            {
                string msg = string.Format("In item {0}: Overwriting illustration <html> tag under keyword {1}",
                                           KeywordListItemId, illustration.Term);
                errors.Add(new Error(Error.Exception.OverwriteWarning, msg, illustration.LineNumber, Error.Type.Warning));
                existingHtmlElt.Remove();
            }

            string textAttribute = keyword.GetAttribute("text");

            if (textAttribute.ToLower() != illustration.Term.ToLower())
            {
                string msg = string.Format("In item {0}: Matched illustration term \"{1}\" to keyword \"{2}\"",
                                           KeywordListItemId, illustration.Term, textAttribute);
                errors.Add(new Error(Error.Exception.KeywordNotExactMatchWarning, msg, illustration.LineNumber, Error.Type.Warning));
            }

            keyword.Add(GetHtmlXElementForFile(illustration.FileName, illustration.Width, illustration.Height));
        }
Example #26
0
 /// <summary>
 /// Gets the full keyword xml if the keyword is not already in the keywordlist
 /// </summary>
 /// <param name="illustration"></param>
 /// <param name="maxIndex"></param>
 /// <returns></returns>
 private XElement GetKeywordXElementForFile(Illustration illustration)
 {
     return(new XElement("keyword",
                         new XAttribute("text", illustration.Term),
                         new XAttribute("index", illustration.Index.ToString()),
                         GetHtmlXElementForFile(illustration.FileName, illustration.Width, illustration.Height)));
 }
Example #27
0
        public static float GetFuel(Illustration illustration)
        {
            switch (illustration)
            {
            case Illustration.Ash:
            case Illustration.Evac:
                return(1000);

            case Illustration.Rock:
            case Illustration.Sidewalk:
            case Illustration.BrownBrick:
            case Illustration.BrownDoor:
                return(25);

            case Illustration.Weed:
            case Illustration.AutumnTree:
            case Illustration.Grass:
            case Illustration.Grass2:
            case Illustration.Grass3:
            case Illustration.Bush:
                return(20);

            case Illustration.Cobweb:
                return(2);

            default:
                return(5);
            }
        }
Example #28
0
        public static float GetFuelConsumptionPerSecond(Illustration illustration)
        {
            switch (illustration)
            {
            case Illustration.Ash:
            case Illustration.Evac:
                return(0);

            case Illustration.Rock:
            case Illustration.Sidewalk:
            case Illustration.BrownBrick:
            case Illustration.BrownDoor:
                return(0.5f);

            case Illustration.Weed:
            case Illustration.AutumnTree:
            case Illustration.Grass:
            case Illustration.Grass2:
            case Illustration.Grass3:
            case Illustration.Bush:
                return(3);

            case Illustration.Cobweb:
                return(10);

            default:
                return(2);
            }
        }
        /// <summary>
        /// Parses the svg item for the natural width and height and calculates the max dimensions for the html tag
        /// image. The image is scaled using the DefaultPixelSize in the project settings.
        /// </summary>
        /// <param name="illustration"></param>
        /// <param name="count"></param>
        private void SetIllustrationSize(Illustration illustration, int count)
        {
            try
            {
                XDocument illustrationFile = XDocument.Load(illustration.OriginalFilePath);
                XElement  node             = illustrationFile.Root;
                string    size             = node.Attribute("viewBox").Value;
                string[]  sizeValues       = size.Split(' ');
                double    maxPixels        = Properties.Settings.Default.DefaultPixelSize;

                if (sizeValues.Count() == 4)
                {
                    double width  = Convert.ToDouble(sizeValues[2]);
                    double height = Convert.ToDouble(sizeValues[3]);
                    double ratio  = maxPixels / Math.Max(width, height);
                    width  = Math.Round(width * ratio, 2);
                    height = Math.Round(height * ratio, 2);

                    illustration.Width  = Convert.ToString(width);
                    illustration.Height = Convert.ToString(height);
                }
                else
                {
                    errors.Add(new Error(Error.Exception.IllustrationSize, illustration.OriginalFilePath + " has no size value", count));
                }
            }
            catch
            {
                errors.Add(new Error(Error.Exception.IllustrationSize, illustration.OriginalFilePath + " does not exist", count));
            }
        }
        ///<summary>
        ///  Returns a Typed ProductModelIllustration Entity with mock values.
        ///</summary>
        static public ProductModelIllustration CreateMockInstance_Generated(TransactionManager tm)
        {
            ProductModelIllustration mock = new ProductModelIllustration();

            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Illustration mockIllustrationByIllustrationId = IllustrationTest.CreateMockInstance(tm);

            DataRepository.IllustrationProvider.Insert(tm, mockIllustrationByIllustrationId);
            mock.IllustrationId = mockIllustrationByIllustrationId.IllustrationId;
            //OneToOneRelationship
            ProductModel mockProductModelByProductModelId = ProductModelTest.CreateMockInstance(tm);

            DataRepository.ProductModelProvider.Insert(tm, mockProductModelByProductModelId);
            mock.ProductModelId = mockProductModelByProductModelId.ProductModelId;

            // create a temporary collection and add the item to it
            TList <ProductModelIllustration> tempMockCollection = new TList <ProductModelIllustration>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((ProductModelIllustration)mock);
        }
        // PUT api/awbuildversion/5
        public void Put(Illustration value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.IllustrationDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.IllustrationUpdate(value);
            }
        }
 // POST api/awbuildversion
 public void Post(Illustration value)
 {
     adventureWorks_BC.IllustrationAdd(value);
 }
 /// <summary>
 /// Create a new Illustration object.
 /// </summary>
 /// <param name="illustrationID">Initial value of IllustrationID.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static Illustration CreateIllustration(int illustrationID, global::System.DateTime modifiedDate)
 {
     Illustration illustration = new Illustration();
     illustration.IllustrationID = illustrationID;
     illustration.ModifiedDate = modifiedDate;
     return illustration;
 }
Example #34
0
        /// <summary>
        /// Add a title page to the EPUB
        /// </summary>
        /// <param name="imageLocation"></param>
        /// <param name="imageName"></param>
        private void AddTitlePage(String imageLocation, String imageName)
        {
            String body = File.ReadAllText(Path.Combine(supportDir, "title.xml"));

            // Replace the placeholders in the template with the EPUB values
            body = body.Replace("{TITLE}", tbxTitle.Text);
            body = body.Replace("{AUTHOR}", tbxAuthor.Text);
            body = body.Replace("{PUBLISHDATE}", tbxOrigPublishDate.Text);
            body = body.Replace("{SUBJECT}", tbxSubject.Text);
            body = body.Replace("{SOURCE}", tbxSource.Text);

            if (treeImages.Nodes.Count > 0)
                body = body.Replace("{COVERIMAGE}", ((Illustration)treeImages.Nodes[0].Tag).name);
            else
                body = body.Replace("{COVERIMAGE}", imageName);

            // Add the chapter to the chapter tree
            TreeNode node = new TreeNode();
            Chapter chapter = new Chapter();
            chapter.chapterName = "Title Page";
            chapter.chapterTitle = "Title Page";
            chapter.id = "titlepage";
            chapter.html = body.Replace("\n", "\r\n");
            chapter.rawText = "N/A";
            node.Tag = chapter;
            node.Text = "Title Page";
            node.Name = "t0";
            treeChapters.Nodes.Insert(0, node);

            // Add the image to the image tree
            node = new TreeNode();
            Illustration image = new Illustration();
            image.location = imageLocation;
            image.name = imageName;
            image.useAsCover = true;
            node.Tag = image;
            node.Text = "Cover Image";
            node.Name = "t0";
            treeImages.Nodes.Insert(0, node);
            treeImages.SelectedNode = treeImages.Nodes[0];
            treeChapters.SelectedNode = treeChapters.Nodes[0];

            foreach (TreeNode tnode in treeImages.Nodes)
            {
                if (!tnode.Equals(treeImages.Nodes[0]))
                {
                    image = (Illustration)tnode.Tag;
                    image.useAsCover = false;
                    tnode.Tag = image;
                }
            }
        }
Example #35
0
 /// <summary>
 /// Add an image and update the UI
 /// </summary>
 /// <param name="ImageFileName"></param>
 /// <param name="ImageName"></param>
 private void AddImage(String ImageFileName, String ImageName)
 {
     // Get a new tree node and create an Illustration to attach
     TreeNode node = new TreeNode();
     Illustration image = new Illustration();
     image.location = ImageFileName;
     image.name = ImageName;
     image.useAsCover = false;
     node.Tag = image;
     node.Text = ImageName;
     node.Name = treeImages.Nodes.Count.ToString();
     treeImages.Nodes.Add(node);
     treeImages.SelectedNode = treeImages.Nodes[0];
 }
 /// <summary>
 /// There are no comments for Illustration in the schema.
 /// </summary>
 public void AddToIllustration(Illustration illustration)
 {
     base.AddObject("Illustration", illustration);
 }