public void Push(MirrorOperation operation) { if (operation == null) throw new ArgumentNullException("operation"); var control = new MirrorOperationControl(operation) { Dock = DockStyle.Top }; panel.Controls.Add(control); control.BringToFront(); control.Aborted += (s, e) => { RemoveControl(control); }; operation.Finished += (s, e) => { RemoveControl(control); if (!OperationControls.Any()) { if (AllFinished != null) AllFinished(this, EventArgs.Empty); } else TriggerNextOperation(); }; TriggerNextOperation(); }
public ArrangerElement(int x1, int y1, DataSource dataFile, BitAddress address, IGraphicsCodec codec, Palette palette, MirrorOperation mirror, RotationOperation rotation) { X1 = x1; Y1 = y1; Source = dataFile; SourceAddress = address; Codec = codec; Palette = palette; Mirror = mirror; Rotation = rotation; }
public MirrorOperationControl(MirrorOperation operation) { if (operation == null) { throw new ArgumentNullException("operation"); } InitializeComponent(); _operation = operation; label2.Text = string.Format("{0}\n{1}", _operation.SourceFolder, _operation.DestinationFolder); simulateCheckBox.Checked = Properties.Settings.Default.SimulateFirst; this.SetStyle(ControlStyles.ResizeRedraw, true); }
private void StartOperation(bool reverse) { var task = SelectedTask; if (task == null) { return; } var operation = new MirrorOperation(this, task, reverse); operation.Finished += (s, e) => { UpdateListViewItem(operation.Task); }; mirrorOperationsQueueControl.Push(operation); ShowQueuePanel(); }
/// <summary> /// Performs an in-place mirror of a 2D array's items /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">Array to be mirrored</param> /// <param name="mirror">Mirror operation to apply</param> public static void MirrorArray2D <T>(this T[,] source, MirrorOperation mirror) { int width = source.GetLength(1); int height = source.GetLength(0); if (mirror == MirrorOperation.Horizontal && width > 1) { for (int y = 0; y < height; y++) { for (int x = 0; x < width / 2; x++) { SwapItem(source, x, y, width - 1 - x, y); } } } else if (mirror == MirrorOperation.Vertical && height > 1) { for (int y = 0; y < height / 2; y++) { for (int x = 0; x < width; x++) { SwapItem(source, x, y, x, height - 1 - y); } } } else if (mirror == MirrorOperation.Both && width > 1 && height > 1) { for (int y = 0; y < height / 2; y++) { for (int x = 0; x < width; x++) { SwapItem(source, x, y, width - 1 - x, height - 1 - y); } } // Mirror center row horizontally for arrays with odd number of rows if (height % 2 == 1) { int y = height / 2; for (int x = 0; x < width / 2; x++) { SwapItem(source, x, y, width - 1 - x, y); } } }
/// <param name="guid">GUID of the task to be backed up.</param> public ScheduledBackupExecutor(string guid) { InitializeComponent(); notifyIcon.Icon = Properties.Resources.data_copy_Icon; MirrorTask task = null; using (var taskManager = new TaskManager(readOnly: true)) task = taskManager.LoadTask(guid); if (task == null) { throw new InvalidOperationException("The task does not exist in the XML file."); } _operation = new MirrorOperation(this, task, reverse: false); _operation.Finished += OnOperationFinished; }
public static string MirrorOperationToStr(MirrorOperation m) { string ret = VisionLabPINVOKE.MirrorOperationToStr((int)m); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public static void Mirror(ComplexDoubleImage image, MirrorOperation op) { VisionLabPINVOKE.Mirror__SWIG_14(ComplexDoubleImage.getCPtr(image), (int)op); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); }
public static MagitekResult TryMirrorElement(this Arranger arranger, int elementX, int elementY, MirrorOperation mirror) { if (mirror == MirrorOperation.None) { return(MagitekResult.SuccessResult); } if (arranger.GetElement(elementX, elementY) is ArrangerElement el) { var newMirror = (el.Mirror, mirror) switch { (MirrorOperation.Horizontal, MirrorOperation.Horizontal) => MirrorOperation.None, (MirrorOperation.Vertical, MirrorOperation.Horizontal) => MirrorOperation.Both, (MirrorOperation.Both, MirrorOperation.Horizontal) => MirrorOperation.Vertical, (MirrorOperation.Horizontal, MirrorOperation.Vertical) => MirrorOperation.Both, (MirrorOperation.Vertical, MirrorOperation.Vertical) => MirrorOperation.None, (MirrorOperation.Both, MirrorOperation.Vertical) => MirrorOperation.Horizontal, (MirrorOperation.Horizontal, MirrorOperation.Both) => MirrorOperation.Vertical, (MirrorOperation.Vertical, MirrorOperation.Both) => MirrorOperation.Horizontal, (MirrorOperation.Both, MirrorOperation.Both) => MirrorOperation.None, (MirrorOperation.None, _) => mirror, (_, MirrorOperation.None) => el.Mirror, _ => el.Mirror }; var mirroredElement = el.WithMirror(newMirror); arranger.SetElement(mirroredElement, elementX, elementY); return(MagitekResult.SuccessResult); } return(new MagitekResult.Failed($"No element present at position ({elementX}, {elementY}) to be mirrored")); }
public MirrorElementHistoryAction(int elementX, int elementY, MirrorOperation mirror) { ElementX = elementX; ElementY = elementY; Mirror = mirror; }