Exemplo n.º 1
0
    //public string sPictureName;
    private void Awake()
    {
        instance         = this;
        SelectController = new PictureController();
        StartCoroutine(Init());


        Obj = new PictureController[8];
        for (int i = 0; i < 8; i++)
        {
            Obj[i] = Instantiate(PictureObj, transform).GetComponent <PictureController>();
            Obj[i].gameObject.SetActive(false);
        }
        ////스케일 로테이션 세팅 추가
        //GameObject obj = Instantiate(PictureObj);
        //obj.transform.position = new Vector3(-30f, 0f,0f);
        //obj.transform.localScale = new Vector3(1f, 1f, 1f);
        ////obj.transform.GetComponent<PictureController>().SetPictureSize(false);
        //obj.transform.GetComponent<PictureController>().FrontSprite.sprite = GetSprite("testf001");
        //obj.transform.GetComponent<PictureController>().BackSprite.sprite = GetSprite("testb001");

        //GameObject obj2 = Instantiate(PictureObj);
        //obj2.transform.position = new Vector3(30f, 0f,0f);
        //obj2.transform.localScale = new Vector3(1f, 1f, 1f);
        ////obj2.transform.GetComponent<PictureController>().SetPictureSize(false);
        //obj2.transform.GetComponent<PictureController>().FrontSprite.sprite = GetSprite("testf101");
        //obj2.transform.GetComponent<PictureController>().BackSprite.sprite = GetSprite("testb101");

        //StartChapter(1);
    }
Exemplo n.º 2
0
 void OnEnable()
 {
     Debug.Log("PictureMenu: OnEnable");
     picture = GetComponentInParent <PictureController>();
     picture.toolbar.SetActive(false);
     BeginEdit();
 }
Exemplo n.º 3
0
        public async Task ReplacePicture_NullFile_ClearsPicture()
        {
            ClaimsPrincipal principal = new ClaimsPrincipal(
                new ClaimsIdentity(
                    new[] {
                new Claim(JwtClaimTypes.Scope, Constants.Scopes.Administrator),
                new Claim(JwtClaimTypes.Subject, "1")
            },
                    "Bearer"));
            PictureController controller = new PictureController(_dbContext,
                                                                 Mock.Of <IDefaultPictureProvider>(),
                                                                 principal,
                                                                 Mock.Of <ILogger <PictureController> >());

            byte[]    picture = { };
            IFormFile file    = new FormFile(new MemoryStream(picture), 0, picture.Length, "file", "file");

            IActionResult result = await controller.ReplacePicture(1, file);

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.InstanceOf <OkResult>());
                Assert.That(_dbContext.Brother.First(b => b.Id.Equals(1)).Picture, Is.Null);
            });
        }
Exemplo n.º 4
0
        public ActionResult Picture(int page = 1)
        {
            var objCategory = new CategoryController().GetCategoryBySlug("hinh-anh", _isClearCache);

            if (objCategory == null || objCategory.CategoryId == -1)
            {
                Response.Redirect("/404/");
            }

            var pictures  = new PictureController().ListPictureByPaging(page, _pageSize, _isClearCache);
            var total     = pictures.Count > 0 ? pictures.FirstOrDefault().Total : 0;
            var totalPage = (total % _pageSize == 0) ? (total / _pageSize) : (total / _pageSize + 1);
            var paging    = new Paging()
            {
                Url       = "/hinh-anh",
                Page      = page,
                TotalPage = totalPage
            };

            ViewBag.Page        = page;
            ViewBag.PageList    = paging.LoadPaging();
            ViewBag.BreadCrumb  = LoadBreadCrumb(objCategory);
            ViewBag.ObjCategory = objCategory;
            ViewBag.LineTitle   = "Hình ảnh";

            return(MvcApplication.IsMobileMode() ? View("Picture.M", pictures) : View(pictures));
        }
Exemplo n.º 5
0
    /// <summary>
    /// OuMouseDown handles the click on "Keep Scrolling" during the "It's a Match!" message.
    /// This script will find PictureController, assign it to pictureController, disable the picture using a reference to the script assigned previously
    /// and set the match (parent of each component in the "It's a Match!" message) to false.
    /// </summary>

    void OnMouseDown()
    {
        pictureController = FindObjectOfType(typeof(PictureController)) as PictureController;
        pictureController.HideMiniPhotos();
        match.SetActive(false);
        holder.SetActive(true);
    }
Exemplo n.º 6
0
        public void GetNumberOfPictures()
        {
            IPictureService   pictureService    = new MockPictureService();
            PictureController pictureController = new PictureController(pictureService);
            var result = pictureController.GetPictures();

            Assert.NotNull(result);
        }
Exemplo n.º 7
0
 // Start is called before the first frame update
 void Awake()
 {
     myPictureController = GetComponentInChildren <PictureController>();
     myWidgetController  = GetComponentInChildren <WidgetController>();
     myCaptionController = GetComponentInChildren <CaptionController>();
     mySMControllers     = GetComponentsInChildren <SMController>();
     isEnlarged          = false;
 }
Exemplo n.º 8
0
 public HomeForm()
 {
     InitializeComponent();
     foreach (string item in PictureController.GetPictureList())
     {
         this.PictureListCB.Items.Add(item);
     }
 }
Exemplo n.º 9
0
        public async Task Controller_Should_Return_Status_404NotFound()
        {
            IPictureService   pictureService    = new MockPictureService();
            PictureController pictureController = new PictureController(pictureService);
            var id       = new Guid("1ba6b939-2a1a-4d6d-b65a-33f699a82bdb");
            var response = await pictureController.GetPicture(id);

            Assert.NotNull(response);
        }
Exemplo n.º 10
0
        public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            PictureController pictureController = new PictureController();

            log.Info("C# HTTP trigger function processed a request.");

            string ViewReviewQueue = req.GetQueryNameValuePairs().FirstOrDefault(q => string.Compare(q.Key, "ViewReviewQueue", true) == 0).Value;
            string Approved        = req.GetQueryNameValuePairs().FirstOrDefault(q => string.Compare(q.Key, "Approved", true) == 0).Value;
            string Rejected        = req.GetQueryNameValuePairs().FirstOrDefault(q => string.Compare(q.Key, "Rejected", true) == 0).Value;

            if (ViewReviewQueue != null)
            {
                var pictures = pictureController.GetAllPictures();
                var json     = JsonConvert.SerializeObject(pictures);
                return(req.CreateResponse(HttpStatusCode.OK, $"{json}"));
            }
            else if (Approved != null)
            {
                var picture = pictureController.GetPictureByPictureName(Approved);

                if (picture == null)
                {
                    return(req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body"));
                }

                if (picture.Valid == true)
                {
                    return(req.CreateResponse(HttpStatusCode.OK, $"{JsonConvert.SerializeObject(picture)}, picture already approved!"));
                }
                else if (picture.Valid != true)
                {
                    var updatedPicture = pictureController.UpdatePictureByPictureName(Approved, true);
                    return(req.CreateResponse(HttpStatusCode.OK, $"{JsonConvert.SerializeObject(updatedPicture)}, picture approved!"));
                }
            }
            else if (Rejected != null)
            {
                var picture = pictureController.GetPictureByPictureName(Rejected);

                if (picture == null)
                {
                    return(req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body"));
                }

                if (picture.Valid == false)
                {
                    return(req.CreateResponse(HttpStatusCode.OK, $"{JsonConvert.SerializeObject(picture)}, picture already rejected!"));
                }
                else if (picture.Valid != false)
                {
                    var updatedPicture = pictureController.UpdatePictureByPictureName(Rejected, false);
                    return(req.CreateResponse(HttpStatusCode.OK, $"{JsonConvert.SerializeObject(updatedPicture)}, picture rejected!"));
                }
            }

            return(null);
        }
Exemplo n.º 11
0
 void Start()
 {
     isEditing          = false;
     originaButtonScale = transform.localScale;
     collider           = GetComponent <BoxCollider>();
     originColliderSize = collider.size;
     picture            = GetComponentInParent <PictureController>();
     relativeOffset     = transform.position - picture.transform.position;
     relativeOffset.y   = 0f;
 }
        public void Put()
        {
            // Arrange
            PictureController controller = new PictureController();

            // Act
            controller.Put(5, "value");

            // Assert
        }
        public void Delete()
        {
            // Arrange
            PictureController controller = new PictureController();

            // Act
            controller.Delete(5);

            // Assert
        }
Exemplo n.º 14
0
        public void NonexistentBrother_ReturnsNotFound()
        {
            PictureController controller = new PictureController(_dbContext, null, null, null);
            NotFoundResult    result     = controller.GetPicture(-1) as NotFoundResult;

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result.StatusCode, Is.EqualTo((int)HttpStatusCode.NotFound));
            });
        }
Exemplo n.º 15
0
 void Start()
 {
     isEditing          = false;
     originaButtonScale = transform.localScale;
     collider           = GetComponent <BoxCollider>();
     originColliderSize = collider.size;
     spatialMapping     = SpatialMappingManager.Instance;
     picture            = GetComponentInParent <PictureController>();
     relativeOffset     = transform.position - picture.transform.position;
     relativeOffset.z   = -relativeOffset.z;
 }
        public void GetById()
        {
            // Arrange
            PictureController controller = new PictureController();

            // Act
            string result = controller.Get(5);

            // Assert
            Assert.AreEqual("value", result);
        }
Exemplo n.º 17
0
        private void LoadImage()
        {
            PictureController controller = new PictureController();
            PictureModel      model      = controller.GetPicture(ImageId);

            if (model != null)
            {
                Response.ContentType = "image/GIF";
                Response.BinaryWrite(model.Data);
            }
        }
Exemplo n.º 18
0
        public void BrotherWithPicture_ReturnsPicture()
        {
            PictureController controller = new PictureController(_dbContext, null, null, null);
            FileContentResult result     = controller.GetPicture(1) as FileContentResult;

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result.FileContents, Is.Not.Null);
                Assert.That(result.ContentType, Is.EqualTo("image/jpeg"));
                Assert.That(result.FileContents, Is.EqualTo(new byte[] { 1, 2, 3 }));
            });
        }
Exemplo n.º 19
0
        public ActionResult PictureDetail(string slug)
        {
            var objPicture = new PictureController().GetPictureBySlug(slug);

            if (objPicture == null)
            {
                Response.Redirect("/404/");
            }

            ViewBag.BreadCrumb = LoadBreadCrumbDetail("/hinh-anh/", "Hình ảnh", objPicture.NavigationUrl, objPicture.Title);
            return(MvcApplication.IsMobileMode() ? View("PictureDetail.M", objPicture) : View(objPicture));
        }
Exemplo n.º 20
0
        public async Task ReplacePicture_ControllerConcurrencyConflict_ReturnsConflict()
        {
            await _dbContext.Database.EnsureDeletedAsync();

            using DirectoryContext dbContext = new DirectoryContext(new DbContextOptionsBuilder <DirectoryContext>()
                                                                    .UseInMemoryDatabase("directory")
                                                                    .EnableSensitiveDataLogging()
                                                                    .EnableDetailedErrors()
                                                                    .Options);
            await dbContext.Database.EnsureCreatedAsync();

            await dbContext.Brother.AddRangeAsync(new[] {
                new Brother {
                    Id = 1, Picture = new byte[] { 1, 2, 3 }
                },
                new Brother {
                    Id = 2
                }
            });

            await dbContext.SaveChangesAsync();

            Mock <DirectoryContext> mockedContext = new Mock <DirectoryContext>();

            mockedContext.SetupGet(m => m.Brother).Returns(dbContext.Brother);
            mockedContext.Setup(m => m.SaveChangesAsync(It.IsAny <CancellationToken>())).Throws <DBConcurrencyException>();

            ClaimsPrincipal principal = new ClaimsPrincipal(
                new ClaimsIdentity(
                    new[] {
                new Claim(JwtClaimTypes.Scope, Constants.Scopes.Administrator),
                new Claim(JwtClaimTypes.Subject, "1")
            },
                    "Bearer"));
            PictureController controller = new PictureController(mockedContext.Object,
                                                                 Mock.Of <IDefaultPictureProvider>(),
                                                                 principal,
                                                                 Mock.Of <ILogger <PictureController> >());

            byte[]    picture = { 5 };
            IFormFile file    = new FormFile(new MemoryStream(picture), 0, picture.Length, "file", "file");

            IActionResult result = await controller.ReplacePicture(1, file);

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.InstanceOf <ConflictResult>());
                // Make sure the picture is still what it was before
                Assert.That(_dbContext.Brother.First(b => b.Id.Equals(1)).Picture, Is.EqualTo(new byte[] { 1, 2, 3 }));
            });
        }
Exemplo n.º 21
0
        public async Task ReplacePicture_BrotherDoesNotExist_ReturnsNotFound()
        {
            PictureController controller = new PictureController(_dbContext,
                                                                 Mock.Of <IDefaultPictureProvider>(),
                                                                 Mock.Of <ClaimsPrincipal>(),
                                                                 Mock.Of <ILogger <PictureController> >());

            IActionResult result = await controller.ReplacePicture(-1, null);

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.InstanceOf <NotFoundResult>());
            });
        }
        private void GetPictureForUser(User user, HttpPostedFileBase Picture)
        {
            if (Picture != null)
            {
                user.FileName    = Picture.FileName;
                user.ContentType = Picture.ContentType;

                using (var reader = new BinaryReader(Picture.InputStream))
                {
                    //picture.Picture = reader.ReadBytes(Pictures[i].ContentLength);
                    user.Photo = PictureController.GetCroppedImage(reader.ReadBytes(Picture.ContentLength), PictureController.GetFormatImage(Picture.ContentType));
                }
            }
        }
Exemplo n.º 23
0
        public void BrotherWithoutPicture_ReturnsDefaultPicture()
        {
            Mock <IDefaultPictureProvider> mockDefaultProvider = new Mock <IDefaultPictureProvider>();

            mockDefaultProvider.Setup(m => m.GetDefaultPicture()).Returns(new byte[] { 3, 2, 1 });
            PictureController controller = new PictureController(_dbContext, mockDefaultProvider.Object, null, null);
            FileContentResult result     = controller.GetPicture(2) as FileContentResult;

            Assert.Multiple(() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result.FileContents, Is.Not.Null);
                Assert.That(result.ContentType, Is.EqualTo("image/jpeg"));
                Assert.That(result.FileContents, Is.EqualTo(new byte[] { 3, 2, 1 }));
            });
        }
    void Start()
    {
        picture            = GetComponentInParent <PictureController>();
        originaButtonScale = transform.localScale;

        scaleRecognizer = new GestureRecognizer();
        scaleRecognizer.SetRecognizableGestures(GestureSettings.ManipulationTranslate);

        scaleRecognizer.ManipulationStartedEvent   += OnStartedEvent;
        scaleRecognizer.ManipulationUpdatedEvent   += OnUpdatedEvent;
        scaleRecognizer.ManipulationCompletedEvent += OnCompletedEvent;
        scaleRecognizer.ManipulationCanceledEvent  += OnCanceledEvent;
        scaleRecognizer.StartCapturingGestures();
        isEditing = false;
    }
Exemplo n.º 25
0
        public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log)
        {
            PictureController pictureController = new PictureController();
            var pictures = pictureController.GetAllPictures();

            foreach (var picture in pictures)
            {
                if (picture.Valid == false && Regex.IsMatch(picture.PictureName, @"\.png$"))
                {
                    pictureController.UpdatePictureByPictureName(picture.PictureName, true);
                }
            }

            log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
        }
Exemplo n.º 26
0
 private void SetRandomWallpaperBtn_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < 6; i++)
     {
         try
         {
             Uri randomPic = PictureController.GetRandomUriPic();
             WallpaperController.Set(randomPic, WallpaperController.Style.Stretched);
             return;
         }
         catch
         {
             MessageBox.Show(MessageHelper.GetMessageByName("RandomPicError"));
         }
     }
 }
Exemplo n.º 27
0
    /**
     * Initialize.
     */
    void Start()
    {
        // Get the picture and buttons instances
        infoPanelAnimator    = infoPanel.GetComponent <Animator>();
        loginPanelController = loginPanel.GetComponent <LoginPanelController>();
        agentManager         = agentManagerObject.GetComponent <AgentManager>();
        pictureController    = picture.GetComponent <PictureController>();

        // Get the text components from the labels
        foreach (GameObject label in labels)
        {
            labelsText.Add(label.GetComponent <Text>());
        }
        foreach (GameObject label in labelValues)
        {
            labelValuesText.Add(label.GetComponent <Text>());
        }

        // Get the label count and total label count
        labelCount = Mathf.Max(labelsText.Count, labelValuesText.Count);

        // Store the default strings
        foreach (Text text in labelsText)
        {
            labelsTextDefaults.Add(text.text);
        }

        // Fill the labels spawn list
        for (int i = 0; i < labelCount; i++)
        {
            if (labelsText.Count > i)
            {
                labelsSpawn.Add(labelsText[i]);
            }
            if (labelValuesText.Count > i)
            {
                labelsSpawn.Add(labelValuesText[i]);
            }
        }

        // Store the text values
        foreach (Text text in labelsSpawn)
        {
            labelsSpawnValues.Add(text.text);
        }
    }
Exemplo n.º 28
0
        static void Main()
        {
            Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);

              PaintModel model = new PaintModel();

              PaintForm mainView = new PaintForm();
              PictureController pictureController =
              new PictureController(model, mainView);

              ToolBarController toolBarController =
              new ToolBarController(model, mainView.toolBarView);

              model.ShowImageOnView();
              Application.Run(mainView);
        }
Exemplo n.º 29
0
    protected override void Awake()
    {
        base.Awake();
        _instance = this;
        PictureSaveData saveData = TextManager.Instance.ReadProgress <PictureSaveData> ("PictureProgress.json");

        if (saveData != null)
        {
            selectLetter      = saveData.select;
            selectShowing     = saveData.selectShowing;
            alreadyShowAnswer = saveData.answer;
            answer_select     = saveData.answer_select;
        }
        hint.info = "picturehintcost";
        hint.SetHint();
        hint.HintEvent += ClickHint;
    }
Exemplo n.º 30
0
        public async Task ReplacePicture_SubjectAndBrotherDifferWithoutAdministratorScope_ReturnsUnauthorized()
        {
            ClaimsPrincipal principal = new ClaimsPrincipal(
                new ClaimsIdentity(
                    new[] { new Claim(JwtClaimTypes.Subject, "2") },
                    "Bearer"));
            PictureController controller = new PictureController(_dbContext,
                                                                 Mock.Of <IDefaultPictureProvider>(),
                                                                 principal,
                                                                 Mock.Of <ILogger <PictureController> >());

            IActionResult result = await controller.ReplacePicture(1, null);

            Assert.Multiple((() => {
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.InstanceOf <UnauthorizedResult>());
            }));
        }
Exemplo n.º 31
0
        public void TestSetUp()
        {
            _foodRepo           = new Mock <IFoodRepo>();
            _controller         = new PictureController(_foodRepo.Object);
            _controller.Request = new HttpRequestMessage();
            _controller.Request.Headers.Add("Idea.JCWYE.Vote", "Up");
            ConfigurationManager.AppSettings["JCWYE:MaxTimeToWaitForVoteInSeconds"] = "1";

            _foodInfo = new FoodInfo
            {
                Category    = Category,
                Food        = Food,
                Description = String.Empty,
                Pictures    = _urls.Select((item, i) => new FoodPicture {
                    Id = i, Url = item
                }).ToList()
            };
        }
Exemplo n.º 32
0
    /**
     * Initialize.
     */
    void Start()
    {
        // Get the picture and buttons instances
        infoPanelAnimator = infoPanel.GetComponent<Animator>();
        loginPanelController = loginPanel.GetComponent<LoginPanelController>();
        agentManager = agentManagerObject.GetComponent<AgentManager>();
        pictureController = picture.GetComponent<PictureController>();

        // Get the text components from the labels
        foreach(GameObject label in labels)
            labelsText.Add(label.GetComponent<Text>());
        foreach (GameObject label in labelValues)
            labelValuesText.Add(label.GetComponent<Text>());

        // Get the label count and total label count
        labelCount = Mathf.Max(labelsText.Count, labelValuesText.Count);

        // Store the default strings
        foreach (Text text in labelsText)
            labelsTextDefaults.Add(text.text);

        // Fill the labels spawn list
        for (int i = 0; i < labelCount; i++) {
            if (labelsText.Count > i)
                labelsSpawn.Add(labelsText[i]);
            if (labelValuesText.Count > i)
                labelsSpawn.Add(labelValuesText[i]);
        }

        // Store the text values
        foreach (Text text in labelsSpawn)
            labelsSpawnValues.Add(text.text);
    }
Exemplo n.º 33
0
        public Controller()
        {
            con = new ConnectionToWebService();

            //Create the helper controllers
            vdController = new VideoController();
            picController = new PictureController();
            storageController = new MainStorageController();

            #region populate static lists //startup
            checkMainFile();
            checkAdminFile();
            addFilesToPath();
            SetDicWorStats();
            SetEducasStats();
            SetChatStats();
            SetBlackBoardList();
            SetCurrentVisitors();
            SetOrdbogenVisitors();
            //salesList=GetMonthlySales();
            setCurrentMonthSales();
            //counter
            SetNumberOfthescreen();
            screenSearches[0] = dd.GetOrdbogenCurrentSearches();
            screenSearches[1] = DateTime.Now;
            //--

            SetMonthlySales();
            SetDictionaryWordMonthlyStats();
            SetStatisticsMonthlytats();
            SetAssigmentStatsMonthlyStats();

            #endregion

            //add the User Controls that we would like to show

            basicRotation = new List<string>();
            basicRotation.Add("Sales");
            basicRotation.Add("CostumerSupport");
            basicRotation.Add("Dictionary");
            basicRotation.Add("Education");
        }