Exemple #1
0
        static void RunContentTB1()
        {
            System.Threading.Thread.CurrentThread.Name = "Nadesico API";
            application = new Application();

            var buildAssemblyType = new BuildAssemblyParameter();

            buildAssemblyType.Params["ApplicationDirectoryPath"] = @"\Nadesico_InvokeServiceConsole";

            ApplicationContext.SetupApplicationContextImpl(ApplicationContextImpl.CreateInstance(application, buildAssemblyType));
            ((ApplicationContextImpl)ApplicationContextImpl.GetInstance()).InitializeApplication();

            using (var dbc = new AppDbContext())
            {
                var content = new ContentImage();
                content.IdentifyKey         = "aaaa";
                content.Title               = "コンテントテストA";
                content.ArchiveFlag         = true;
                content.ReadableFlag        = true;
                content.Starrating          = 3;
                content.UnsetStarratingFlag = false;

                var repoContent = new ContentImageRepository(dbc);
                repoContent.Add(content);

                dbc.SaveChanges();
            }

            Console.WriteLine("永続化が完了しました。");
        }
Exemple #2
0
        // GET: Admin/ContentImage/Edit/<ModuleID>
        public ActionResult Edit(Guid id)
        {
            ContentImage   img            = new ContentImage(id);
            ImageViewModel imageViewModel = new ImageViewModel(img);

            return(View(imageViewModel));
        }
Exemple #3
0
        public string EditContentImage(ContentImageDto contentImage)
        {
            if (ContentImageExists(contentImage.ContentImageId))
            {
                string imagePath = null;
                if (contentImage.File != null)
                {
                    imagePath = _imgService.EditImage(contentImage.File, contentImage.OldImage);
                }
                ContentImage contentImageToEdit = _ctx.ContentImages.Where(cI => cI.ContentImageId == contentImage.ContentImageId)
                                                  .Select(cI => new ContentImage
                {
                    Description     = contentImage.Description ?? cI.Description,
                    ExtraData       = contentImage.ExtraData ?? cI.ExtraData,
                    CarImagePath    = imagePath ?? cI.CarImagePath,
                    ContentImageId  = cI.ContentImageId,
                    ContentForTabId = contentImage.ContentForTabId
                }).SingleOrDefault();
                try
                {
                    _ctx.ContentImages.Update(contentImageToEdit);
                    _ctx.SaveChanges();
                }
                catch (DbUpdateException ex)
                {
                    _logger.LogInformation($"Could not update file because of {ex.Message}");
                }

                return(imagePath);
            }
            return(null);
        }
Exemple #4
0
        public bool AddContentImage(ContentImageDto contentImage)
        {
            if (contentImage.File != null && !string.IsNullOrEmpty(contentImage.Description))
            {
                string path = _imgService.CreateImage(contentImage.File);
                if (!string.IsNullOrEmpty(path))
                {
                    ContentImage content = new ContentImage
                    {
                        CarImagePath    = path,
                        Description     = contentImage.Description,
                        ExtraData       = contentImage.ExtraData,
                        ContentForTabId = contentImage.ContentForTabId
                    };

                    try
                    {
                        _ctx.ContentImages.Add(content);
                        _ctx.SaveChanges();
                        return(true);
                    }
                    catch (DbUpdateException ex)
                    {
                        _logger.LogInformation($"Cannot add image {ex.Message}");
                    }
                }
            }
            return(false);
        }
Exemple #5
0
        private async void UpdateContentInfo()
        {
            ++_pendingUpdatesCount;
            await Task.Delay(TimeSpan.FromSeconds(1));

            --_pendingUpdatesCount;
            if (_pendingUpdatesCount > 0 || FocusedContent == null)
            {
                return;
            }

            ContentTitle.Text = (FocusedContent as DetailContentData)?.Title;
            ContentDesc.Text  = (FocusedContent as DetailContentData)?.Description;

            _backgroundBitmap?.Release();
            _backgroundBitmap = null;
            if (_contentGridController.FocusedItem != null)
            {
                _backgroundBitmap = await _skBitmapCache.GetBitmap(_contentGridController.FocusedItem.ContentImg);
            }

            ContentImage.InvalidateSurface();
            ContentImage.Opacity = 0;
            ContentImage.AbortAnimation("FadeTo");
            await ContentImage.FadeTo(0.75);
        }
Exemple #6
0
        protected async void UpdateContentInfo()
        {
            ContentTitle.Text = FocusedContent.ContentTitle;
            ContentDesc.Text  = FocusedContent.ContentDescription;

            ContentImage.Source  = ImageSource.FromFile(FocusedContent.ContentImg);
            ContentImage.Opacity = 0;
            await ContentImage.FadeTo(1, 1000);
        }
Exemple #7
0
        private async Task UpdateContentInfo()
        {
            var focusedContent = ContentListView.FocusedContent;

            ContentTitle.Text    = focusedContent.ContentTitle;
            ContentDesc.Text     = focusedContent.ContentDescription;
            ContentImage.Source  = ImageSource.FromStream(() => File.OpenRead(focusedContent.ContentImg));
            ContentImage.Opacity = 0;
            await ContentImage.FadeTo(1, 1000);
        }
Exemple #8
0
        public ActionResult Edit(ArticleViewModel articleViewModel, HttpPostedFileBase[] images)
        {
            if (ModelState.IsValid)
            {
                List <Tag> tags = null;

                if (!articleViewModel.Tags.IsEmpty() || articleViewModel.Tags != null)
                {
                    tags = articleViewModel.Tags.Replace(" ", string.Empty).Split(',').Select(t => new Tag
                    {
                        TagId = Guid.NewGuid(),
                        Name  = t
                    }).ToList();
                }

                var article = new Article
                {
                    ArticleId   = articleViewModel.ArticleId,
                    Name        = articleViewModel.Name,
                    Content     = articleViewModel.Content,
                    Description = articleViewModel.Description,
                    Tags        = tags,
                };

                var imageList = new List <ContentImage>(images.Length);

                if (images != null && images.Length > 0 && images.Any(i => i != null))
                {
                    foreach (var image in images)
                    {
                        var contentImage = new ContentImage
                        {
                            ArticleId     = article.ArticleId,
                            ImageMimeType = image.ContentType,
                            ImageData     = new byte[image.ContentLength]
                        };

                        image.InputStream.Read(contentImage.ImageData, 0, image.ContentLength);

                        imageList.Add(contentImage);
                    }
                }

                _repository.SaveArticle(article, imageList);

                TempData["message"] = string.Format("Изменения в статье {0} применены", article.Name);

                return(RedirectToAction("Index"));
            }

            return(View(articleViewModel));
        }
Exemple #9
0
 public ActionResult UpdateImage(ContentImage model, HttpPostedFileBase fuImage)
 {
     if (ModelState.IsValid)
     {
         int result = 0;
         result = ch.UpdateContentImage(model, fuImage);
         if (result > 0)
         {
             return(RedirectToAction("index", "content", new { area = "admin" }));
         }
     }
     return(PartialView("_PartialUpdateContentImage"));
 }
Exemple #10
0
        public ActionResult Edit(ImageViewModel imageViewModel)
        {
            try {
                if (ModelState.IsValid)
                {
                    ContentImage img = new ContentImage(imageViewModel.ModuleID);
                    img.SaveChanges(imageViewModel);
                }

                return(RedirectToAction("edit", "pages", new { id = imageViewModel.PageID }));
            } catch {
                return(View(imageViewModel));
            }
        }
        private async Task UpdateContentInfo()
        {
            var focusedContent = ContentListView.FocusedContent;

            ++_pendingUpdatesCount;
            await Task.Delay(TimeSpan.FromSeconds(1));

            --_pendingUpdatesCount;
            if (_pendingUpdatesCount > 0)
            {
                return;
            }

            ContentTitle.Text    = focusedContent.ContentTitle;
            ContentDesc.Text     = focusedContent.ContentDescription;
            ContentImage.Source  = ResourceFactory.Create(focusedContent.ContentImg).AbsolutePath;
            ContentImage.Opacity = 0;
            ContentImage.AbortAnimation("FadeTo");
            await ContentImage.FadeTo(1, 1000);
        }
Exemple #12
0
        public bool DeleteContentImage(ContentImage contentImage)
        {
            bool removed = false;

            if (ContentImageExists(contentImage.ContentImageId))
            {
                _imgService.DeleteImage(contentImage.CarImagePath);

                ContentImage contentImageToEdit = _ctx.ContentImages.Where(cI => cI.ContentImageId == contentImage.ContentImageId).SingleOrDefault();
                try
                {
                    _ctx.ContentImages.Remove(contentImageToEdit);
                    _ctx.SaveChanges();
                }
                catch (DbUpdateException ex)
                {
                    _logger.LogInformation($"Could not delete file because of {ex.Message}");
                }
            }
            return(removed);
        }
Exemple #13
0
        public IActionResult DeleteConfirmed(int id, ContentImage content)
        {
            if (id != content.ContentImageId)
            {
                return(NotFound());
            }
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Delete", new { id }));
            }
            try
            {
                _con.DeleteContentImage(content);
                // TODO: Add delete logic here

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Exemple #14
0
        void ReleaseDesignerOutlets()
        {
            if (Actor_Name != null)
            {
                Actor_Name.Dispose();
                Actor_Name = null;
            }

            if (Actor_NameHeight != null)
            {
                Actor_NameHeight.Dispose();
                Actor_NameHeight = null;
            }

            if (ActorImage != null)
            {
                ActorImage.Dispose();
                ActorImage = null;
            }

            if (BackgroundContentFriendJoined != null)
            {
                BackgroundContentFriendJoined.Dispose();
                BackgroundContentFriendJoined = null;
            }

            if (BackgroundProductSold != null)
            {
                BackgroundProductSold.Dispose();
                BackgroundProductSold = null;
            }

            if (btn_OtherUsers != null)
            {
                btn_OtherUsers.Dispose();
                btn_OtherUsers = null;
            }

            if (btnDotsTop != null)
            {
                btnDotsTop.Dispose();
                btnDotsTop = null;
            }

            if (btnOpenInvitedProfile != null)
            {
                btnOpenInvitedProfile.Dispose();
                btnOpenInvitedProfile = null;
            }

            if (ButtonFacebook != null)
            {
                ButtonFacebook.Dispose();
                ButtonFacebook = null;
            }

            if (ButtonInviteFriends != null)
            {
                ButtonInviteFriends.Dispose();
                ButtonInviteFriends = null;
            }

            if (ButtonProductSold != null)
            {
                ButtonProductSold.Dispose();
                ButtonProductSold = null;
            }

            if (ButtonRewardClaimed != null)
            {
                ButtonRewardClaimed.Dispose();
                ButtonRewardClaimed = null;
            }

            if (ButtonTwitter != null)
            {
                ButtonTwitter.Dispose();
                ButtonTwitter = null;
            }

            if (CollectionUserView != null)
            {
                CollectionUserView.Dispose();
                CollectionUserView = null;
            }

            if (CommentButton != null)
            {
                CommentButton.Dispose();
                CommentButton = null;
            }

            if (CommentsText != null)
            {
                CommentsText.Dispose();
                CommentsText = null;
            }

            if (ContectRewardClaimed != null)
            {
                ContectRewardClaimed.Dispose();
                ContectRewardClaimed = null;
            }

            if (ContectRewardClaimedAspectRatio != null)
            {
                ContectRewardClaimedAspectRatio.Dispose();
                ContectRewardClaimedAspectRatio = null;
            }

            if (ContectRewardClaimedRightBackground != null)
            {
                ContectRewardClaimedRightBackground.Dispose();
                ContectRewardClaimedRightBackground = null;
            }

            if (ContectRewardClaimedTitle != null)
            {
                ContectRewardClaimedTitle.Dispose();
                ContectRewardClaimedTitle = null;
            }

            if (ContentCollectionAvatarView != null)
            {
                ContentCollectionAvatarView.Dispose();
                ContentCollectionAvatarView = null;
            }

            if (ContentCollectionAvatarViewAspectRatio != null)
            {
                ContentCollectionAvatarViewAspectRatio.Dispose();
                ContentCollectionAvatarViewAspectRatio = null;
            }

            if (ContentCollectionCheckInView != null)
            {
                ContentCollectionCheckInView.Dispose();
                ContentCollectionCheckInView = null;
            }

            if (ContentCollectionCheckInViewAspectRatio != null)
            {
                ContentCollectionCheckInViewAspectRatio.Dispose();
                ContentCollectionCheckInViewAspectRatio = null;
            }

            if (ContentFriendJoined != null)
            {
                ContentFriendJoined.Dispose();
                ContentFriendJoined = null;
            }

            if (ContentFriendJoinedAspectRatio != null)
            {
                ContentFriendJoinedAspectRatio.Dispose();
                ContentFriendJoinedAspectRatio = null;
            }

            if (ContentFriendJoinedBackground != null)
            {
                ContentFriendJoinedBackground.Dispose();
                ContentFriendJoinedBackground = null;
            }

            if (ContentFriendJoinedPhoto != null)
            {
                ContentFriendJoinedPhoto.Dispose();
                ContentFriendJoinedPhoto = null;
            }

            if (ContentFriendJoinedUserName != null)
            {
                ContentFriendJoinedUserName.Dispose();
                ContentFriendJoinedUserName = null;
            }

            if (ContentHeaderView != null)
            {
                ContentHeaderView.Dispose();
                ContentHeaderView = null;
            }

            if (ContentImage != null)
            {
                ContentImage.Dispose();
                ContentImage = null;
            }

            if (ContentImageAspectRatio != null)
            {
                ContentImageAspectRatio.Dispose();
                ContentImageAspectRatio = null;
            }

            if (ContentImageTextCaption != null)
            {
                ContentImageTextCaption.Dispose();
                ContentImageTextCaption = null;
            }

            if (ContentMap != null)
            {
                ContentMap.Dispose();
                ContentMap = null;
            }

            if (ContentMapAspectRatio != null)
            {
                ContentMapAspectRatio.Dispose();
                ContentMapAspectRatio = null;
            }

            if (ContentMapView != null)
            {
                ContentMapView.Dispose();
                ContentMapView = null;
            }

            if (ContentProductSold != null)
            {
                ContentProductSold.Dispose();
                ContentProductSold = null;
            }

            if (ContentProductSoldAspectRatio != null)
            {
                ContentProductSoldAspectRatio.Dispose();
                ContentProductSoldAspectRatio = null;
            }

            if (ContentProductSoldTextView != null)
            {
                ContentProductSoldTextView.Dispose();
                ContentProductSoldTextView = null;
            }

            if (ContentShare != null)
            {
                ContentShare.Dispose();
                ContentShare = null;
            }

            if (ContentShareAspectRatio != null)
            {
                ContentShareAspectRatio.Dispose();
                ContentShareAspectRatio = null;
            }

            if (ContentText != null)
            {
                ContentText.Dispose();
                ContentText = null;
            }

            if (ContentTextHeight != null)
            {
                ContentTextHeight.Dispose();
                ContentTextHeight = null;
            }

            if (ContentVideo != null)
            {
                ContentVideo.Dispose();
                ContentVideo = null;
            }

            if (ContentVideoAspectRatio != null)
            {
                ContentVideoAspectRatio.Dispose();
                ContentVideoAspectRatio = null;
            }

            if (ContentVideoButtonPlay != null)
            {
                ContentVideoButtonPlay.Dispose();
                ContentVideoButtonPlay = null;
            }

            if (ContentWebView != null)
            {
                ContentWebView.Dispose();
                ContentWebView = null;
            }

            if (ContentWebViewAspectRatio != null)
            {
                ContentWebViewAspectRatio.Dispose();
                ContentWebViewAspectRatio = null;
            }

            if (Creation_Date != null)
            {
                Creation_Date.Dispose();
                Creation_Date = null;
            }

            if (Creation_DateHeight != null)
            {
                Creation_DateHeight.Dispose();
                Creation_DateHeight = null;
            }

            if (GradientImageView != null)
            {
                GradientImageView.Dispose();
                GradientImageView = null;
            }

            if (GradientImageViewAspect != null)
            {
                GradientImageViewAspect.Dispose();
                GradientImageViewAspect = null;
            }

            if (IconContentFriendJoined != null)
            {
                IconContentFriendJoined.Dispose();
                IconContentFriendJoined = null;
            }

            if (IconProductSold != null)
            {
                IconProductSold.Dispose();
                IconProductSold = null;
            }

            if (Label_ContectReward_Claimed != null)
            {
                Label_ContectReward_Claimed.Dispose();
                Label_ContectReward_Claimed = null;
            }

            if (LabelFriendsWelcome != null)
            {
                LabelFriendsWelcome.Dispose();
                LabelFriendsWelcome = null;
            }

            if (LikeButton != null)
            {
                LikeButton.Dispose();
                LikeButton = null;
            }

            if (LikesText != null)
            {
                LikesText.Dispose();
                LikesText = null;
            }

            if (LikesView != null)
            {
                LikesView.Dispose();
                LikesView = null;
            }

            if (LikesViewHeightAspecnRatio != null)
            {
                LikesViewHeightAspecnRatio.Dispose();
                LikesViewHeightAspecnRatio = null;
            }

            if (LineSeparator != null)
            {
                LineSeparator.Dispose();
                LineSeparator = null;
            }

            if (MainBackgroundView != null)
            {
                MainBackgroundView.Dispose();
                MainBackgroundView = null;
            }

            if (MainView != null)
            {
                MainView.Dispose();
                MainView = null;
            }

            if (PointsIconWidthConstraint != null)
            {
                PointsIconWidthConstraint.Dispose();
                PointsIconWidthConstraint = null;
            }

            if (ProductSoldCount != null)
            {
                ProductSoldCount.Dispose();
                ProductSoldCount = null;
            }

            if (ProductSoldMainBackground != null)
            {
                ProductSoldMainBackground.Dispose();
                ProductSoldMainBackground = null;
            }

            if (ProductSoldTitle != null)
            {
                ProductSoldTitle.Dispose();
                ProductSoldTitle = null;
            }

            if (ProductSoldUpBackground != null)
            {
                ProductSoldUpBackground.Dispose();
                ProductSoldUpBackground = null;
            }

            if (PtsText != null)
            {
                PtsText.Dispose();
                PtsText = null;
            }

            if (ReadCommentButtonHeight != null)
            {
                ReadCommentButtonHeight.Dispose();
                ReadCommentButtonHeight = null;
            }

            if (ReadCommentsButton != null)
            {
                ReadCommentsButton.Dispose();
                ReadCommentsButton = null;
            }

            if (RewardClaimedCount != null)
            {
                RewardClaimedCount.Dispose();
                RewardClaimedCount = null;
            }

            if (SmileButton != null)
            {
                SmileButton.Dispose();
                SmileButton = null;
            }

            if (TextContentFriendJoined != null)
            {
                TextContentFriendJoined.Dispose();
                TextContentFriendJoined = null;
            }

            if (TextProductSold != null)
            {
                TextProductSold.Dispose();
                TextProductSold = null;
            }

            if (TextQuoteLineSeparatorHeight != null)
            {
                TextQuoteLineSeparatorHeight.Dispose();
                TextQuoteLineSeparatorHeight = null;
            }

            if (TopActionText != null)
            {
                TopActionText.Dispose();
                TopActionText = null;
            }

            if (TopActionTextHeight != null)
            {
                TopActionTextHeight.Dispose();
                TopActionTextHeight = null;
            }

            if (TopPaddingView != null)
            {
                TopPaddingView.Dispose();
                TopPaddingView = null;
            }

            if (TopPaddingViewAspect != null)
            {
                TopPaddingViewAspect.Dispose();
                TopPaddingViewAspect = null;
            }

            if (TopView != null)
            {
                TopView.Dispose();
                TopView = null;
            }

            if (TopViewHeight != null)
            {
                TopViewHeight.Dispose();
                TopViewHeight = null;
            }

            if (uiProfileButton != null)
            {
                uiProfileButton.Dispose();
                uiProfileButton = null;
            }

            if (vDotsTop != null)
            {
                vDotsTop.Dispose();
                vDotsTop = null;
            }

            if (vDotsTopHeight != null)
            {
                vDotsTopHeight.Dispose();
                vDotsTopHeight = null;
            }
        }