public static void SetPlacement(IntPtr windowHandle, Windowplacement placement)
 {
     try
     {
         placement.length  = Marshal.SizeOf(typeof(Windowplacement));
         placement.flags   = 0;
         placement.showCmd = (placement.showCmd == SwShowminimized ? SwShownormal : placement.showCmd);
         SetWindowPlacement(windowHandle, ref placement);
     }
     catch (InvalidOperationException exception)
     {
         // todo: NLOG
         //LogManager.GetCurrentClassLogger().Error(exception);
     }
 }
 private static void SaveToUserSettings(Windowplacement place)
 {
     Properties.Settings.Default.WindowPlacement =
         Newtonsoft.Json.JsonConvert.SerializeObject(place);
     Properties.Settings.Default.Save();
 }
 public void Save(Windowplacement place)
 {
     SaveToUserSettings(place);
 }
 private static extern bool GetWindowPlacement(IntPtr hWnd, out Windowplacement lpwndpl);
 private static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref Windowplacement lpwndpl);