예제 #1
0
        /// <summary>
        /// Обновить базовое визуальное состояние элемента управления.
        /// </summary>
        /// <param name="state">Состояние, на которое требутся поменять.</param>
        private void UpdateBaseVisualState(CommonStates state)
        {
            VisualStateManager.GoToState(this, state.ToString(), true);

            var page = Content as Page;

            if (page == null)
            {
                return;
            }

            switch (state)
            {
            case CommonStates.Normal:
                if (page.BottomAppBar != null)
                {
                    page.BottomAppBar.Visibility = Visibility.Visible;
                }
                UpdateOneCommandBar(GetCommandBar(Content as DependencyObject));
                break;

            case CommonStates.MenuOpened:
                if (page.BottomAppBar != null)
                {
                    page.BottomAppBar.Visibility = Visibility.Collapsed;
                }
                UpdateOneCommandBar(null);
                break;
            }
        }
예제 #2
0
        private void DrawSockets(Graphics g)
        {
            // g.SmoothingMode = SmoothingMode.HighQuality;

            foreach (var socket in Sockets)
            {
                if (socket.GetType() == typeof(SocketIn))
                {
                    var socketIn = (SocketIn)socket;

                    // draw socket
                    DrawSocket(
                        g,
                        socketIn.Pivot,
                        CommonStates.GetColorByType(socketIn.ValueType),
                        (socketIn.IsConnected()),
                        socketIn.Hub
                        );

                    // draw socket caption
                    DrawSocketCaption(g,
                                      new PointF(socketIn.Pivot.X + SocketSize, socketIn.Pivot.Y), socketIn, Alignment.Left
                                      );
                }

                if (socket.GetType() == typeof(SocketOut))
                {
                    var socketOut = (SocketOut)socket;

                    // draw socket
                    DrawSocket(
                        g,
                        socketOut.Pivot,
                        CommonStates.GetColorByType(socketOut.ValueType),
                        (socketOut.IsConnected()),
                        false
                        );

                    // draw socket caption
                    DrawSocketCaption(g,
                                      new PointF(socketOut.Pivot.X - SocketSize, socketOut.Pivot.Y), socketOut, Alignment.Right
                                      );
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Изменить базовое состояние.
        /// </summary>
        private void ChangeCommonState(CommonStates state)
        {
            string stateName = null;

            switch (state)
            {
            case CommonStates.Normal:
                stateName        = NormalStateName;
                App.CancelGoBack = false;
                break;

            case CommonStates.MenuOpened:
                stateName        = MenuOpenedStateName;
                App.CancelGoBack = true;
                break;
            }
            VisualStateManager.GoToState(this, stateName, true);
        }