示例#1
0
        public void ReplaceBy(FilmingControlCell newCell, bool needReferesh, ActionType curAction)
        {
            if (newCell.IsEmpty)
            {
                Image.Clear();
                Refresh();
            }
            var  displaydata = newCell.Image.CurrentPage;
            bool flag        = this.IsEmpty;

            this.Image.Clear();
            this.Image.AddPage(displaydata);
            this.IsSelected = newCell.IsSelected;
            if (flag)
            {
                FilmPageUtil.SetAllActions(this, curAction);
            }
            if (needReferesh)
            {
                Refresh();
            }
            else
            {
                this.Image.CurrentPage.IsDirty = true;
            }
        }
示例#2
0
        public void ReplaceBy(FilmingLayoutCell replaceCell, bool needReferesh, ActionType curAction)
        {
            int cellCount = replaceCell.Rows * replaceCell.Columns;

            if (Rows != replaceCell.Rows || Columns != replaceCell.Columns)
            {
                RemoveAll();
                SetLayout(replaceCell.Rows, replaceCell.Columns);
                IsMultiformatLayoutCell = replaceCell.IsMultiformatLayoutCell;
                for (int i = 0; i < cellCount; i++)
                {
                    AddCell(new FilmingControlCell());
                }
                Refresh();
            }
            for (int i = 0; i < replaceCell.Children.Count(); i++)
            {
                var filmingControlCell = replaceCell.Children.ElementAt(i) as FilmingControlCell;
                var tempcell           = this.Children.ElementAt(i) as FilmingControlCell;
                if (filmingControlCell == null || filmingControlCell.IsEmpty)
                {
                    if (tempcell != null && tempcell.Image != null && tempcell.Image.CurrentPage != null)
                    {
                        tempcell.Image.Clear();
                        tempcell.Refresh();
                    }
                    continue;
                }
                var displaydata = filmingControlCell.Image.CurrentPage;
                if (tempcell != null)
                {
                    bool flag = tempcell.IsEmpty;
                    tempcell.Image.Clear();
                    tempcell.Image.AddPage(displaydata);
                    tempcell.IsSelected = filmingControlCell.IsSelected;
                    if (flag)
                    {
                        FilmPageUtil.SetAllActions(tempcell, curAction);
                    }
                    if (needReferesh)
                    {
                        tempcell.Refresh();
                    }
                    else
                    {
                        tempcell.Image.CurrentPage.IsDirty = true;
                    }
                }
            }
        }
示例#3
0
        public void SetPagesSelectedStatusNotIn(int startPageIndex, int endPageIndex, bool selectedStatus)
        {
            if (startPageIndex > endPageIndex)
            {
                return;
            }
            var list = this.Where(
                filmingPage =>
                filmingPage.FilmPageIndex <startPageIndex || filmingPage.FilmPageIndex> endPageIndex).ToList();

            foreach (var filmingPage in list)
            {
                FilmPageUtil.SelectAllOfFilmingPage(filmingPage, selectedStatus);
            }
        }
        private void DeleteLoadedImages(List <string> seriesUidList)
        {
            var filmingCard = FilmingViewerContainee.FilmingViewerWindow as FilmingCard;

            if (filmingCard == null)
            {
                throw new Exception("filming card is not available");
            }
            if (filmingCard.IfZoomWindowShowState)
            {
                var zoomViewer = filmingCard.zoomWindowGrid.Children[0] as FilmingZoomViewer;
                if (zoomViewer != null)
                {
                    zoomViewer.CloseDialog();
                }
            }

            foreach (var page in filmingCard.EntityFilmingPageList)
            {
                foreach (var cell in page.Cells)
                {
                    if (cell.Image == null)
                    {
                        continue;
                    }

                    var seriesUid = FilmPageUtil.GetSeriesUidFromImage(cell.Image);
                    if (!string.IsNullOrEmpty(seriesUid) && seriesUidList.Contains(seriesUid))
                    {
                        FilmPageUtil.ClearAllActions(cell);
                        cell.Image.Clear();
                        cell.IsSelected = false; //删除图片后应去除多选状态
                        cell.Refresh();
                    }
                }
            }
            if (filmingCard.IsEnableRepack)
            {
                filmingCard.contextMenu.Repack();
            }
            else
            {
                filmingCard.EntityFilmingPageList.UpdatePageLabel();
            }
        }
示例#5
0
        //Layoutcell repack
        public void Repack()
        {
            try
            {
                //有图cell和位置准备
                var filmingImageLayoutCells = GetAllImageLayoutCells().ToList();
                var filmingLayoutCells      = GetAllLayoutCells().ToList();
                //有图cell放置个数记录index
                int cellIndex = 0;
                //循环每个可放图片的位置(SSFS要求空多分格不参与repack),放置图片并刷新
                foreach (var originalCellKeyPair in filmingLayoutCells)
                {
                    var originalCell = originalCellKeyPair.Key;
                    var page         = originalCellKeyPair.Value;

                    //图片放置完成后,将后面多余的cell的UI清空
                    if (cellIndex >= filmingImageLayoutCells.Count)
                    {
                        if (originalCell != null && !originalCell.IsEmpty())
                        {
                            foreach (var ctrlCell in originalCell.ControlCells)
                            {
                                FilmPageUtil.ClearAllActions(ctrlCell);
                                ctrlCell.IsSelected = false;
                            }
                            originalCell.Clear();
                        }
                        if (originalCell != null)
                        {
                            originalCell.DeSelected();
                        }
                        continue;
                    }
                    //originalCell为胶片的空格位置,replaceCell为带图片的cell
                    if (originalCell != null && originalCell.IsMultiformatLayoutCell && originalCell.IsEmpty())
                    {
                        continue;
                    }

                    var replaceCell = filmingImageLayoutCells[cellIndex];
                    //以layoutcell为单位替换cell,可见即刷新,不可见置刷新属性
                    if (originalCell != replaceCell)
                    {
                        if (page.Visibility == Visibility.Visible)
                        {
                            originalCell.ReplaceBy(replaceCell, true, page.CurrentActionType);
                        }
                        else
                        {
                            originalCell.ReplaceBy(replaceCell, false, page.CurrentActionType);
                        }
                        var controlCells = originalCell.ControlCells;
                        if (controlCells.Count > 1)
                        {
                            controlCells.ForEach(page.RegisterEventFromCell);
                        }
                        if (originalCell.IsSelected() && !page.IsSelected)
                        {
                            page.IsSelected = true;
                        }
                    }
                    cellIndex++;
                }
                if (filmingImageLayoutCells.Count == 0 && filmingLayoutCells.Count != 0)
                {
                    var filmingCard = FilmingViewerContainee.FilmingViewerWindow as FilmingCard;
                    if (filmingCard != null && !filmingCard.IsCellSelected)
                    {
                        var cell  = filmingLayoutCells.FirstOrDefault().Key;
                        var page  = filmingLayoutCells.FirstOrDefault().Value;
                        var cCell = cell.ControlCells.FirstOrDefault();
                        if (page.IsVisible && cCell != null)
                        {
                            cCell.IsSelected = true;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Instance.LogDevError("Repack Error" + e.Message + e.StackTrace);
            }
        }
示例#6
0
        //Controlcell repack
        public void RepackControlCell()
        {
            //有图cell和位置准备
            var filmingImageControlCells = GetAllImageControlCells().ToList();
            var filmingControlCells      = GetAllControlCells().ToList();
            var filmingCard = FilmingViewerContainee.FilmingViewerWindow as FilmingCard;
            //有图cell放置个数记录index
            int cellIndex = 0;

            //循环每个可放图片的位置(SSFS要求空多分格不参与repack),放置图片并刷新
            foreach (var originalCellKeyPair in filmingControlCells)
            {
                var originalCell = originalCellKeyPair.Key;
                var page         = originalCellKeyPair.Value;

                //图片放置完成后,将后面多余的cell的UI清空
                if (cellIndex >= filmingImageControlCells.Count)
                {
                    if (originalCell != null && !originalCell.IsEmpty)
                    {
                        FilmPageUtil.ClearAllActions(originalCell);

                        originalCell.Image.Clear();
                        originalCell.Refresh();
                    }
                    if (originalCell != null)
                    {
                        originalCell.IsSelected = false;
                        var viewport = page.ViewportOfCell(originalCell);
                        FilmPageUtil.UnselectCellInViewport(viewport, originalCell);
                    }
                    continue;
                }
                //originalCell为胶片的空格位置,replaceCell为带图片的cell
                //if (originalCell != null && originalCell.IsMultiformatLayoutCell && originalCell.IsEmpty()) continue;

                var replaceCell = filmingImageControlCells[cellIndex];
                //以layoutcell为单位替换cell,可见即刷新,不可见置刷新属性
                if (originalCell != replaceCell)
                {
                    if (page.Visibility == Visibility.Visible)
                    {
                        originalCell.ReplaceBy(replaceCell, true, page.CurrentActionType);
                    }
                    else
                    {
                        originalCell.ReplaceBy(replaceCell, false, page.CurrentActionType);
                    }
                    page.RegisterEventFromCell(originalCell);
                    if (originalCell.IsSelected && !page.IsSelected)
                    {
                        page.IsSelected = true;
                    }
                    var vp = page.ViewportOfCell(originalCell);
                    if (originalCell.IsSelected && vp != null)
                    {
                        vp.IsSelected = true;
                    }
                    if (!originalCell.IsSelected && vp != null)
                    {
                        FilmPageUtil.UnselectCellInViewport(vp, originalCell);
                    }
                }
                cellIndex++;
            }
            if (filmingImageControlCells.Count == 0 && filmingControlCells.Count != 0)
            {
                if (filmingCard != null && !filmingCard.IsCellSelected)
                {
                    var cell = filmingControlCells.FirstOrDefault().Key;
                    var page = filmingControlCells.FirstOrDefault().Value;
                    if (page.IsVisible && cell != null)
                    {
                        cell.IsSelected = true;
                        var vp = page.ViewportOfCell(cell);
                        if (vp != null)
                        {
                            vp.IsSelected = true;
                        }
                    }
                }
            }
        }