Example #1
0
 protected void OnFontChanged(object sender, WindowEventArgs e)
 {
     _formatValid = false;
     ConfigureScrollbars();
     Window.Invalidate(false);
     // TODO: return true;
 }
        public void Update(WindowEntity entity)
        {
            Debug.Assert(entity != null, "FormEntity 为 null");

            if (entity == null)
            {
                return;
            }

            //更新索引信息
            XElement element = _indexXml.XPathSelectElement(String.Format(XPATH_index_SelectWindow, entity.Id));

            Debug.Assert(element != null, "更新窗体索引时未找到指定窗体的索引记录");
            if (element != null)
            {
                element.ReplaceWith(GetArchiveIndex(entity));
                SaveIndexFile();

                string   xml      = entity.ToXml();
                XElement xElement = XElement.Parse(xml);

                //更新实体文件
                _packageService.Current.AddFileContent(xml,
                                                       Path.Combine(Constant.PACKAGE_WINDOW_FOLDER, entity.Id));

                //更新缓存
                _cachingService.Add(entity.Id, xElement);

                //发布事件
                WindowEventArgs args = new WindowEventArgs(entity);
                _eventAggregator.GetEvent <WindowUpdatedEvent>().Publish(args);
            }
        }
Example #3
0
        protected override void OnHidden(WindowEventArgs e)
        {
            if (!GetAutoCloseNestedPopups())
            {
                return;
            }

            ChangePopupMenuItem(null);

            if (_allowMultiplePopups)
            {
                foreach (var item in ListItems)
                {
                    if (item == null)
                    {
                        continue;
                    }

                    var menuItem = item as MenuItem;
                    if (menuItem == null)
                    {
                        continue;
                    }

                    if (menuItem.GetPopupMenu() == null)
                    {
                        continue;
                    }

                    var we = new WindowEventArgs(menuItem.GetPopupMenu());
                    menuItem.ClosePopupMenu(false);
                    OnPopupClosed(we);
                }
            }
        }
Example #4
0
        private void SegmentSized_handler(object sender, WindowEventArgs e)
        {
            LayoutSegments();

            // fire event
            OnSegmentSized(e);
        }
        public void Add(WindowEntity entity)
        {
            Debug.Assert(entity != null, "FormEntity 为 null");

            if (entity == null)
            {
                return;
            }

            //添加索引信息
            _indexXml.XPathSelectElement(XPATH_Index_Window).Add(GetArchiveIndex(entity));

            SaveIndexFile();

            string   xml      = entity.ToXml();
            XElement xElement = XElement.Parse(xml);

            //添加实体文件
            _packageService.Current.AddFileContent(xml,
                                                   Path.Combine(Constant.PACKAGE_WINDOW_FOLDER, entity.Id));

            _cachingService.Add(entity.Id, xElement);

            //发布事件
            WindowEventArgs args = new WindowEventArgs(entity);

            _eventAggregator.GetEvent <WindowAddedEvent>().Publish(args);
        }
Example #6
0
 void uiRoleName_TextChange(object sender, WindowEventArgs e)
 {
     if (uiRoleName.Text.Length > 0)
     {
         btnOK.Enable();
     }
 }
Example #7
0
 /// <summary>
 ///		Handler invoked internally when user sizing of segments is enabled or disabled.
 /// </summary>
 /// <param name="e">Events args.</param>
 protected internal void OnDragSizeSettingChanged(WindowEventArgs e)
 {
     if (DragSizeSettingChanged != null)
     {
         DragSizeSettingChanged(this, e);
     }
 }
Example #8
0
 /// <summary>
 ///		Handler invoked internally when the dort direction is changed.
 /// </summary>
 /// <param name="e">Events args.</param>
 protected internal void OnSortDirectionChanged(WindowEventArgs e)
 {
     if (SortDirectionChanged != null)
     {
         SortDirectionChanged(this, e);
     }
 }
Example #9
0
 /// <summary>
 ///		Handler invoked internally when a segment is removed.
 /// </summary>
 /// <param name="e">Events args.</param>
 protected internal void OnSegmentRemoved(WindowEventArgs e)
 {
     if (SegmentRemoved != null)
     {
         SegmentRemoved(this, e);
     }
 }
Example #10
0
 protected internal virtual void OnMaxTextLengthChanged(WindowEventArgs e)
 {
     if (MaxTextLengthChanged != null)
     {
         MaxTextLengthChanged(this, e);
     }
 }
Example #11
0
 protected internal virtual void OnTextInvalidated(WindowEventArgs e)
 {
     if (TextInvalidated != null)
     {
         TextInvalidated(this, e);
     }
 }
Example #12
0
 protected internal virtual void OnValidationStringChanged(WindowEventArgs e)
 {
     if (ValidationPatternChanged != null)
     {
         ValidationPatternChanged(this, e);
     }
 }
Example #13
0
 protected internal virtual void OnInvalidEntryAttempted(WindowEventArgs windowEventArgs)
 {
     if (InvalidEntryAttempted != null)
     {
         InvalidEntryAttempted(this, windowEventArgs);
     }
 }
Example #14
0
 protected internal virtual void OnTextAccepted(WindowEventArgs args)
 {
     if (TextAccepted != null)
     {
         TextAccepted(this, args);
     }
 }
Example #15
0
 protected internal virtual void OnEditboxFull(WindowEventArgs windowEventArgs)
 {
     if (EditboxFull != null)
     {
         EditboxFull(this, windowEventArgs);
     }
 }
Example #16
0
 /// <summary>
 ///		Handler invoked internally when user control of sorting is enabled or disabled.
 /// </summary>
 /// <param name="e">Events args.</param>
 protected internal void OnSortSettingChanged(WindowEventArgs e)
 {
     if (SortSettingChanged != null)
     {
         SortSettingChanged(this, e);
     }
 }
Example #17
0
        /// <summary>
        /// handler function for when thumb tracking begins
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected /*bool*/ void HandleThumbTrackStarted(object sender, WindowEventArgs e)
        {
            // simply trigger our own version of this event
            OnThumbTrackStarted(new WindowEventArgs(this));

            // TODO: return true;
        }
Example #18
0
        /*************************************************************************
        *       Overrides for Event handler methods
        *************************************************************************/

        protected internal override void OnFontChanged(WindowEventArgs e)
        {
            // Propagate to children
            GetEditbox().SetFont(GetFont());
            // Call base class handler
            base.OnFontChanged(e);
        }
Example #19
0
 protected virtual void OnWindowRemoved(WindowEventArgs args)
 {
     if (WindowRemoved != null)
     {
         WindowRemoved(this, args);
     }
 }
        public override void Shown(WindowEventArgs args)
        {
            if (args == null || args.Player < 0 || args.Player > 2)
            {
                throw new ArgumentException(nameof(WindowEventArgs.Player));
            }

            // We're already working on things
            if (BackgroundWorker.IsBusy)
            {
                return;
            }

            // Load newest config
            _player = args.Player;
            var teamConfig = _player == 1 ? _config.Value.Options.PlayerOne.Team : _config.Value.Options.PlayerTwo.Team;

            _workingConfig.MemberIds.Clear();
            _workingConfig.MemberIds.AddRange(teamConfig.MemberIds);

            // Set New buttons
            if (!BackgroundWorkerTeam.IsBusy)
            {
                BackgroundWorkerTeam.RunWorkerAsync();
            }
            BackgroundWorker.RunWorkerAsync();
        }
Example #21
0
 protected virtual void OnWindowSelectionChanged(WindowEventArgs args)
 {
     if (WindowSelectionChanged != null)
     {
         WindowSelectionChanged(this, args);
     }
 }
Example #22
0
 protected virtual void OnWindowAdded(WindowEventArgs args)
 {
     if (FWindowAdded != null)
     {
         FWindowAdded(this, args);
     }
 }
Example #23
0
        /// <summary>
        /// Method called when the dragged object position is changed.
        /// </summary>
        /// <param name="e">
        /// WindowEventArgs object containing any relevant data.
        /// </param>
        protected virtual void OnDragPositionChanged(WindowEventArgs e)
        {
            FireEvent(EventDragPositionChanged, e, EventNamespace);

            var root = GetGUIContext().GetRootWindow();

            if (root != null)
            {
                // this hack with the 'enabled' state is so that getChildAtPosition
                // returns something useful instead of a pointer back to 'this'.
                // This hack is only acceptable because I am CrazyEddie!
                var wasEnabled = d_enabled;
                d_enabled = false;
                // find out which child of root window has the mouse in it
                var eventWindow = root.GetTargetChildAtPosition(GetGUIContext().GetCursor().GetPosition());
                d_enabled = wasEnabled;

                // use root itself if no child was hit
                if (eventWindow == null)
                {
                    eventWindow = root;
                }

                // if the window with the mouse is different to current drop target
                if (eventWindow != _dropTarget)
                {
                    OnDragDropTargetChanged(new DragDropEventArgs(eventWindow)
                    {
                        dragDropItem = this
                    });
                }
            }
        }
Example #24
0
        /// <summary>
        /// Handler called internally when the list contents are changed
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnListContentsChanged(WindowEventArgs e)
        {
            // if we are not currently initialising we might have things todo
            if (!d_initialising)
            {
                Invalidate(false);

                // if auto resize is enabled - do it
                if (AutoResize)
                {
                    SizeToContent();
                }

                // resort list if requested and enabled
                if (_resort && _sortEnabled)
                {
                    SortList(false);
                }
                _resort = false;

                // redo the item layout and fire our event
                LayoutItemWidgets();
                FireEvent(EventListContentsChanged, e);
            }
        }
Example #25
0
        /// <summary>
        ///   Updates the scrollbar's document size to include all the lines,
        ///   and updates the scroll position so that the last line will fit.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void HandleTextChanged(object sender, WindowEventArgs e)
        {
            // set our text to the text of the editbox
            bool atBottom = false;

            if (vertScrollbar.ScrollPosition == vertScrollbar.DocumentSize)
            {
                atBottom = true;
            }

            float textHeight = GetTextHeight();
            float textWidth  = GetTextWidth();

            // Update the scrollbars to take the new text into account
            ConfigureScrollbars(textWidth, textHeight);

            if (scrollFromBottom)
            {
                vertScrollbar.ScrollPosition = textHeight - TextRenderArea.Height;
            }
            // if we were at the bottom, and we need to scroll, scroll to the bottom
            if (atBottom &&
                vertScrollbar.DocumentSize > TextRenderArea.Height)
            {
                vertScrollbar.ScrollPosition = textHeight - TextRenderArea.Height;
            }
        }
Example #26
0
        void HandleWindowSelectionChanged(object sender, WindowEventArgs args)
        {
            var window = args.Window;

            if (window == null)
            {
                return;                 // Might happen during node list creation
            }
            switch (window.WindowType)
            {
            case WindowType.Patch:
            case WindowType.Module:
                ActivePatchNode = window.Node;
                //the hosts window may be null if the plugin is created hidden on startup
                if (FPluginHost.Window != null)
                {
                    FPluginHost.Window.Caption = FActivePatchNode.NodeInfo.Systemname;
                }

                //only redraw if in local scope
                if (!FNodeFilter.ScopeIsGlobal)
                {
                    UpdateView();
                }
                break;
            }

            FNodeView.SetActiveWindow(window);
        }
Example #27
0
 /// <summary>
 ///		Event triggered when progress is complete.
 /// </summary>
 /// <param name="e">Event arguments.</param>
 protected internal virtual void OnProgressDone(WindowEventArgs e)
 {
     if (ProgressDone != null)
     {
         ProgressDone(this, e);
     }
 }
Example #28
0
 /// <summary>
 /// 触发滚动条位置变化事件
 /// </summary>
 /// <param name="e"></param>
 protected internal void OnScrollPositionChanged(WindowEventArgs e)
 {
     if (ScrollPositionChanged != null)
     {
         ScrollPositionChanged(this, e);
     }
 }
Example #29
0
        /// <summary>
        /// set the maximum text length for this Editbox.
        /// </summary>
        /// <param name="maxLenght">
        /// The maximum number of code points (characters) that can be entered into
        /// this Editbox.
        /// </param>
        /// <remarks>
        /// Depending on the validation string set, the actual length of text that
        /// can be entered may be less than the value set here
        /// (it will never be more).
        /// </remarks>
        public override void SetMaxTextLength(int maxLenght)
        {
            if (_maxTextLen != maxLenght)
            {
                _maxTextLen = maxLenght;

                // Trigger max length changed event
                var args = new WindowEventArgs(this);
                OnMaximumTextLengthChanged(args);

                // trim string
                if (GetText().Length > _maxTextLen)
                {
                    var newText = GetText();
                    // TODO: ... hmmm
                    //newText.resize(d_maxTextLen);
                    SetText(newText);
                    OnTextChanged(args);
                    _undoHandler.ClearUndoHistory();

                    var state = GetStringMatchState(GetText());
                    if (_validatorMatchState != state)
                    {
                        OnTextValidityChanged(new RegexMatchStateEventArgs(this, state));
                        _validatorMatchState = state;
                    }
                }
            }
        }
        private void Window_Closed(object sender, WindowEventArgs args)
        {
            App.ClearSettingsWindow();

            var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);

            Utils.SerializePlacement(hWnd);
        }
 private static void OnReactivationTimer(object sender, WindowEventArgs args)
 {
     _reactivationTimer.Stop();
     //            _reactivationTimer.Tick -= OnReactivationTimer;
     _reactivationTimer = null;
     // Both are needed.
     //            Activate();
     //            Focus();
 }
Example #32
0
 private void window_Destroyed(object sender, WindowEventArgs e)
 {
     if (_nubs.ContainsKey(e.Handle)) {
         Nub nub = _nubs[e.Handle];
         nub.Close();
     }
 }
Example #33
0
        private void window_Activated(object sender, WindowEventArgs e)
        {
            if (_nubs.ContainsKey(e.Handle)) {
            //  Console.WriteLine("Contains");
            //  frmNub Nub = _Nubs(hWnd);

            //  if (!Nub.WindowVisible) {
            //    Nub.RestoreWindow();
            //  }
            }
        }