Exemple #1
0
        public Task <SelectDialogPayload> ShowContentSelectDialogAsync(ContentSelectDialogDefaultSet dialogContentSet)
        {
            var choiceListContainer = new ChoiceFromListSelectableContainer(dialogContentSet.ChoiceListTitle, dialogContentSet.ChoiceList);
            var customTextContainer = new TextInputSelectableContainer(dialogContentSet.TextInputTitle, dialogContentSet.GenerateCandiateList);

            var containers = new List <ISelectableContainer>();

            ISelectableContainer firstSelected = null;

            if (!string.IsNullOrEmpty(dialogContentSet.ChoiceListTitle))
            {
                containers.Add(choiceListContainer);

                if (choiceListContainer.Items.Count > 0)
                {
                    firstSelected = choiceListContainer;
                }
                else
                {
                    firstSelected = choiceListContainer;
                }
            }

            if (!string.IsNullOrEmpty(dialogContentSet.TextInputTitle))
            {
                containers.Add(customTextContainer);

                if (firstSelected == null)
                {
                    firstSelected = customTextContainer;
                }
            }

            return(ShowContentSelectDialogAsync(dialogContentSet.DialogTitle, containers, firstSelected));
        }
        public ContentSelectDialogContext(string dialogTitle, IEnumerable <ISelectableContainer> containers, ISelectableContainer firstSelected = null)
        {
            Title = dialogTitle;
            SelectableContainerList = containers.ToList();
            IsSingleContainer       = SelectableContainerList.Count == 1;

            SelectedContainer   = new ReactiveProperty <ISelectableContainer>(CurrentWindowContextScheduler, firstSelected);
            IsValidItemSelected = SelectedContainer.Select(x => x?.IsValidatedSelection ?? false)
                                  .ToReactiveProperty();

            _ContainerItemChangedEventDisposer = SelectedContainer.Subscribe(x =>
            {
                if (_Prev != null)
                {
                    _Prev.SelectionItemChanged -= SelectableContainer_SelectionItemChanged;
                }

                if (x != null)
                {
                    x.SelectionItemChanged += SelectableContainer_SelectionItemChanged;
                }

                _Prev = x;


                if (x != null)
                {
                    SelectableContainer_SelectionItemChanged(x);
                }
            });


            foreach (var container in SelectableContainerList)
            {
                (container as SelectableContainerBase).PropertyChanged += ContentSelectDialogContext_PropertyChanged;
            }

            if (firstSelected != null)
            {
                (firstSelected as SelectableContainerBase).IsSelected = true;
            }
        }
Exemple #3
0
        private async Task <SelectDialogPayload> ShowContentSelectDialogAsync(string dialogTitle, IEnumerable <ISelectableContainer> containers, ISelectableContainer firstSelected)
        {
            var context = new ContentSelectDialogContext(dialogTitle, containers, firstSelected);

            SelectDialogPayload resultContent = null;

            try
            {
                var dialog = new Dialogs.ContentSelectDialog()
                {
                    DataContext = context
                };

                var dialogResult = await dialog.ShowAsync();

                if (dialogResult == Windows.UI.Xaml.Controls.ContentDialogResult.Primary)
                {
                    resultContent = context.GetResult();
                }
            }
            finally
            {
                context?.Dispose();
            }

            return(resultContent);
        }
 private void SelectableContainer_SelectionItemChanged(ISelectableContainer obj)
 {
     IsValidItemSelected.Value = obj.IsValidatedSelection;
 }
        private void ProcessHotkeys()
        {
            if (Event.current.rawType == EventType.KeyDown && Event.current.keyCode == KeyCode.P)
            {
                PlayOrPause();
                Event.current.Use();
            }

            if (Event.current.rawType == EventType.KeyDown && Event.current.keyCode == KeyCode.S)
            {
                Stop();
                Event.current.Use();
            }

            if (Event.current.rawType == EventType.KeyDown && (Event.current.keyCode == KeyCode.Backspace || Event.current.keyCode == KeyCode.Delete))
            {
                foreach (var timelineContainer in contentRenderer.USHierarchy.RootItems)
                {
                    foreach (var timeline in timelineContainer.Children)
                    {
                        var ISelectableContainers = timeline.GetISelectableContainers();
                        foreach (var ISelectableContainer in ISelectableContainers)
                        {
                            ISelectableContainer.DeleteSelection();
                        }
                    }
                }
                Event.current.Use();
            }

            if (Event.current.rawType == EventType.KeyDown && Event.current.keyCode == KeyCode.K && IsInAnimationMode)
            {
                foreach (var root in contentRenderer.USHierarchy.RootItems)
                {
                    if (!root.IsExpanded)
                    {
                        continue;
                    }

                    foreach (var timelineContainer in root.Children)
                    {
                        if (!(timelineContainer is USPropertyTimelineHierarchyItem))
                        {
                            continue;
                        }

                        var propertyTimelineContainer = timelineContainer as USPropertyTimelineHierarchyItem;

                        if (!propertyTimelineContainer.IsExpanded)
                        {
                            continue;
                        }
                    }
                }
                Event.current.Use();
            }

            if (Event.current.shift)
            {
                ContentRenderer.Snap = true;
            }
            else
            {
                ContentRenderer.Snap = false;
            }

            if (Event.current.rawType == EventType.KeyDown && Event.current.keyCode == KeyCode.Period && Event.current.alt)
            {
                GoToNextKeyframe();
                Event.current.Use();
            }
            else if (Event.current.rawType == EventType.KeyDown && Event.current.keyCode == KeyCode.Comma && Event.current.alt)
            {
                GoToPrevKeyframe();
                Event.current.Use();
            }
            else if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Period)
            {
                SetRunningTime((float)Math.Round(CurrentSequence.RunningTime + 0.01f, 2));
                Event.current.Use();
            }
            else if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Comma)
            {
                SetRunningTime((float)Math.Round(CurrentSequence.RunningTime - 0.01f, 2));
                Event.current.Use();
            }

            if (showPopup)
            {
                ActuallyShowPopup();
            }
        }