private void TriggerEvent(string cmd, object o) { try { switch (cmd) { case WindowsCmdConsts.Next_Image: if (ImageLIst.SelectedIndex < ImageLIst.Items.Count - 1) { FileItem item = ImageLIst.SelectedItem as FileItem; if (item != null) { int ind = ImageLIst.Items.IndexOf(item); ImageLIst.SelectedIndex = ind + 1; } item = ImageLIst.SelectedItem as FileItem; if (item != null) { ImageLIst.ScrollIntoView(item); } } break; case WindowsCmdConsts.Prev_Image: if (ImageLIst.SelectedIndex > 0) { FileItem item = ImageLIst.SelectedItem as FileItem; if (item != null) { int ind = ImageLIst.Items.IndexOf(item); ImageLIst.SelectedIndex = ind - 1; } item = ImageLIst.SelectedItem as FileItem; if (item != null) { ImageLIst.ScrollIntoView(item); } } break; case WindowsCmdConsts.Like_Image: if (ImageLIst.SelectedItem != null) { FileItem item = null; if (o != null) { item = ServiceProvider.Settings.DefaultSession.GetByName(o as string); } else { item = ImageLIst.SelectedItem as FileItem; } if (item != null) { item.IsLiked = !item.IsLiked; } } break; case WindowsCmdConsts.Unlike_Image: if (ImageLIst.SelectedItem != null) { FileItem item = null; if (o != null) { item = ServiceProvider.Settings.DefaultSession .GetByName(o as string); } else { item = ImageLIst.SelectedItem as FileItem; } if (item != null) { item.IsUnLiked = !item.IsUnLiked; } } break; case WindowsCmdConsts.Del_Image: { DeleteItem(); } break; case WindowsCmdConsts.SelectAll_Image: { ServiceProvider.Settings.DefaultSession.SelectAll(); } break; case WindowsCmdConsts.Select_Image: FileItem fileItem = o as FileItem; if (fileItem != null) { ImageLIst.SelectedValue = fileItem; ImageLIst.ScrollIntoView(fileItem); } break; case WindowsCmdConsts.Refresh_Image: RefreshImage(); break; case WindowsCmdConsts.Zoom_Image_Fit: ZoomAndPanControl.ScaleToFit(); break; case WindowsCmdConsts.Zoom_Image_60: ZoomToFocus(); LoadFullRes(); ZoomAndPanControl.ZoomTo(0.6); break; case WindowsCmdConsts.Zoom_Image_100: ZoomToFocus(); LoadFullRes(); ZoomAndPanControl.ZoomTo(1.0); break; case WindowsCmdConsts.Zoom_Image_200: ZoomToFocus(); LoadFullRes(); ZoomAndPanControl.ZoomTo(2.0); break; case WindowsCmdConsts.RotateLeft: { FileItem item = ImageLIst.SelectedItem as FileItem; if (item != null) { item.Rotation--; } } break; case WindowsCmdConsts.RotateRight: { FileItem item = ImageLIst.SelectedItem as FileItem; if (item != null) { item.Rotation++; } } break; case WindowsCmdConsts.ViewExternal: OpenInExternalViewer(); break; case WindowsCmdConsts.ViewExplorer: OpenInExplorer(); break; case WindowsCmdConsts.RefreshDisplay: if (LayoutViewModel.ZoomIndex == 0) { ZoomAndPanControl.ScaleToFit(); } break; } if (cmd.StartsWith(WindowsCmdConsts.ZoomPoint)) { if (ZoomAndPanControl != null && cmd.Contains("_")) { var vals = cmd.Split('_'); if (vals.Count() > 2) { double x; double y; double.TryParse(vals[1], out x); double.TryParse(vals[2], out y); //if (cmd.EndsWith("!")) // // ZoomAndPanControl.SnapToRation(x, y); //else //{ // // ZoomAndPanControl.AnimatedSnapToRation(x, y); //} } } } } catch (Exception exception) { Log.Error("Unable to process event ", exception); } }