/// <summary>
        /// Set grid selection to items.
        /// </summary>
        /// <param name="items">Breaks, which must be selected.</param>
        public void Select(System.Collections.IEnumerable items)
        {
            // Check that editing is not in progress.
            if (IsEditingInProgress)
            {
                throw new NotSupportedException(App.Current.FindString("EditingInProcessExceptionMessage"));
            }

            // Check that all items are breaks.
            foreach (object item in items)
            {
                if (!(item is Break))
                {
                    throw new ArgumentException(App.Current.FindString("BreaksTypeExceptionMessage"));
                }
            }

            // Add items to selection.
            this.Dispatcher.BeginInvoke(new Action(delegate()
            {
                SelectedItems.Clear();
                foreach (object item in items)
                {
                    SelectedItems.Add(item);
                }
            }), System.Windows.Threading.DispatcherPriority.Background);
        }
Esempio n. 2
0
        public virtual void executeCommand(String commandString, bool blocked)
        {
            List <Object> commandMessages = blocked ? new List <Object>() : null;

            parser.ReInit(new MemoryStream(ASCIIEncoding.ASCII.GetBytes(commandString)));
            Object command = null;

            try
            {
                alreadyReceived.Clear();
                while ((command = parser.basicExpr()) != null)
                {
                    OnCommand(new CommandEventArgs(command, ChannelId));
                    if (blocked)
                    {
                        try
                        {
                            while (blocked)
                            {
                                //router.fillMessageList(ChannelId, commandMessages);
                                int count = commandMessages.Count;
                                if (count > 0)
                                {
                                    MessageEventArgs last = (MessageEventArgs)commandMessages[count - 1];
                                    if (last.Type == EventType.RESULT || last.Type == EventType.ERROR)
                                    {
                                        foreach (object message in commandMessages)
                                        {
                                            ((IList)alreadyReceived).Add(message);
                                        }
                                        commandMessages.Clear();
                                        blocked = false;
                                    }
                                }
                                if (blocked)
                                {
                                    Thread.Sleep(new TimeSpan(10000 * 10));
                                }
                            }
                        }
                        catch (ThreadInterruptedException e)
                        {
                            /* TODO for now we just ignore this case */
                        }
                        blocked = true;
                    }
                }
            }
            catch (ParseException e)
            {
                OnMessage(new MessageEventArgs(EventType.PARSE_ERROR, e, ChannelId));
            }
            catch (TokenMgrError e)
            {
                OnMessage(new MessageEventArgs(EventType.PARSE_ERROR, e, ChannelId));
                parser.ReInit(new MemoryStream(ASCIIEncoding.ASCII.GetBytes(commandString)));
            }
        }
Esempio n. 3
0
        public override int GetErrors(int pageIndex, int pageSize, System.Collections.IList errorEntryList)
        {
            //return base.GetErrors(pageIndex, pageSize, errorEntryList);

            var count = base.GetErrors(pageIndex, pageSize, errorEntryList);

            List <ErrorLogEntry> filterErrorEntryList = new List <ErrorLogEntry>();

            foreach (ErrorLogEntry item in errorEntryList)
            {
                if (item.Error.Type == "System.Runtime.InteropServices.COMException")
                {
                    filterErrorEntryList.Add(item);
                }
            }

            errorEntryList.Clear();
            filterErrorEntryList.ForEach(y => errorEntryList.Add(y));


            return(errorEntryList.Count);
        }
            private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
            {
                if (_collectionChangedBackfire)
                {
                    return;
                }

                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    OnItemAdded(e.NewStartingIndex, e.NewItems[0]);
                    break;

                case NotifyCollectionChangedAction.Remove:
                    OnItemRemoved(e.OldStartingIndex);
                    break;

                case NotifyCollectionChangedAction.Reset:
                    _dataSource.Clear();
                    NotifyDataSetChanged();
                    break;
                }
            }
 /// <summary>
 /// Limpa a coleção.
 /// </summary>
 public void Clear()
 {
     _sourceList.Clear();
 }
Esempio n. 6
0
 Clear(System.Collections.IList collection)
 {
     collection.Clear();
 }