private void bt_maxmin_Click(object sender, RoutedEventArgs e) { CheckPros(); ProAccBinding selinstance = (sender as Button).DataContext as ProAccBinding; IntPtr hwndMain = selinstance.pro.MainWindowHandle; SetForegroundWindow(hwndMain); }
private void lv_gfx_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lv_instances.SelectedIndex >= 0) { CheckPros(); ProAccBinding selinstance = lv_instances.SelectedItem as ProAccBinding; IntPtr hwndMain = selinstance.pro.MainWindowHandle; SetForegroundWindow(hwndMain); } }
private void bt_closeinstance_Click(object sender, RoutedEventArgs e) { CheckPros(); ProAccBinding selinstance = (sender as Button).DataContext as ProAccBinding; try{ selinstance.pro.Kill(); } catch { } // logging not required? Globals.LinkedAccs.Remove(selinstance); }
private void bt_closeinstance_Click(object sender, RoutedEventArgs e) { CheckPros(); ProAccBinding selinstance = (sender as Button).DataContext as ProAccBinding; try { if (!selinstance.pro.CloseMainWindow()) { selinstance.pro.Kill(); } if (!selinstance.pro.WaitForExit(1000)) { selinstance.pro.Kill(); } } catch { } Globals.LinkedAccs.Remove(selinstance); }