private void ProcessList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { Process process = List.SelectedItem as Process; if (process != null) { ImageSource icon = null; string filePath = null; string name = null; try { name = process.ProcessName; filePath = process.MainModule.FileName; icon = GetProcessIcon(filePath); } catch { // Probably security issue } ProcessImage.Source = icon; ProcessName.Text = process.ProcessName; _Selected = process; } } catch (Exception ex) { ErrorWindow.Show(ex); } }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { if (_Selected != null) { DialogResult = true; } else { ErrorWindow.Show("No process selected", "You must select a process to continue"); } }
private void LootWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { HideLoading(); if (e.Error != null) { ErrorWindow.Show(e.Error); return; } LootAnalyzer = (UltimaLootAnalyzer)e.Result; }
private void MobileWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { HideLoading(); if (e.Error != null) { ErrorWindow.Show(e.Error); return; } Mobiles.ItemsSource = (List <string>)e.Result; }
/// <summary> /// Hides loading indicator. /// </summary> public void HideLoading() { try { if (_Loading != null) { _Loading.Stop(); } Loading.Visibility = Visibility.Collapsed; LoadingText.Visibility = Visibility.Collapsed; } catch (Exception ex) { ErrorWindow.Show(ex); } }
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Header.Text = "Process List"; if (e.Error != null) { ErrorWindow.Show(e.Error); } else { List.ItemsSource = (List <Process>)e.Result; if (_Selected != null) { List.SelectedItem = _Selected; List.ScrollIntoView(_Selected); } } }
private void OpenClilocs_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "All Files|*.*"; dialog.CheckPathExists = true; dialog.Title = "Open Clilocs"; if (dialog.ShowDialog() == true) { try { Clilocs = UltimaStringCollection.FromFile(dialog.FileName); } catch (Exception ex) { ErrorWindow.Show(ex); } } }
private void ExportButton_Click(object sender, RoutedEventArgs e) { if (_SaveFileDialog == null) { _SaveFileDialog = new SaveFileDialog(); _SaveFileDialog.Filter = "C# Source File (*.cs)|*.cs"; _SaveFileDialog.CheckPathExists = true; _SaveFileDialog.Title = "Save Class"; } if (_SaveFileDialog.ShowDialog() == true) { try { ShowLoading("Exporting to C# file"); Button button = (Button)sender; uint serial = (uint)button.Tag; ContainerItem item = App.Window.SpyHelper.FindContainerItem(serial); QueryPropertiesResponsePacket properties = App.Window.SpyHelper.FindFirstPacket(serial, typeof(QueryPropertiesResponsePacket)) as QueryPropertiesResponsePacket; if (item != null) { using (FileStream stream = File.Open(_SaveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.None)) { UltimaItemGenerator.Generate(stream, item.ItemID, item.Hue, item.Amount, properties); } } } catch (Exception ex) { ErrorWindow.Show(ex); } finally { HideLoading(); } } }
/// <summary> /// Shows loading indicator. /// </summary> /// <param name="loadingText">Loading text.</param> public void ShowLoading(string loadingText) { try { Loading.Visibility = Visibility.Visible; LoadingText.Visibility = Visibility.Visible; if (_Loading == null) { _Loading = Resources["LootLoadingAnimation"] as Storyboard; } if (_Loading != null) { _Loading.Begin(); } LoadingText.Text = loadingText; } catch (Exception ex) { ErrorWindow.Show(ex); } }