Example #1
0
        private void RemoveSnapshot_Click(object sender, RoutedEventArgs e)
        {
            int index = uiSnapshots.SelectedIndex;

            foreach (var item in snapshots)
            {
                item.Value.RemoveAt(index);
            }

            uiSnapshots.Items.RemoveAt(index);

            uiSnapshots.SelectedIndex = Math.Min(index, uiSnapshots.Items.Count - 1);
            Tuning?.Invoke(this, EventArgs.Empty);
        }
Example #2
0
        private void Viewport_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (uiSnapshots.Items.Count == 0)
            {
                AddSnapshot_Click(this, e);
                uiSnapshots.SelectedIndex = 0;
            }

            int index = uiSnapshots.SelectedIndex;

            if (index >= 0)
            {
                snapshots[index]          = uiCamera.Transform.Value;
                uiSnapshots.Items[index]  = DateTime.Now.ToLongTimeString();
                uiSnapshots.SelectedIndex = index;
            }

            Tuning?.Invoke(this, e);
        }
Example #3
0
        private void AddSnapshot_Click(object sender, RoutedEventArgs e)
        {
            if (uiSnapshots.Items.Count >= maxSnapshots)
            {
                return;
            }

            PropertyInfo[] selectedObjProperties = TunableTool.GetType().GetProperties()
                                                   .Where(p => snapshots.Count == 0 || snapshots.ContainsKey(p.Name))
                                                   .ToArray();

            StringBuilder title = new StringBuilder();

            foreach (PropertyInfo property in selectedObjProperties)
            {
                string name  = property.Name;
                object value = property.GetValue(TunableTool);

                if (!snapshots.ContainsKey(name))
                {
                    snapshots.Add(name, new List <object>());
                }

                snapshots[name].Add(value);

                title.Append(property.GetCustomAttribute <DisplayNameAttribute>()?.DisplayName ?? name);
                title.Append(" : ");
                title.Append(value);
                title.Append("\r\n");
            }

            uiSnapshots.Items.Add(new TextBlock()
            {
                Text = title.ToString().TrimEnd('\r', '\n')
            });
            uiSnapshots.SelectedIndex = uiSnapshots.Items.Count - 1;
            UpdateButtonsClickable();
            Tuning?.Invoke(this, e);
        }
Example #4
0
        private void RunApp_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (Path.GetExtension(uiAppName.Text) == ".exe")
            {
                string tempFile = Path.GetTempFileName() + ".png";
                Before.ToFile(tempFile, "png");

                try
                {
                    Process app = Process.Start(uiAppName.Text, tempFile);
                    app.WaitForExit();

                    After = Imaging.Image.Create();
                    After.FromFile(tempFile);

                    Tuning?.Invoke(this, e);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Example #5
0
        private void ChangeSnapshot(int index)
        {
            PropertyInfo[] selectedObjProperties = TunableTool.GetType().GetProperties()
                                                   .Where(p => snapshots.Count == 0 || snapshots.ContainsKey(p.Name))
                                                   .ToArray();

            StringBuilder title = new StringBuilder();

            foreach (PropertyInfo property in selectedObjProperties)
            {
                string name  = property.Name;
                object value = property.GetValue(TunableTool);

                snapshots[name][index] = value;

                title.Append(property.GetCustomAttribute <DisplayNameAttribute>()?.DisplayName ?? name);
                title.Append(" : ");
                title.Append(value);
                title.Append("\r\n");
            }

            ((TextBlock)uiSnapshots.Items[index]).Text = title.ToString().TrimEnd('\r', '\n');
            Tuning?.Invoke(this, EventArgs.Empty);
        }
Example #6
0
 private void Properties_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
 {
     Tuning?.Invoke(this, e);
 }
Example #7
0
 private void Tuner_Tuning(object sender, EventArgs e)
 {
     Tuning?.Invoke(this, e);
 }
Example #8
0
 private void OK_Click(object sender, RoutedEventArgs e)
 {
     Tuning?.Invoke(this, e);
 }