Ejemplo n.º 1
0
        private void btnPasteProfile_Click(object sender, RoutedEventArgs e)
        {
            Global.isDebug = false;
            if (!(Global.Clipboard is ApplicationProfile))
            {
                return;
            }

            ApplicationProfile src = (ApplicationProfile)Global.Clipboard;

            // Since we may be copying from one application to another, we need to re-create an application
            // profile since GTA profiles would not work with Desktop profiles for example.
            ApplicationProfile @new = FocusedApplication.AddNewProfile(src.ProfileName + " - Copy");

            @new.TriggerKeybind = src.TriggerKeybind.Clone();
            @new.Layers.Clear();

            // We then need to copy all layers from the layer on the clipboard to this new profile.
            // Check all the layers types to ensure that they can be added to this application (to prevent
            // crashes when copying a layer from an application that has a special layer unique to that app)
            for (int i = 0; i < src.Layers.Count; i++)
            {
                if (FocusedApplication.IsAllowedLayer(src.Layers[i].Handler.GetType()))
                {
                    @new.Layers.Add((Layer)src.Layers[i].Clone());
                }
            }

            FocusedApplication.SaveProfiles();
        }
        private void SetProfile(ApplicationProfile profile)
        {
            isSettingNewLayer = true;

            DataContext = profile;
            this.keybindEditor.ContextKeybind = profile.TriggerKeybind;

            isSettingNewLayer = false;
        }
Ejemplo n.º 3
0
        private void buttonDeleteProfile_Click(object sender, RoutedEventArgs e)
        {
            if (this.lstProfiles.SelectedIndex > -1)
            {
                if (this.FocusedApplication.Profiles.Count == 1)
                {
                    MessageBox.Show("You cannot delete the last profile!");
                    return;
                }

                if (MessageBox.Show($"Are you sure you want to delete Profile '{((ApplicationProfile)lstProfiles.SelectedItem).ProfileName}'", "Confirm action", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                {
                    int index = this.lstProfiles.SelectedIndex;
                    ApplicationProfile profile = (ApplicationProfile)this.lstProfiles.SelectedItem;

                    this.FocusedApplication.DeleteProfile(profile);

                    //this.lstProfiles.SelectedIndex = Math.Max(0, index - 1);
                }
            }
        }
Ejemplo n.º 4
0
 public Control_ProfileControlPresenter(ApplicationProfile profile) : this()
 {
     Profile = profile;
     grd_LayerControl.IsHitTestVisible = true;
     grd_LayerControl.Effect           = null;
 }