private void RemoveCommands()
        {
            CommandItems.Clear();

            _toolBarsCommandItem.Dispose();
            _toolBarsCommandItem = null;
        }
Example #2
0
        /// <summary>
        /// Merges the node collections.
        /// </summary>
        /// <param name="nodeCollections">
        /// The collections of command item nodes that define the menu.
        /// </param>
        public void Update(params IEnumerable <MergeableNodeCollection <ICommandItem> >[] nodeCollections)
        {
            // Remove event handlers.
            foreach (var item in CommandItems)
            {
                PropertyChangedEventManager.RemoveListener(item, this, nameof(ICommandItem.IsVisible));
            }

            // Merge all command item collections.
            Nodes.Clear();
            MergeNodes(Nodes, nodeCollections);

            // Remove empty toolbars.
            RemoveEmptyGroups(Nodes);

            // Add items to CommandItems list.
            CommandItems.Clear();
            CollectCommandItems(Nodes);

            // Create toolbars.
            ToolBars.Clear();
            CreateToolBars();

            // Coerce visibility of all newly generated items.
            CoerceVisibility();

            // Add event handler to command items to observe visibility changes.
            foreach (var item in CommandItems)
            {
                PropertyChangedEventManager.AddListener(item, this, nameof(ICommandItem.IsVisible));
            }
        }
Example #3
0
        protected override void OnShutdown()
        {
            Editor.Services.GetInstance <IAboutService>()?.ExtensionDescriptions.Remove(_extensionDescription);

            Editor.Services.GetInstance <IOptionsService>()?.OptionsNodeCollections.Remove(_optionsNodes);
            _optionsNodes = null;

            Editor.ToolBarNodeCollections.Remove(_toolBarNodes);
            _toolBarNodes = null;

            CommandItems.Clear();

            EditorHelper.UnregisterResources(_resourceDictionary);
        }
Example #4
0
 private void RemoveCommands()
 {
     CommandItems.Clear();
 }
Example #5
0
 private void RemoveCommands()
 {
     CommandItems.Clear();
     _quickFindCommandItem = null;
 }
Example #6
0
 private void RemoveCommands()
 {
     CommandItems.Clear();
     _syntaxHighlightingItem = null;
 }
Example #7
0
        private async void LotSelectedItemChange()
        {
            try
            {
                if (this.LotSelected == null)
                {
                    this.NameLot = "Seleccione un lote...";
                    return;
                }
                this.NameLot = this.LotSelected.NameLot;
                UserDialogs.Instance.ShowLoading("Obteniendo comandos...", MaskType.Black);
                //ApiSrv = new Services.ApiService(ApiConsult.ApiAuth);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!TokenValidator.IsValid(TokenMenuB))
                    {
                        if (!await ApiIsOnline())
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            if (!await GetTokenSuccess())
                            {
                                UserDialogs.Instance.HideLoading();
                                Toast.ShowError(AlertMessages.Error);
                                return;
                            }
                            else
                            {
                                TokenMenuB = TokenGet;
                            }
                        }
                    }
                    LogInquirieGetCommandsQueryValues logInquirieGetCommandsQueryValues = new LogInquirieGetCommandsQueryValues()
                    {
                        IdLot = this.LotSelected.IdLot
                    };
                    Response resultGetCommands = await ApiSrv.LogInquirieGetCommands(TokenMenuB.Key, logInquirieGetCommandsQueryValues);

                    if (!resultGetCommands.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        Commands = JsonConvert.DeserializeObject <List <LogInquiriesCommand> >(Crypto.DecodeString(resultGetCommands.Data));
                        if (CommandItems == null)
                        {
                            CommandItems = new ObservableCollection <PickerCommandItem>();
                        }
                        else
                        {
                            CommandItems.Clear();
                        }
                        foreach (LogInquiriesCommand logInquiriesCommand in Commands)
                        {
                            CommandItems.Add(new PickerCommandItem()
                            {
                                IdCommand   = logInquiriesCommand.IdCommand,
                                NameCommand = logInquiriesCommand.Command,
                                NameDisplay = (logInquiriesCommand.Command.Length > 20) ? logInquiriesCommand.Command.Substring(0, 20) + "..." : logInquiriesCommand.Command,
                                CodeCommand = logInquiriesCommand.Command.Split('-')[0].Trim()
                            });
                        }
                        UserDialogs.Instance.HideLoading();
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }