Пример #1
0
        /// <summary>
        /// Removes all data from the Clipboard.
        /// </summary>
        public static void Clear()
        {
#if __ANDROID__
            _clipboardManager.PrimaryClip = null;
#elif __IOS__
            UIPasteboard.General.SetData(null, "kUTTypePlainText");
#elif __MAC__
            NSPasteboard.GeneralPasteboard.ClearContents();
#elif WINDOWS_PHONE_APP
            if (_on10)
            {
                _type10.GetRuntimeMethod("Clear", new Type[0]).Invoke(null, new object[0]);
            }
            else
            {
                global::System.Windows.Clipboard.SetText("");
            }
#elif WINDOWS_PHONE
            global::System.Windows.Clipboard.SetText("");
#elif WIN32
            EmptyClipboard();
#else
            throw new PlatformNotSupportedException();
#endif
            ContentChanged?.Invoke(null, null);
        }
Пример #2
0
 private void onFilterChanged()
 {
     SuspendLayout();    // Avoid repositioning child controls on each box visibility change
     updateVisibilityOfBoxes();
     ResumeLayout(true); // Place controls at their places
     ContentChanged?.Invoke();
 }
Пример #3
0
 protected void NotifyParentContentChange()
 {
     if (AllowParentChangeNotifications)
     {
         ContentChanged?.Invoke(this, new EventArgs());
     }
 }
Пример #4
0
        private void UpdateContent()
        {
            KeyboardHelper.HideKeyboard(this);

            // Remove previous content
            base.RemoveAllViews();

            if (ViewModel?.Content != null)
            {
                // Create and set new content
                var view = ViewModelToViewConverter.Convert(this, ViewModel.Content);
                base.AddView(view);
            }

            else if (ViewModel != null)
            {
                var splashView = ViewModelToViewConverter.GetSplash(this, ViewModel);
                if (splashView != null)
                {
                    base.AddView(splashView);
                }
            }

            ContentChanged?.Invoke(this, new EventArgs());
        }
Пример #5
0
        private void apply(IEnumerable <Discussion> discussions)
        {
            if (discussions == null)
            {
                return;
            }

            bool isResolved(Discussion d) => d.Notes.Any(note => note.Resolvable && !note.Resolved);
            DateTime getTimestamp(Discussion d) => d.Notes.Select(note => note.Updated_At).Max();
            int getNoteCount(Discussion d) => d.Notes.Count();

            IEnumerable <Discussion> cachedDiscussions = getAllBoxes().Select(box => box.Discussion);

            IEnumerable <Discussion> updatedDiscussions = discussions
                                                          .Where(discussion =>
            {
                Discussion cachedDiscussion = cachedDiscussions.SingleOrDefault(d => d.Id == discussion.Id);
                return(cachedDiscussion == null ||
                       (isResolved(cachedDiscussion) != isResolved(discussion) ||
                        getTimestamp(cachedDiscussion) != getTimestamp(discussion) ||
                        getNoteCount(cachedDiscussion) != getNoteCount(discussion)));
            })
                                                          .ToArray(); // force immediate execution

            IEnumerable <Discussion> deletedDiscussions = cachedDiscussions
                                                          .Where(cachedDiscussion => discussions.SingleOrDefault(d => d.Id == cachedDiscussion.Id) == null)
                                                          .ToArray(); // force immediate execution

            if (deletedDiscussions.Any() || updatedDiscussions.Any())
            {
                renderDiscussionsWithSuspendedLayout(deletedDiscussions, updatedDiscussions);
                ContentChanged?.Invoke();
            }
        }
Пример #6
0
 public virtual void OnContentChanged()
 {
     if (ContentChanged != null)
     {
         ContentChanged?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #7
0
        public void NotifyContentChanged()
        {
            if (!initialized)
            {
                return;
            }
            try {
                OnContentChanged();
            } catch (Exception ex) {
                LoggingService.LogInternalError(ex);
            }

            if (extensionChain != null)
            {
                foreach (var ext in extensionChain.GetAllExtensions().OfType <DocumentControllerExtension> ().ToList())
                {
                    ext.RunContentChanged();
                }
            }
            UpdateContentExtensions();
            ContentChanged?.Invoke(this, EventArgs.Empty);
            RefreshExtensions().Ignore();
            contentCallbackRegistry?.InvokeContentChangeCallbacks();

            if (finalViewItem != null)
            {
                // Propagate content change notification to parent controller
                if (!finalViewItem.IsRoot && finalViewItem.Parent != null)
                {
                    finalViewItem.Parent.SourceController?.NotifyContentChanged();
                }
            }
        }
 private void m_fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     if (e.ChangeType == WatcherChangeTypes.Changed)
     {
         ContentChanged?.Invoke(this, e);
     }
 }
Пример #9
0
 private void textBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         ContentChanged?.Invoke(textBox);
     }
 }
Пример #10
0
 private void onUnmuteTimerTick(object sender, EventArgs e)
 {
     if (cleanUpMutedMergeRequests())
     {
         ContentChanged?.Invoke(this);
     }
 }
Пример #11
0
 private void OnContentChanged(EventArgs e)
 {
     if (ContentChanged != null)
     {
         ContentChanged.Invoke(this, e);
     }
 }
Пример #12
0
 // Обработчик при изменении содержимого файла в TexBox из Текстового редактороа
 private void TextBoxContent1_TextChanged(object sender, EventArgs e)
 {
     if (ContentChanged != null)
     {
         ContentChanged.Invoke(this, EventArgs.Empty);
     }
 }
Пример #13
0
        public void ReplaceAll(IEnumerable <T> newRecords, bool doValidate = true, bool clearIDs = false)
        {
            foreach (var model in newRecords)
            {
                SetCurrentFields(model);
                if (clearIDs)
                {
                    model.Id = 0;
                }
                if (doValidate)
                {
                    Validate(model, _db);
                }
            }

            string colxnName = "";

            using (var db = _db.OpenRead())
                colxnName = GetCollection(db).Name;

            using (var db = _db.OpenWrite())
                db.DropCollection(colxnName);

            using (var db = _db.OpenWrite())
            {
                var coll = GetCollection(db);
                EnsureIndeces(coll);
                coll.InsertBulk(newRecords);
            }
            ContentChanged?.Invoke(this, default(T));
        }
Пример #14
0
        private void setGroupCollapsing(ProjectKey projectKey, bool collapse)
        {
            bool isCollapsed = _collapsedProjects.Contains(projectKey);

            if (isCollapsed == collapse)
            {
                return;
            }

            if (collapse)
            {
                _collapsedProjects.Add(projectKey);
            }
            else
            {
                _collapsedProjects.Remove(projectKey);
            }

            NativeMethods.LockWindowUpdate(Handle);
            int vScrollPosition = Win32Tools.GetVerticalScrollPosition(Handle);

            ContentChanged?.Invoke(this);
            Win32Tools.SetVerticalScrollPosition(Handle, vScrollPosition);
            NativeMethods.LockWindowUpdate(IntPtr.Zero);
        }
Пример #15
0
    private void AttemptFoodTransfer(Pot pot)
    {
        //Debug.Log($"Attempt food transfer from {pot.name}");

        // check empty plate and pot food ready
        if (hasFood || !pot.IsFoodReady())
        {
            return;
        }

        // check pot is tilted over plate (dot product with 'up' vectors)
        bool potTilted = Vector3.Dot(pot.transform.up, Vector3.up) < 0f;

        if (!potTilted)
        {
            return;
        }

        // create content in plate
        this.content = pot.GetPotContent();
        foodObject.SetActive(true);
        foodObject.transform.localScale = Vector3.zero;
        foodObject.transform.DOScale(Vector3.one, 0.3f);

        // reset pot
        pot.Reset();

        // trigger plate content changed event for UI
        ContentChanged?.Invoke(content);
    }
Пример #16
0
 public void OnLooseSource(IDataSource source)
 {
     DataReceivers[source].Delete();
     ListChanged -= DataReceivers[source].OnListChange;
     DataReceivers.Remove(source);
     ContentChanged?.Invoke();
 }
Пример #17
0
 private void onDiscussionBoxContentChanged(DiscussionBox sender)
 {
     SuspendLayout();    // Avoid repositioning child controls on changing sender visibility
     updateVisibilityOfBox(sender);
     ResumeLayout(true); // Put child controls at their places
     ContentChanged?.Invoke();
 }
Пример #18
0
        private int WriteBulk(IEnumerable <T> records,
                              Func <LiteCollection <T>, IEnumerable <T>, int> func,
                              bool doValidate, bool setCurrentFields)
        {
            if (records == null || !records.Any())
            {
                return(0);
            }
            foreach (var model in records)
            {
                if (setCurrentFields)
                {
                    SetCurrentFields(model);
                }
                if (doValidate)
                {
                    Validate(model, _db);
                }
            }

            var ret = 0;

            using (var db = _db.OpenWrite())
            {
                var coll = GetCollection(db);
                EnsureIndeces(coll);
                //ret = func(coll, records);
                ret = Retry2x(records, func, coll);

                EnsureIndecesAfterWrite(coll);
            }
            ContentChanged?.Invoke(this, default(T));
            return(ret);
        }
Пример #19
0
        public void ShowForContent(object content)
        {
            if (!Addon.Current.Settings.Get("EnableOverlay", true))
            {
                return;
            }

            bool isChanged = content != OSDContent;

            OSDContent = content;
            RaisePropertyChanged(nameof(OSDContent));

            // Extend timeout
            _closeTimer.Stop();
            _closeTimer.Interval = TimeSpan.FromSeconds(Addon.Current.Settings.Get("DisplayTime", 2));
            _closeTimer.Start();

            if (State == FlyoutViewState.Open)
            {
                if (isChanged)
                {
                    ContentChanged?.Invoke(this, null);
                }
            }
            else
            {
                BeginOpen();
            }
        }
Пример #20
0
 private static IntPtr WinProc(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
 {
     if (msg == InteropValues.WM_CLIPBOARDUPDATE)
     {
         ContentChanged?.Invoke();
     }
     return(IntPtr.Zero);
 }
Пример #21
0
    void SetCallbacks()
    {
        // Naturally, when an item is added or removed, the content is changed, so...
        UnityAction <CSSItem> contentChangeAlert = (CSSItem item) => ContentChanged.Invoke();

        ItemAdded.AddListener(contentChangeAlert);
        ItemRemoved.AddListener(contentChangeAlert);
    }
Пример #22
0
        protected void NotifyParentContentChange()
        {
            if (IsLoading)
            {
                return;
            }

            ContentChanged?.Invoke(this, new EventArgs());
        }
Пример #23
0
    public void Reset()
    {
        foodObject.SetActive(false);
        hasFood = false;
        content = null;

        // trigger plate content changed event for UI
        ContentChanged?.Invoke(content);
    }
Пример #24
0
        private void Control_ContentChanged(object sender, EventArgs e)
        {
            if (ChangedCells.Count > 0)
            {
                ContentChanged?.Invoke(ChangedCells);

                ChangedCells.Clear();
            }
        }
Пример #25
0
 private void fireContentChangedEvent()
 {
     if (ContentRender != null && ContentRender is BrailleIO.Renderer.ICacheingRenderer)
     {
         ((BrailleIO.Renderer.ICacheingRenderer)ContentRender).ContentOrViewHasChanged(this, GetContent());
     }
     if (ContentChanged != null)
     {
         ContentChanged.Invoke(this, null);
     }
 }
Пример #26
0
 public Value this[int row, int column] {
     get {
         CheckRange(row, column);
         return(data[row, column]);
     }
     set {
         CheckRange(row, column);
         data[row, column] = value;
         ContentChanged?.Invoke(this);
         ValueChanged?.Invoke(this);
     }
 }
Пример #27
0
 private void OnClipboardContentChanged(object sender, object e)
 {
     if (isWindowActive)
     {
         isClipboardContentChangedPending = false;
         ContentChanged?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         isClipboardContentChangedPending = true;
     }
 }
Пример #28
0
 internal void Clear()
 {
     if (Nodes.Any())
     {
         foreach (var node in Nodes)
         {
             node.Deselect();
         }
         Nodes.Clear();
         ContentChanged?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #29
0
    public override bool Add(SKSItem item)
    {
        bool itemAdded = base.Add(item);

        if (itemAdded)
        {
            item.belongsTo = this;
            ItemAdded.Invoke(item);
            ContentChanged.Invoke();
        }

        return(itemAdded);
    }
Пример #30
0
    public override bool Remove(SKSItem item)
    {
        bool itemRemoved = base.Remove(item);

        if (itemRemoved)
        {
            item.belongsTo = null;
            ItemRemoved.Invoke(item);
            ContentChanged.Invoke();
        }

        return(itemRemoved);
    }