Exemplo n.º 1
0
        public void RemoveSelected()
        {
            if (dlginstance.Phrase(FocusedEditPhrase) == null)
            {
                if (dlginstance.Timeline(FocusedEditTimeline) == null)
                {
                    return;
                }
                //
                dlginstance.RemoveTimeline(FocusedEditTimeline);

                this.Refresh();
                Changed             = true;
                FocusedEditTimeline = -1;

                return;
            }

            dlginstance.RemovePhrase(FocusedEditPhrase);

            this.Refresh();

            Changed           = true;
            FocusedEditPhrase = -1;
            SelectedChanged.Invoke(null);
        }
Exemplo n.º 2
0
 public void OnSelectedChanged(bool selected)
 {
     SelectedChanged?.Invoke(this, new SelectedChangedArgs
     {
         Selected = selected
     });
 }
Exemplo n.º 3
0
        public void AddChildrenViews(IList <TabViewChildren> Children)
        {
            grid.Children.Clear();
            grid.ColumnDefinitions.Clear();
            Views.Clear();
            RadioBehaviors.Clear();

            for (int i = 0; i < Children.Count; ++i)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                RadioBehavior radioBehavior = new RadioBehavior()
                {
                    IsChecked = i == 0
                };
                TabViewChildren children = Children[i];
                Views.Add(children.View);
                RadioBehaviors.Add(radioBehavior);
                var tabbedView = new TabbedImageLabelView(children, radioBehavior)
                {
                    Margin = new Thickness(0, 3, 0, 0),
                };
                tabbedView.IndexSelectedChanged += (sendor, e) =>
                {
                    var view  = sendor as TabbedImageLabelView;
                    int index = RadioBehaviors.IndexOf(view.radioBehavior);
                    SelectedChanged?.Invoke(this,
                                            new TabViewChangedEventArgs(index, ChildrenViews[index]));
                };

                grid.Children.Add(tabbedView);
                viewGroup.Children.Add(children.View);
                SetColumn(tabbedView, i);
            }
        }
Exemplo n.º 4
0
        public override void Draw()
        {
            if (this.Style == null)
            {
                this.Style = UnityEngine.GUI.skin.button;
            }

            if (this.Visible)
            {
                if (Selected > this.Buttons.Count - 1)
                {
                    Selected = this.Buttons.Count - 1;
                }
                else if (Selected < 0)
                {
                    Selected = 0;
                }

                int S = UnityEngine.GUILayout.Toolbar(Selected, Buttons.ToArray(), Style, Options);
                if (S != Selected)
                {
                    SelectedChanged?.Invoke(this);
                }
                Selected = S;
            }
        }
Exemplo n.º 5
0
        public void Select(bool selected = true)
        {
            if (Group != null)
            {
                foreach (var other in Group)
                {
                    if (ReferenceEquals(this, other))
                    {
                        continue;
                    }

                    other.Selected = false;
                }

                // Group requires one to be checked.
                if (Selected && !selected)
                {
                    return;
                }
            }

            var old = Selected;

            Selected = selected;

            if (old != Selected)
            {
                SelectedChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 6
0
 public void SetSelected(bool selected)
 {
     if (selected != Selected)
     {
         Selected = selected;
         SelectedChanged?.Invoke(this, Selected);
         UpdateColor();
     }
 }
Exemplo n.º 7
0
        public async Task ApplySamples(HttpClient httpClient, IEnumerable <SampleItem> samples)
        {
            var sampleManager = new SampleManager(httpClient, FileSystemRepository, FavoriteRepository);
            var hasChanges    = await sampleManager.ApplySamples(samples);

            if (hasChanges)
            {
                SelectedChanged?.Invoke();
            }
        }
Exemplo n.º 8
0
        public async Task DeleteFileSystemItem(Guid itemKey)
        {
            var deleted = await FileSystemRepository.DeleteFileSystemItem(itemKey);

            if (Selected == deleted.Key)
            {
                await SetSelected(InputStreamItem.Key);
            }
            SelectedChanged?.Invoke();
        }
Exemplo n.º 9
0
        private void FileListItem_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (AllowSelect)
            {
                Selected = !Selected;
            }
            SelectedChanged?.Invoke(this, EventArgs.Empty);

            PreviewMouseLeftButtonUp -= FileListItem_PreviewMouseLeftButtonUp;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Selects a specified label. Changes the label to the selection
        /// colour, and scrolls to show entry if necessary Also invokes
        /// SelectionChanged event.
        /// </summary>
        /// <param name="label">Label to select.</param>
        /// <param name="index">Index of selected item.</param>
        protected void Select(Label label, int index)
        {
            if (index == -1)
            {
                if (this.selectedLabel != null)
                {
                    this.selectedLabel.Color = Color.Black;
                }

                this.selectedIndex = index;
            }
            else
            {
                if (label != this.selectedLabel)
                {
                    // Deselect current item
                    if (this.selectedLabel != null)
                    {
                        this.selectedLabel.Color = Color.Black;
                    }
                    // Select new item
                    this.selectedLabel       = label;
                    this.selectedLabel.Color = Color.Blue;

                    this.selectedItemBg.X       = this.selectedLabel.X;
                    this.selectedItemBg.Y       = this.selectedLabel.Y;
                    this.selectedItemBg.Width   = this.selectedLabel.Width;
                    this.selectedItemBg.Height  = this.selectedLabel.Height;
                    this.selectedItemBg.Visible = true;

                    this.selectedIndex = index;
                }

                if (SelectedChanged != null)
                {
                    SelectedChanged.Invoke(this);
                }

                // Automatically scroll to selected item
                if (-(this.selectedLabel.Y + this.selectedLabel.Height) <
                    (this.surface.Y - this.viewPort.Height)
                    ) // Scroll down
                {
                    this.surface.Y = (this.viewPort.Height -
                                      (this.selectedLabel.Y + this.selectedLabel.Height));
                    this.scrollBar.Value = -this.surface.Y;
                }
                else if (-this.selectedLabel.Y > this.surface.Y) // Scroll up
                {
                    this.surface.Y       = -this.selectedLabel.Y;
                    this.scrollBar.Value = -this.surface.Y;
                }
            }
        }
Exemplo n.º 11
0
        // --------------------------------------------------------------------

        private void ListViewMeshes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView.SelectedIndices.Count > 0)
            {
                mSelectedIndex = listView.SelectedIndices[0];
                SelectedChanged?.Invoke(this, e);
            }
            else
            {
                mSelectedIndex = -1;
            }
        }
Exemplo n.º 12
0
 public StoreShellItem(string regPath, bool isPublic, bool isSelect = true) : base(regPath)
 {
     this.IsPublic = isPublic;
     if (isSelect)
     {
         this.ContextMenuStrip = null;
         this.AddCtr(chkSelected);
         ChkVisible.Visible          = BtnShowMenu.Visible = BtnSubItems.Visible = false;
         this.MouseClick            += (sender, e) => chkSelected.Checked = !chkSelected.Checked;
         chkSelected.CheckedChanged += (sender, e) => SelectedChanged?.Invoke();
     }
     RegTrustedInstaller.TakeRegTreeOwnerShip(regPath);
 }
Exemplo n.º 13
0
        public async Task SaveFavoriteItemViewModel(FavoriteItemViewModel model)
        {
            if (model.Key == default(Guid))
            {
                await FavoriteRepository.CreateFavorite(model.Title, model.FileKey, model.Command);
            }
            else
            {
                await FavoriteRepository.EditFavorite(model.Title, model.FileKey, model.Command, model.Key);
            }

            SelectedChanged?.Invoke();
        }
Exemplo n.º 14
0
        public async Task ExecuteFavoriteItemViewModel(Guid key)
        {
            var item = await FavoriteRepository.GetItem(key);

            CommandExecutionModel.CommandText = item.Command;

            if (Selected != item.FileKey)
            {
                await SetSelected(item.FileKey);
            }

            SelectedChanged?.Invoke();

            await CommandExecutionModel.RunCommand();
        }
Exemplo n.º 15
0
        /// <summary>
        /// 选择变化后的处理
        /// </summary>
        /// <param name="p_unselectItem"></param>
        /// <param name="p_selectItem"></param>
        void AfterSelectionChanged(TabItem p_unselectItem, TabItem p_selectItem)
        {
            // 设置内容
            TabItem item = SelectedItem;

            if (item != null)
            {
                SelectedContent = item.Content;
                if (!ShowContent)
                {
                    // 弹出式
                    if (_dlg == null)
                    {
                        CreateDlg();
                    }

                    if (TabStripPlacement == ItemPlacement.Left || TabStripPlacement == ItemPlacement.Right)
                    {
                        if (item.ReadLocalValue(TabItem.PopWidthProperty) != DependencyProperty.UnsetValue)
                        {
                            _dlg.Width  = item.PopWidth;
                            _dlg.Height = _itemsPanel.ActualHeight;
                        }
                    }
                    else
                    {
                        if (item.ReadLocalValue(TabItem.PopHeightProperty) != DependencyProperty.UnsetValue)
                        {
                            _dlg.Height = item.PopHeight;
                            _dlg.Width  = _itemsPanel.ActualWidth;
                        }
                    }

                    _dlg.Show();
                }
            }
            else
            {
                SelectedContent = null;
                if (!ShowContent && _dlg != null)
                {
                    _dlg.Close();
                }
            }

            SelectedChanged?.Invoke(this, new SelectedChangedEventArgs(p_unselectItem, p_selectItem));
        }
        public override void Draw()
        {
            if (this.Style == null)
            {
                this.Style = UnityEngine.GUI.skin.button;
            }

            if (this.Visible)
            {
                int S = UnityEngine.GUILayout.SelectionGrid(Selected, Buttons.ToArray(), NumRows, Style, Options);
                if (S != Selected)
                {
                    SelectedChanged?.Invoke(this);
                }
                Selected = S;
            }
        }
Exemplo n.º 17
0
        async void SelectedPropertyChanged(HamburgerButtonInfo previous, HamburgerButtonInfo value)
        {
            if ((value?.Equals(previous) ?? false))
            {
                value.IsChecked = (value.ButtonType == HamburgerButtonInfo.ButtonTypes.Toggle);
            }

            SelectedChanged?.Invoke(this, new ChangedEventArgs <HamburgerButtonInfo>(previous, value));

            try
            {
                await UpdateSelectedAsync(previous, value);
            }
            catch (Exception ex)
            {
                DebugWrite($"Catch Ex.Message: {ex.Message}", caller: "SelectedPropertyChanged");
            }
        }
Exemplo n.º 18
0
        public void Clear()
        {
            FocusedEditPhrase   = -1;
            FocusedPhrase       = -1;
            FocusedTimeline     = -1;
            FocusedEditTimeline = -1;
            dlg.Clear();
            dlg.ClearHistory();

            if (imageContainer != null)
            {
                imageContainer.Dispose();
                File.Delete(imageContainer.FileName);
            }
            imageContainer = new jzip.Container();

            dlg = new DBacklog(new Dialog(imageContainer));

            SelectedChanged.Invoke(null);
        }
Exemplo n.º 19
0
        private void Mark_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var pm = (VectorPlacemark)sender;

            if (pm == null)
            {
                return;
            }
            var limeGreen = new SolidColorBrush(Colors.LimeGreen);

            if (((SolidColorBrush)pm.Fill).Color == limeGreen.Color)
            {
                pm.Fill = new SolidColorBrush(Colors.Gold);
            }
            else
            {
                pm.Fill = limeGreen;
            }
            SelectedChanged?.Invoke(this, e);
        }
Exemplo n.º 20
0
        public async Task SelectWorkspaceItem(Guid key, bool isFavorite = false)
        {
            if (isFavorite)
            {
                await ExecuteFavoriteItemViewModel(key);
            }
            else
            {
                var prevSelected = Selected;
                await SetSelected(key);

                if (prevSelected != default(Guid) && prevSelected != Selected && GetTextEditorText != null)
                {
                    var content = await GetTextEditorText.Invoke();

                    await FileSystemRepository.SetFileContent(prevSelected, content);
                }

                SelectedChanged?.Invoke();
            }
        }
Exemplo n.º 21
0
        public TabView(IList <TabViewChildren> Children)
        {
            InitializeComponent();

            Views          = new List <ContentView>();
            RadioBehaviors = new List <RadioBehavior>();
            //ItemsSource = new ObservableCollection<TabViewChildren>();
            //ItemsSource.CollectionChanged += ItemsSource_CollectionChanged;

            for (int i = 0; i < Children.Count; ++i)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                RadioBehavior radioBehavior = new RadioBehavior()
                {
                    IsChecked = i == 0
                };
                TabViewChildren children = Children[i];
                Views.Add(children.View);
                RadioBehaviors.Add(radioBehavior);

                var tabbedView = new TabbedImageLabelView(children, radioBehavior)
                {
                    Margin = new Thickness(0, 3, 0, 0),
                };

                tabbedView.IndexSelectedChanged += (sendor, e) =>
                {
                    var view  = sendor as TabbedImageLabelView;
                    int index = RadioBehaviors.IndexOf(view.radioBehavior);
                    SelectedChanged?.Invoke(this,
                                            new TabViewChangedEventArgs(index, Children[index].View));
                };

                grid.Children.Add(tabbedView);
                viewGroup.Children.Add(children.View);
                SetColumn(tabbedView, i);
            }
        }
        private void Map_MouseClick(object sender, MouseEventArgs e)
        {
            var point = _map.ScreenToGeographic(e.Location);

            var selectedStore = FindShop(point, _selectedLayer);

            if (selectedStore != null)
            {
                _selectedLayer.Items.Remove(selectedStore);
                _layer.Items.Add(selectedStore);
                SelectedChanged?.Invoke(this, e);
            }
            else
            {
                var store = FindShop(point, _layer);
                if (store != null)
                {
                    _layer.Items.Remove(store);
                    _selectedLayer.Items.Add(store);
                    SelectedChanged?.Invoke(this, e);
                }
            }
        }
Exemplo n.º 23
0
 //	protecteds
 /// <summary>
 /// Вызов OnPropertyChanged("Current") и соответствующего события
 /// </summary>
 /// <param name="value">Выбор для передачи в событие</param>
 protected virtual void OnSelectedChanged(T value)
 {
     SelectedChanged?.Invoke(this, new EventArgs <T>(value));
 }
Exemplo n.º 24
0
 protected virtual void OnSelectedChanged(SelectButton selection)
 {
     SelectedChanged?.Invoke(this, new EventArgs());
 }
Exemplo n.º 25
0
 protected void OnSelectedChanged()
 {
     SelectedChanged?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 26
0
 private void CB_CheckedChanged(object sender, EventArgs e) => SelectedChanged?.Invoke(this, e);
Exemplo n.º 27
0
 public void FireSelected()
 {
     SelectedChanged.Invoke(this);
 }
Exemplo n.º 28
0
 private void MultiSelect_SelectionChanged(object sender, EventArgs e) => SelectedChanged?.Invoke(this, e);
Exemplo n.º 29
0
 public void SetSelected(bool selected)
 {
     Selected  = selected;
     BackColor = Selected ? Color.LightGreen : Color.White;
     SelectedChanged?.Invoke(this, Selected);
 }
Exemplo n.º 30
0
 protected virtual void OnSelectedChanged() => SelectedChanged?.Invoke(this, Selected);