Example #1
0
        /// <summary>
        /// Constructor for a LayoutManager instance.
        /// </summary>
        /// <param name="pTarget">Target canvas which will hold all photo slices and this manager will take effect on.</param>
        /// <param name="pDataSource">Data source for this manager instance.</param>
        /// <param name="pBtnSortCanvas">Sort layout trigger canvas.</param>
        /// <param name="pBtnRandomCanvas">Random layout trigger canvas.</param>
        /// <param name="pZoomOutTrigger">Zoomout trigter canvas.</param>
        /// <param name="pSortNavi">Sort navigator.</param>
        public LayoutManager(Canvas pTarget, PhotoDataSet pDataSource, Canvas pBtnSortCanvas, Canvas pBtnRandomCanvas, Canvas pZoomOutTrigger, SortNavigator pSortNavi, GenuineSlice pGenuineSlice, TracingIcon pTracingIcon, Image pScreenArrowLeft, Image pScreenArrowRight)
        {
            _target = pTarget;
            _targetShadow = pTarget.FindName("PhotoHolderShadow") as Canvas;
            _sortNavi = pSortNavi;
            _dataSource = pDataSource;
            _zoomOutTrigger = pZoomOutTrigger;
            _btnSort = pBtnSortCanvas;
            _btnSort.Cursor = Cursors.Hand;
            _btnRandom = pBtnRandomCanvas;
            _btnRandom.Cursor = Cursors.Hand;
            _genuineSlice = pGenuineSlice;
            _isSliceRequest = false;
            _tracingMouse = pTracingIcon;
            _screenArrowLeft = pScreenArrowLeft;
            _screenArrowRight = pScreenArrowRight;

            // Generate random & sort params
            GenerateLayoutPostion();
            // Fill thums to thumHolder
            FillThumHolder();

            // Event register.
            _target.MouseLeftButtonUp += new MouseEventHandler(_target_MouseLeftButtonUp);
            _zoomOutTrigger.MouseLeftButtonUp += new MouseEventHandler(_zoomOutTrigger_MouseLeftButtonUp);
            _zoomInStoryboard = _target.FindName("ZoomIn") as Storyboard;
            _zoomOutStoryboard = _target.FindName("ZoomOut") as Storyboard;
            _rotateToAngleStoryboard = _target.FindName("RotateToAngle") as Storyboard;
            _animateToPositionStoryboard = _target.FindName("AnimateToPosition") as Storyboard;
            _zoomInStoryboard.Completed += new EventHandler(_zoomInStoryboard_Completed);
            _zoomOutStoryboard.Completed += new EventHandler(_zoomOutStoryboard_Completed);
            _layoutStandByStoryboard = _target.FindName("LayoutStandBy") as Storyboard;
            _layoutStandByStoryboard.Completed += new EventHandler(_layoutStandByStoryboard_Completed);

            _btnSort.MouseLeftButtonUp += new MouseEventHandler(_btnSort_MouseLeftButtonUp);
            _btnSort.MouseEnter += new MouseEventHandler(_btnSort_MouseEnter);
            _btnSort.MouseLeave += new EventHandler(_btnSort_MouseLeave);
            _btnRandom.MouseLeftButtonUp += new MouseEventHandler(_btnRandom_MouseLeftButtonUp);
            _btnRandom.MouseEnter += new MouseEventHandler(_btnRandom_MouseEnter);
            _btnRandom.MouseLeave += new EventHandler(_btnRandom_MouseLeave);

            _screenArrowLeft.MouseLeftButtonUp += new MouseEventHandler(_screenArrowLeft_MouseLeftButtonUp);
            _screenArrowRight.MouseLeftButtonUp += new MouseEventHandler(_screenArrowRight_MouseLeftButtonUp);

            // By default, enter sorted layout.
            _status = AlbumStatus.Hanging;     // clear status
            Status = AlbumStatus.Sorted;
            _zoomStatus = ZoomStatus.Out;
        }
Example #2
0
        public void Page_Loaded(object o, EventArgs e)
        {
            // Required to initialize variables
            InitializeComponent();

            // Make GrassSphere dock to the bottom.
            DockGrassSphere();

            // Make tracing icon
            _tracingIcon = new TracingIcon();
            
            
            // Make sort Arrow
            _sortArrowLeft = this.FindName("LeftSortArrow") as Image;
            _sortArrowRight = this.FindName("RightSortArrow") as Image;
            _sortArrowLeftHot = this.FindName("LeftSortArrowHot") as Rectangle;
            _sortArrowRightHot = this.FindName("RightSortArrowHot") as Rectangle;
            _screenArrowLeft = this.FindName("ScreenArrowLeft") as Image;
            _screenArrowRight = this.FindName("ScreenArrowRight") as Image;
            _sortArrowLeftHot.Cursor = Cursors.Hand;
            _sortArrowRightHot.Cursor = Cursors.Hand;
            _sortArrowLeftHot.MouseEnter += new MouseEventHandler(_sortArrowLeft_MouseEnter);
            _sortArrowLeftHot.MouseLeave += new EventHandler(_sortArrowLeft_MouseLeave);
            _sortArrowLeftHot.MouseLeftButtonUp += new MouseEventHandler(_sortArrowLeft_MouseLeftButtonUp);
            _sortArrowRightHot.MouseEnter += new MouseEventHandler(_sortArrowRight_MouseEnter);
            _sortArrowRightHot.MouseLeave += new EventHandler(_sortArrowRight_MouseLeave);
            _sortArrowRightHot.MouseLeftButtonUp += new MouseEventHandler(_sortArrowRight_MouseLeftButtonUp);

            // Make Sort Navi
            _sortNavi = new SortNavigator(this.FindName("SortNaviCanvas") as Canvas);

            // Add genuine slice
            _genuineSlice = new GenuineSlice(_tracingIcon, BgCanvas);
            this.Children.Add(_genuineSlice);
            this.Children.Add(_tracingIcon);
            CenterGenuineSlice();

            // Sync the instance of PhotoDataSet.
            //-------------- NOTICE ------------------------------
            // Current set is just load a fixed dummy data set.
            // Change this part to sync PhotoDataSet if necessary.
            //-------------- END OF NOTICE -----------------------

            //InitailizeAlbum();
            GetJSONData();
        }