コード例 #1
0
 private async void ActionPerformed(object sender, ModifiedEventArgs args)
 {
     if (this.timeChanged != null)
     {
         args.Action();
     }
 }
コード例 #2
0
        private void MessageEditorModified(object sender, ModifiedEventArgs e)
        {
            if ((e.ModificationTypes & (ModificationTypes.InsertText
                                        | ModificationTypes.DeleteText)) > 0)
            {
                OnModified();
            }

            if (((e.ModificationTypes & ModificationTypes.DeleteText) > 0) &
                (e.LinesAdded == -1))
            {
                var newLine = _messageEditor.Model.LineFromPosition(e.Position);
                if (_messageEditor.Model.PositionFromLine(newLine) != e.Position)
                {
                    var text = _messageEditor.Model.GetTextRange(
                        e.Position, _messageEditor.Model.EndPositionFromLine(newLine));

                    var qm = _quotedLineRx.Match(text);

                    if (qm.Success)
                    {
                        AsyncHelper.Post(
                            () =>
                        {
                            _messageEditor.Selection.Start = e.Position;
                            _messageEditor.Selection.End   = e.Position + qm.Groups["prefix"].Length;
                            _messageEditor.Selection.Text  = string.Empty;
                        });
                    }
                }
            }
        }
コード例 #3
0
 public AsyncTimer(Action actionToBePerformed, int ticks, int interval)
 {
     this.Ticks = ticks;
     this.Interval = interval;
     this.args = new ModifiedEventArgs(actionToBePerformed);
     this.timeChanged = new TimeChangedEventHandler(ActionPerformed);
 }
コード例 #4
0
 /// <summary>
 /// Handles the Modified event of members of the collection.
 /// </summary>
 /// <param name="sender">The object which has raised the event.</param>
 /// <param name="e">The event arguments.</param>
 protected void ContentsModified(object sender, ModifiedEventArgs e)
 {
     if (e != null)
     {
         OnContentsModified(e.ModifiedItem as T);
     }
 }
コード例 #5
0
 public Student(string name, int age)
 {
     this.args = new ModifiedEventArgs();
     this.onChange += new PropertyChangedEventHandler(ActionPerformed);
     this.Name = name;
     this.Age = age;
 }
コード例 #6
0
 private void ConsoleEditorModified(object sender, ModifiedEventArgs e)
 {
     //Блокиробка перед попыткой ввода в область вывода.
     if (e.Position < _editableStartPosition &&
         ((e.ModificationTypes
           & (ModificationTypes.BeforeInsert | ModificationTypes.BeforeDelete)) != 0))
     {
         _consoleEditor.ReadOnly = true;
         SystemSounds.Beep.Play();
     }
     //Обработка после произведения блокировки.
     else if (_consoleEditor.ReadOnly)
     {
         _consoleEditor.ReadOnly      = false;
         _consoleEditor.CaretPosition = _consoleEditor.Model.TextLength;
         _consoleEditor.ScrollToCaret();
     }
     //Парсинг ввода.
     else if (_isPromptMode)
     {
         _userInput = _consoleEditor.Model.GetTextRange(
             _editableStartPosition, _consoleEditor.Model.TextLength);
         _parsedUserInput = ConsoleParser.Parse(_userInput);
     }
 }
コード例 #7
0
 private void ContentsModified(object sender, ModifiedEventArgs e)
 {
     if (e != null)
     {
         OnContentsModified(e.ModifiedItem as SignalboxHours);
     }
 }
コード例 #8
0
        private static void DvManager_FinishedToUpgradeTo(object sender, ModifiedEventArgs e)
        {
            s_logger.Info($"Heavy Modifying DB Count : {e.ModifiedCount}");

            if (e.ModifiedCount > 0)
            {
                SQLiteBaseDao <Dummy> .Vacuum(ConnectionManager.DefaultConnection);
            }
        }
コード例 #9
0
        private void DvManager_FinishedToUpgradeTo(object sender, ModifiedEventArgs e)
        {
            s_logger.Info($"Heavy Modifying AppDB Count : {e.ModifiedCount}");

            if (e.ModifiedCount > 0)
            {
                SQLiteBaseDao <Dummy> .Vacuum(DataAccessManager.AppDao.CurrentConnection);
            }
        }
コード例 #10
0
        internal void ParentModified(object sender, ModifiedEventArgs e)
        {
            Note modifiedItem = e.ModifiedItem as Note;

            if (e.ModifiedField == nameof(modifiedItem.Symbol))
            {
                Symbol = modifiedItem.Symbol;
            }
            else if (e.ModifiedField == nameof(modifiedItem.Definition))
            {
                Definition = modifiedItem.Definition;
            }
        }
コード例 #11
0
        /// <summary>
        /// Invoked when the UI thread needs to perform a modification on a track collection.
        /// </summary>
        /// <param name="sender">The track collection</param>
        /// <param name="e">The event data</param>
        private void ServiceManager_ModifyTracks(object sender, ModifiedEventArgs e)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                try
                {
                    ObservableCollection<TrackData> collection = sender as ObservableCollection<TrackData>;
                    List<TrackData> tracks = e.Data as List<TrackData>;
                    if (collection != null && tracks != null)
                    {
                        switch (e.Type)
                        {
                            case ModifyType.Added:
                                foreach (TrackData track in tracks)
                                    if (!U.ContainsPath(collection, track.Path))
                                        collection.Add(track);
                                break;

                            case ModifyType.Removed:
                                List<TrackData> tracksToRemove = new List<TrackData>();
                                foreach (TrackData track in tracks)
                                {
                                    foreach (TrackData t in collection)
                                        if (t.Path == track.Path)
                                        {
                                            tracksToRemove.Add(t);
                                            break;
                                        }
                                }
                                foreach (TrackData track in tracksToRemove)
                                    collection.Remove(track);
                                break;
                        }
                    }
                }
                catch (Exception exc)
                {
                    U.L(LogLevel.Warning, "MAIN", "Could not modify track collection: " + exc.Message);
                }
            }));
        }
コード例 #12
0
 private void ActionPerformed(object sender, ModifiedEventArgs args)
 {
     args.ShowChanges();
 }
コード例 #13
0
 private void OnItemModified(object?sender, ModifiedEventArgs e)
 {
     RaiseModified(e);
 }
コード例 #14
0
ファイル: ConsoleForm.cs プロジェクト: permyakov/janus
 private void ConsoleEditorModified(object sender, ModifiedEventArgs e)
 {
     //Блокиробка перед попыткой ввода в область вывода.
     if (e.Position < _editableStartPosition
         && ((e.ModificationTypes
             & (ModificationTypes.BeforeInsert | ModificationTypes.BeforeDelete)) != 0))
     {
         _consoleEditor.ReadOnly = true;
         SystemSounds.Beep.Play();
     }
     //Обработка после произведения блокировки.
     else if (_consoleEditor.ReadOnly)
     {
         _consoleEditor.ReadOnly = false;
         _consoleEditor.CaretPosition = _consoleEditor.Model.TextLength;
         _consoleEditor.ScrollToCaret();
     }
     //Парсинг ввода.
     else if (_isPromptMode)
     {
         _userInput = _consoleEditor.Model.GetTextRange(
             _editableStartPosition, _consoleEditor.Model.TextLength);
         _parsedUserInput = ConsoleParser.Parse(_userInput);
     }
 }
コード例 #15
0
ファイル: MessageForm.cs プロジェクト: permyakov/janus
        private void MessageEditorModified(object sender, ModifiedEventArgs e)
        {
            if ((e.ModificationTypes & (ModificationTypes.InsertText
                | ModificationTypes.DeleteText)) > 0)
                OnModified();

            if (((e.ModificationTypes & ModificationTypes.DeleteText) > 0) &
                (e.LinesAdded == -1))
            {
                var newLine = _messageEditor.Model.LineFromPosition(e.Position);
                if (_messageEditor.Model.PositionFromLine(newLine) != e.Position)
                {
                    var text = _messageEditor.Model.GetTextRange(
                        e.Position, _messageEditor.Model.EndPositionFromLine(newLine));

                    var qm = _quotedLineRx.Match(text);

                    if (qm.Success)
                        AsyncHelper.Post(
                            () =>
                            {
                                _messageEditor.Selection.Start = e.Position;
                                _messageEditor.Selection.End = e.Position + qm.Groups["prefix"].Length;
                                _messageEditor.Selection.Text = string.Empty;
                            });
                }
            }
        }
コード例 #16
0
 /// <summary>
 /// Trigger the ModifyTracks event.
 /// </summary>
 /// <param name="collection">The collection that need to be modified</param>
 /// <param name="arguments">The arguments describing the modifications</param>
 public static void DispatchModifyTracks(ObservableCollection<TrackData> collection, ModifiedEventArgs arguments)
 {
     if (ModifyTracks != null)
         ModifyTracks(collection, arguments);
 }
コード例 #17
0
        /// <summary>
        /// Invoked when a playlist has been modified.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private static void PlaylistManager_PlaylistModified(object sender, ModifiedEventArgs e)
        {
            if (!SynchronizePlaylists) return;

            PlaylistData playlist = sender as PlaylistData;
            if (Identity == null || playlist.Owner != Identity.UserID)
                return;

            Thread thread = new Thread(delegate()
            {
                switch (e.Type)
                {
                    case ModifyType.Created:
                        UploadPlaylist(playlist);
                        break;

                    case ModifyType.Removed:
                        syncOutBuffer.Add(new SyncOperation("delete", "playlists", playlist.ID));
                        InitiateSyncTimer();
                        break;
                }
            });
            thread.Name = "Playlist sync thread";
            thread.Priority = ThreadPriority.Lowest;
            thread.Start();
        }
コード例 #18
0
        /// <summary>
        /// Invoked when a playlist is modified
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private void PlaylistManager_PlaylistModified(object sender, ModifiedEventArgs e)
        {
            PlaylistData playlist = sender as PlaylistData;

            if (e.Type == ModifyType.Created)
            {
                CreatePlaylist(playlist, e.Interactive);
            }
            else if (e.Type == ModifyType.Removed)
            {
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                {
                    ((ViewDetails)PlaylistTrackLists[playlist.Name]).Visibility = Visibility.Collapsed;
                    PlaylistTrackLists.Remove(playlist.Name);

                    // remove from context menu
                    for (int i = 0; i < listMenuAddToPlaylist.Items.Count; i++)
                    {
                        if ((string)((MenuItem)listMenuAddToPlaylist.Items[i]).Header == playlist.Name)
                        {
                            listMenuAddToPlaylist.Items.RemoveAt(i);
                            break;
                        }
                    }
                    for (int i = 0; i < listMenuRemoveFromPlaylist.Items.Count; i++)
                    {
                        if ((string)((MenuItem)listMenuRemoveFromPlaylist.Items[i]).Header == playlist.Name)
                        {
                            listMenuRemoveFromPlaylist.Items.RemoveAt(i);
                            break;
                        }
                    }
                    if (listMenuRemoveFromPlaylist.Items.Count == 0)
                        listMenuRemoveFromPlaylist.Visibility = System.Windows.Visibility.Collapsed;

                    PlaybackControls.Search.RemovePlaylist(playlist);

                    for (int i = 0; i < NavigationPane.Playlists.Items.Count; i++)
                    {
                        TreeViewItem tvi = (TreeViewItem)NavigationPane.Playlists.Items[i];
                        if (tvi.Header is DockPanel)
                        {
                            EditableTextBlock tb = ((DockPanel)tvi.Header).Children[1] as EditableTextBlock;
                            if (tb.Text == playlist.Name)
                            {
                                NavigationPane.historyList.Remove(tvi);
                                if (tvi.IsSelected)
                                {
                                    if (NavigationPane.historyList.Count > 0)
                                    {
                                        TreeViewItem prevItem = NavigationPane.historyList[NavigationPane.historyList.Count - 1];
                                        prevItem.IsSelected = true;
                                        prevItem.Focus();
                                    }
                                    else
                                    {
                                        if (SettingsManager.Playlists.Count > 0)
                                            ((TreeViewItem)NavigationPane.Playlists.Items[0]).IsSelected = true;
                                        else
                                            NavigationPane.Music.IsSelected = true;
                                    }
                                }
                                NavigationPane.Playlists.Items.Remove(tvi);
                                break;
                            }
                        }
                    }

                    // fix navigation references
                    if (SettingsManager.CurrentSelectedNavigation == "Playlist:" + playlist.Name)
                        SettingsManager.CurrentSelectedNavigation = "Files";
                    if (SettingsManager.CurrentActiveNavigation == "Playlist:" + playlist.Name)
                        SettingsManager.CurrentActiveNavigation = "Files";
                }));
            }
        }