public void UndoRedo_GroupTest_EmptyGroupsAreNotAdded() { var manager = new UndoRedoManager(); manager.ExecuteAction(new UndoableGroupAction("w/e")); Assert.IsFalse(manager.AnyUndos); Assert.IsFalse(manager.AnyRedos); manager.AddAction(new UndoableGroupAction("w/e")); Assert.IsFalse(manager.AnyUndos); Assert.IsFalse(manager.AnyRedos); }
private void UpdateEffectList() { var list = from value in Plugin.Manager.PluginManager.PluginEffectList orderby value.Group.Name ascending group value by value.Group; foreach (var group in list) { RibbonGroup rgGroup = new RibbonGroup(); rgGroup.Header = group.Key.Name; rgGroup.SmallImageSource = group.Key.Image.Source; rgGroup.Tag = group.Key; rtEffects.Items.Add(rgGroup); /* Effects */ IEnumerator <IEffect> effects = group.GetEnumerator(); while (effects.MoveNext()) { RibbonMenuButton btn = new RibbonMenuButton(); btn.Label = effects.Current.Name; btn.SmallImageSource = effects.Current.Icon.Source; btn.ToolTipTitle = effects.Current.Name; btn.ToolTipImageSource = BitmapFrame.Create(new Uri("pack://application:,,, /Effect FX;component/Resources/Info.ico")); btn.ToolTipDescription = effects.Current.Description; btn.ToolTipFooterTitle = effects.Current.Group.Name; btn.ToolTipFooterImageSource = effects.Current.Group.Image.Source; btn.ToolTipFooterDescription = effects.Current.Group.Description; btn.Tag = effects.Current; RibbonGallery gallery = new RibbonGallery(); gallery.MaxHeight = 500; gallery.Command = (ICommand)Resources["cmdImageNull"]; RibbonGalleryCategory cat = new RibbonGalleryCategory(); gallery.Items.Add(cat); for (int i = 0; i < effects.Current.DefaultCount; i++) { RibbonGalleryItem item = new RibbonGalleryItem(); Image image = new Image(); image.Width = 230; image.Height = 124; image.Stretch = Stretch.UniformToFill; image.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; image.Source = BitmapFrame.Create(new Uri("pack://application:,,, /Effect FX;component/Resources/preview.png")); image.Source = effects.Current.DoEffect(image.Source as BitmapSource, i); image.Tag = new KeyValuePair <int, IEffect>(i, effects.Current); previewImageList.Add(image); item.Content = image; cat.Items.Add(item); int finalIndex = i; image.MouseDown += (s, e) => { //Console.WriteLine("OK: " + finalIndex); manager.AddAction((btn.Tag as IEffect).Name, imgPicture.Source as BitmapFrame); imgPicture.Source = (btn.Tag as IEffect).DoEffect( imgPicture.Source as BitmapFrame, finalIndex); UpdatePreviewImages(); gallery.SelectedItem = null; }; } btn.Items.Add(gallery); rgGroup.Items.Add(btn); } //while } //for }