//private void NoButton_Click(object sender, RoutedEventArgs e)
        //{
        //    InputBox.Visibility = System.Windows.Visibility.Collapsed;
        //}

        //private void CoolButton_Click(object sender, RoutedEventArgs e)
        //{
        //    InputBox.Visibility = System.Windows.Visibility.Visible;
        //}

        private void btn_logout_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Khi bạn đăng xuất thì các tác vụ sao lưu sẽ không hoạt động? Bạn có muốn đăng xuất không?", "Thông báo", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                var            BYTESAVE_API_PBL = System.Configuration.ConfigurationManager.AppSettings["BYTESAVE_API_PBL"];
                HttpWebRequest WebReq           = (HttpWebRequest)WebRequest.Create(BYTESAVE_API_PBL + "dang-xuat/" + Get_Serial_number());
                WebReq.Method = "GET";
                HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
                string          jsonString;
                using (Stream stream = WebResp.GetResponseStream())       //modified from your code since the using statement disposes the stream automatically when done
                {
                    StreamReader reader = new StreamReader(stream, System.Text.Encoding.UTF8);
                    jsonString = reader.ReadToEnd();
                    JObject json   = JObject.Parse(jsonString);
                    var     msg    = json["msg"].ToString();
                    var     status = json["status"].ToString();
                    new MainUtility().write_logout();
                    LogginView window = new LogginView();
                    window.Show();
                    var myWindow = (Window)VisualParent.GetSelfAndAncestors().FirstOrDefault(a => a is Window);
                    myWindow.Close();
                    //System.Windows.Application.Current.Shutdown();
                }
                break;

            case MessageBoxResult.No:
                break;
            }
        }
Exemple #2
0
        public Point PointFromRoot(Point point)
        {
            if (VisualParent != null)
            {
                return(VisualParent.PointFromRoot(point - VisualOffset));
            }

            return(point - VisualOffset);
        }
Exemple #3
0
        /// <summary>
        /// Called when mouse is up on the associated object
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
        private void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            ClearIllustrations();

            if ((WindowsManager.ActiveWindowsManager != null) &&
                (WindowsManager.ActiveWindowsManager.DraggedPane != null))
            {
                VisualParent.AddDockPane(DetachDockPaneFromWindowManager(), DockPoint);
            }
        }
Exemple #4
0
        protected void InvalidateHitTestBounds()
        {
            if (!isHitTestBoundsValid)
            {
                return;
            }

            isHitTestBoundsValid = false;
            if (VisualParent != null)
            {
                VisualParent.InvalidateHitTestBounds();
            }
        }
        /// <summary>
        /// Invalidates the cached <see cref="RenderData"/>.
        /// </summary>
        public void InvalidateVisual()
        {
            if (!IsVisualValid)
            {
                return;
            }

            IsVisualValid = false;
            if (VisualParent != null)
            {
                VisualParent.InvalidateVisual();
            }
        }
Exemple #6
0
        internal void PropagateRoutedEvent(RoutedEventArgs e)
        {
            var routedEvent = e.RoutedEvent;

            // propagate first if tunneling
            if (routedEvent.RoutingStrategy == RoutingStrategy.Tunnel)
            {
                VisualParent?.PropagateRoutedEvent(e);
            }

            // Trigger the class handler
            var classHandler = EventManager.GetClassHandler(GetType(), routedEvent);

            if (classHandler != null && (classHandler.HandledEventToo || !e.Handled))
            {
                classHandler.Invoke(this, e);
            }

            // Trigger instance handlers
            if (eventsToHandlers.TryGetValue(routedEvent, out var handlers))
            {
                // get a list of handler from the pool where we can copy the handler to trigger
                if (RoutedEventHandlerInfoListPool.Count == 0)
                {
                    RoutedEventHandlerInfoListPool.Enqueue(new List <RoutedEventHandlerInfo>());
                }
                var pooledList = RoutedEventHandlerInfoListPool.Dequeue();

                // copy the RoutedEventHandlerEventInfo list into a list of the pool in order to be able to modify the handler list in the handler itself
                pooledList.AddRange(handlers);

                // iterate on the pooled list to invoke handlers
                foreach (var handlerInfo in pooledList)
                {
                    if (handlerInfo.HandledEventToo || !e.Handled)
                    {
                        handlerInfo.Invoke(this, e);
                    }
                }

                // add the pooled list back to the pool.
                pooledList.Clear(); // avoid to keep dead references
                RoutedEventHandlerInfoListPool.Enqueue(pooledList);
            }

            // propagate afterwards if bubbling
            if (routedEvent.RoutingStrategy == RoutingStrategy.Bubble)
            {
                VisualParent?.PropagateRoutedEvent(e);
            }
        }
 /// <summary>
 /// Ensures that all visual child controls of this element are properly updated for layout.
 /// </summary>
 public void UpdateLayout()
 {
     if (!IsArrangeValid)
     {
         if (VisualParent != null)
         {
             // Go to root.
             VisualParent.UpdateLayout();
         }
         else
         {
             // This is the root. Starts update process.
             Measure(new Vector2F(float.PositiveInfinity));
             Arrange(Vector2F.Zero, new Vector2F(DesiredWidth, DesiredHeight));
         }
     }
 }
        /// <summary>
        /// Invalidates the arrange state (layout) for the control.
        /// </summary>
        public void InvalidateArrange()
        {
            IsVisualValid = false;

            // During the layout process this flag is not set to avoid recursions.
            if (_isArrangeInProgress || !IsArrangeValid)
            {
                return;
            }

            // Invalidate this control and parent.
            IsArrangeValid = false;
            if (VisualParent != null)
            {
                VisualParent.InvalidateArrange();
            }
        }
Exemple #9
0
 private bool CoerceInheritedValue(DependencyProperty dependencyProperty, bool value)
 {
     return(VisualParent != null ? value && (bool)VisualParent.GetValue(dependencyProperty) : value);
 }
Exemple #10
0
        public Matrix TransformToAncestor(Visual ancestor)
        {
            Matrix transformMatrix = !VisualTransform.IsNullOrIdentity() ? VisualTransform : Matrix.Identity;
            Matrix offsetMatrix    = VisualOffset != Point.Zero ? Matrix.TranslationMatrix(VisualOffset.X, VisualOffset.Y) : Matrix.Identity;
            Matrix parentMatrix    = VisualParent != null && VisualParent != ancestor?VisualParent.TransformToAncestor(ancestor) : Matrix.Identity;

            Matrix value = transformMatrix * offsetMatrix * parentMatrix;

            return(value);
        }