Пример #1
0
        /// <summary>
        /// Shows error window.
        /// </summary>
        /// <param name="ex">Exception to show.</param>
        public static void Show( Exception ex )
        {
            ErrorWindow window = new ErrorWindow();
            window.ErrorTitle.Text = ex.Message;
            window.ErrorMessage.Text = ex.StackTrace;

            window.ShowDialog();
        }
Пример #2
0
        /// <summary>
        /// Shows error window.
        /// </summary>
        /// <param name="ex">Exception to show.</param>
        public static void Show( string title, string format, params string[] args )
        {
            ErrorWindow window = new ErrorWindow();
            window.ErrorTitle.Text = title;
            window.ErrorMessage.Text = String.Format( format, args );

            window.ShowDialog();
        }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
        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();
                }
            }
        }
Пример #6
0
        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;
                    string      title    = null;

                    try
                    {
                        name     = process.ProcessName;
                        filePath = process.MainModule.FileName;
                        icon     = GetProcessIcon(filePath);
                        title    = process.MainWindowTitle;
                    }
                    catch
                    {
                        // Probably security issue
                    }

                    ProcessImage.Source = icon;
                    ProcessName.Text    = title ?? process.ProcessName;

                    _Selected = process;
                }
            }
            catch (Exception ex)
            {
                ErrorWindow.Show(ex);
            }
        }
Пример #7
0
        /// <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);
            }
        }