示例#1
0
文件: StackTool.cs 项目: nhannd/Xian
        private void Sort(ImageComparerList.Item item)
		{
			IImageBox imageBox = ImageViewer.SelectedImageBox;
			IDisplaySet displaySet;
			if (imageBox == null || (displaySet = ImageViewer.SelectedImageBox.DisplaySet) == null)
				return;

			if (displaySet.PresentationImages.Count == 0)
				return;

			//try to keep the top-left image the same.
			IPresentationImage topLeftImage = imageBox.TopLeftPresentationImage;

			var command = new MemorableUndoableCommand(imageBox) {BeginState = imageBox.CreateMemento()};

            displaySet.PresentationImages.Sort(item.Comparer);
			imageBox.TopLeftPresentationImage = topLeftImage;
			imageBox.Draw();

			command.EndState = imageBox.CreateMemento();
			if (!command.BeginState.Equals(command.EndState))
			{
				var historyCommand = new DrawableUndoableCommand(imageBox) {Name = SR.CommandSortImages};
			    historyCommand.Enqueue(command);
				Context.Viewer.CommandHistory.AddCommand(historyCommand);
			}
		}
示例#2
0
文件: StackTool.cs 项目: nhannd/Xian
        private bool GetSortMenuItemCheckState(ImageComparerList.Item item)
		{
			return SelectedPresentationImage != null && SelectedPresentationImage.ParentDisplaySet != null &&
			       item.Comparer.Equals(SelectedPresentationImage.ParentDisplaySet.PresentationImages.SortComparer);
		}
示例#3
0
		private static string GetActionKey(ImageComparerList.Item item)
		{
			return item.IsReverse ? string.Format("{0} (Reverse)", item.Name) : item.Name;
		}