Esempio n. 1
0
        private async void AddProfile(object sender, RoutedEventArgs e)
        {
            var dialog = new CreateProfileDialog("Create profile", Context.DevicesManager);
            var result = (CreateProfileDialogViewModel)await DialogHost.Show(dialog, "RootDialog");

            if (result == null || string.IsNullOrEmpty(result.ProfileName))
            {
                return;
            }

            var profile = Context.ProfilesManager.CreateProfile(result.ProfileName, result.GetInputDevices(), result.GetOutputDevices());

            Context.ProfilesManager.AddProfile(profile);

            ReloadProfileTree();
            OpenProfileWindow(profile);
        }
Esempio n. 2
0
        private async void AddChildProfile(object sender, RoutedEventArgs e)
        {
            if (!GetSelectedItem(out var profileItem))
            {
                return;
            }
            var dialog = new CreateProfileDialog("Create child profile", Context.DevicesManager);
            var result = (CreateProfileDialogViewModel)await DialogHost.Show(dialog, "RootDialog");

            if (result == null || string.IsNullOrEmpty(result.ProfileName))
            {
                return;
            }

            var inputs  = result.GetInputDevices().ConvertAll(d => new DeviceConfiguration(d));
            var outputs = result.GetOutputDevices().ConvertAll(d => new DeviceConfiguration(d));

            var profile = Context.ProfilesManager.CreateProfile(result.ProfileName, inputs, outputs);

            Context.ProfilesManager.AddProfile(profile, profileItem.Profile);

            ReloadProfileTree();
            OpenProfileWindow(profile);
        }