Beispiel #1
0
 private void invokeViewChanged()
 {
     if (ViewChanged != null)
     {
         ViewChanged.Invoke(m_view, this.Position);
     }
 }
Beispiel #2
0
 private void NotifyIfChangeIsExpected(ViewChanged toAdd)
 {
     if (isExpectedChange(toAdd))
     {
         expectedViewChangeOccurred.SetResult(true);
     }
 }
 private void OnViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
 {
     if (sender is ScrollViewer scrollViewer)
     {
         ViewChanged?.Invoke(this, new ViewChangedEventArgs(scrollViewer, e.IsIntermediate));
     }
 }
Beispiel #4
0
        public static void StartProgram(IMatrixProgram program)
        {
            if (timer == null)
            {
                timer          = new Timer();
                timer.Interval = 100;
                timer.Elapsed += (s, a) =>
                {
                    ActiveProgram.UpdateProgram();
                    ViewChanged?.Invoke();
                };
            }

            if (ActiveProgram != null)
            {
                StopActiveProgram();
            }
            program.LoadProgram((s, a) =>
            {
                program.StartProgram();
                timer.Start();
                ViewChanged?.Invoke();
            });
            ActiveProgram = program;
            ViewChanged?.Invoke();
        }
Beispiel #5
0
        private void ChartControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (!(_mouseDowned && e.Button == MouseButtons.Middle))
            {
                _mouseDowned = false;
                return;
            }

            double selX, selY;

            try
            {
                selX = _ptrAxisX.PixelPositionToValue(e.Location.X);
                selY = _ptrAxisY.PixelPositionToValue(e.Location.Y);
            }
            catch (Exception)
            {
                return;
            }
            if (_ptrAxisX.ScaleView.IsZoomed || _ptrAxisY.ScaleView.IsZoomed)
            {
                double dx   = -selX + _xStart;
                double dy   = -selY + _yStart;
                double newX = _ptrAxisX.ScaleView.Position + dx;
                double newY = _ptrAxisY.ScaleView.Position + dy;

                _ptrAxisX.ScaleView.Scroll(newX);
                _ptrAxisY.ScaleView.Scroll(newY);
                ViewChanged?.Invoke(this, _ptrChartArea);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Called when the user scrolls with the mouse.
        /// Handles the zoom in/out logic.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="args">Event data.</param>
        private void OnMouseScroll(object sender, ScrollEventArgs args)
        {
            try
            {
                Envelope viewport = map.Envelope;
                double   mouseLat = args.Event.Y / map.Size.Height * (viewport.MinY - viewport.MaxY) + viewport.MaxY;
                double   mouseLon = args.Event.X / map.Size.Width * (viewport.MaxX - viewport.MinX) + viewport.MinX;

                if (args.Event.Direction == Gdk.ScrollDirection.Up || args.Event.Direction == Gdk.ScrollDirection.Down)
                {
                    // Adjust zoom level on map.
                    double sign = args.Event.Direction == Gdk.ScrollDirection.Up ? -1 : 1;
                    map.Zoom = MathUtilities.Bound(map.Zoom + scrollIncrement * sign, 1, map.MaximumZoom);

                    // Adjust center of map, so that coordinates at mouse cursor are the same
                    // as previously.
                    viewport = map.Envelope;
                    double newMouseLat = args.Event.Y / map.Size.Height * (viewport.MinY - viewport.MaxY) + viewport.MaxY;
                    double newMouseLon = args.Event.X / map.Size.Width * (viewport.MaxX - viewport.MinX) + viewport.MinX;

                    double dx = newMouseLon - mouseLon;
                    double dy = newMouseLat - mouseLat;
                    map.Center = new Coordinate(map.Center.X - dx, map.Center.Y - dy);
                    RefreshMap();
                    ViewChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
Beispiel #7
0
 protected override void NewTitle(string title)
 {
     if (!String.IsNullOrEmpty(title))
     {
         double newLat, newLong, newZoom;
         bool   modified = false;
         // Incoming title should look like "6, (-27.15, 151.25)"
         // That is Zoom, then lat, long pair
         // We remove the brackets and split on the commas
         title = title.Replace("(", "");
         title = title.Replace(")", "");
         string[] parts = title.Split(new char[] { ',' });
         if (Double.TryParse(parts[0], out newZoom) && newZoom != zoom)
         {
             zoom     = newZoom;
             modified = true;
         }
         if (Double.TryParse(parts[1], NumberStyles.Float, CultureInfo.InvariantCulture, out newLat) &&
             Double.TryParse(parts[2], NumberStyles.Float, CultureInfo.InvariantCulture, out newLong) &&
             (newLat != latitude || newLong != longitude))
         {
             Center   = new Models.Map.Coordinate(newLat, newLong);
             modified = true;
         }
         if (modified && ViewChanged != null)
         {
             ViewChanged.Invoke(this, EventArgs.Empty);
         }
     }
 }
Beispiel #8
0
 private void View_Logout()
 {
     _model.Login    = "";
     _model.Password = "";
     _model.CloseConnection();
     ViewChanged?.Invoke(this, new ViewChangedArgs(ViewType.Login));
 }
Beispiel #9
0
 /// <summary>
 /// Assign a view as being active
 /// </summary>
 /// <param name="ActiveView">The active view</param>
 public static void SetActiveView(MM_Display_View ActiveView)
 {
     Data_Integration.ActiveView = ActiveView.FullName;
     if (ViewChanged != null)
     {
         ViewChanged.Invoke(ActiveView);
     }
 }
Beispiel #10
0
        protected override void OnScrollChanged(ScrollChangedEventArgs e)
        {
            base.OnScrollChanged(e);

            if (e.HorizontalChange != 0 || e.VerticalChange != 0)
            {
                ViewChanged?.Invoke(this, new ScrollViewerViewChangedEventArgs());
            }
        }
Beispiel #11
0
 public StateFixture()
 {
     f   = new Final();
     h   = new Hnv();
     pd  = new Prepared();
     ppd = new PrePrepared();
     vcd = new ViewChanged();
     v   = new View();
 }
Beispiel #12
0
 public void UnPickObject(GameObject picked)
 {
     if (lastPick.GetInstanceID() == picked.GetInstanceID())
     {
         lastPick    = null;
         ToolTipView = null;
         ViewChanged?.Invoke(this, null);
     }
 }
Beispiel #13
0
 private void OnViewChanged(bool userAction = false)
 {
     if (_map != null)
     {
         ViewChanged?.Invoke(this, new ViewChangedEventArgs {
             Viewport = Map.Viewport, UserAction = userAction
         });
     }
 }
Beispiel #14
0
        private void ChartControl_MouseWheel(object sender, MouseEventArgs e)
        {
            ChartRect newZoom = new ChartRect(_ptrChartArea);

            ScaleViewZoom(e.Delta, ref newZoom.X);
            ScaleViewZoom(e.Delta, ref newZoom.Y);
            UpdateAxis(newZoom, true);
            ViewChanged?.Invoke(this, _ptrChartArea);
        }
 public static void SetView(UserControl view)
 {
     if (view != null)
     {
         Application.Current.Dispatcher.Invoke(delegate {
             ViewChanged?.Invoke(new ViewChangeEventArgs(view));
         });
     }
 }
Beispiel #16
0
        public void Apply()
        {
            ApplyFilter();
            ApplySort();

            if (ViewChanged != null)
            {
                // raise event
                ViewChanged.Invoke();
            }
        }
Beispiel #17
0
        public void OnViewChanged(bool userAction = false)
        {
            if (_map == null)
            {
                return;
            }

            ViewChanged?.Invoke(this, new ViewChangedEventArgs {
                Viewport = Map.Viewport, UserAction = userAction
            });
        }
Beispiel #18
0
        private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
        {
            var scrollViewer = sender as ScrollViewer;

            ViewChanged?.Invoke(sender, e);
            var verticalOffsetValue    = scrollViewer.VerticalOffset;
            var maxVerticalOffsetValue = scrollViewer.ExtentHeight - scrollViewer.ViewportHeight;

            if (maxVerticalOffsetValue < 0 || verticalOffsetValue == maxVerticalOffsetValue)
            {
                LoadMore?.Invoke(this, new EventArgs());
            }
        }
Beispiel #19
0
        public void Apply()
        {
            // clear list
            modifiedList.Clear();

            ApplyFilter();
            ApplySort();

            if (ViewChanged != null)
            {
                // raise event
                ViewChanged.Invoke();
            }
        }
        private void OnClick(object sender, RoutedEventArgs e)
        {
            int viewnum;

            if (sender is Button)
            {
                Button button = sender as Button;
                viewnum = int.Parse((string)button.Tag);
            }
            else
            {
                MenuItem item = sender as MenuItem;
                viewnum = int.Parse((string)item.Tag);
            }
            ViewChanged.Invoke(new ViewChangedEventArgs(viewnum));
        }
        void ChangeView(object sender, ConfiguratorViewsEnum newView)
        {
            if (_selectedButton != null)
            {
                _selectedButton.BackColor = _normalButtonColor;
            }

            var newCurrentButton = ((Button)sender);

            newCurrentButton.BackColor = _selectedButtonColor;
            _selectedButton            = newCurrentButton;

            if (ViewChanged != null)
            {
                ViewChanged.Invoke(newView);
            }
        }
Beispiel #22
0
        void changeView(object sender, BackupTaskViewsEnum newView)
        {
            if (_selectedButton != null)
            {
                _selectedButton.BackColor = _normalButtonColor;
            }

            Button newCurrentButton = ((Button)sender);

            newCurrentButton.BackColor = _selectedButtonColor;
            _selectedButton            = newCurrentButton;

            if (ViewChanged != null)
            {
                ViewChanged.Invoke(newView);
            }
        }
Beispiel #23
0
        public static void RequestNavigateToView(this IRegionManager manager, string region, string view)
        {
            try
            {
                var control = (System.Windows.Controls.UserControl)manager.Regions[region].GetView(view);
                if (control == null)
                {
                    throw new NullReferenceException("The region manager could not locate the specified region or view.");
                }

                manager.RequestNavigate(region, control.GetType().Name);
                ViewChanged?.Invoke(null, EventArgs.Empty);
            }
            catch (Exception ex)
            {
                Core.Log.Error(ex);
            }
        }
        private void View_Login(object sender, LoginEventArgs e)
        {
            LoginControlView lc = sender as LoginControlView;

            if (lc != null)
            {
                if (CorrectUsernameAndPassword(e.Username, e.Password))
                {
                    _model.Login    = e.Username;
                    _model.Password = e.Password;
                    ViewChangedArgs args = new ViewChangedArgs(ViewType.Shop);
                    ViewChanged?.Invoke(this, args);
                }
                else
                {
                    _view.SetError(ConstantTexts.WrongUsernameOrPassword);
                }
            }
        }
Beispiel #25
0
        /// <summary>
        /// Called when the mouse button is released.
        /// Handles the map drag logic.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="args">Event data.</param>
        private void OnButtonRelease(object sender, ButtonReleaseEventArgs args)
        {
            try
            {
                if (isDragging)
                {
                    CartesianToGeoCoords(args.Event.X, args.Event.Y, out double lat, out double lon);
                    double dy = lat - mouseAtDragStart.Latitude;
                    double dx = lon - mouseAtDragStart.Longitude;

                    map.Center = new Coordinate(map.Center.X - dx, map.Center.Y - dy);
                    RefreshMap();
                    ViewChanged?.Invoke(this, EventArgs.Empty);
                }
                isDragging = false;
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
Beispiel #26
0
        public static void RequestNavigateToView(this IRegionManager manager, string region, string view, NavigationParameters parameters = null)
        {
            try
            {
                var control = (System.Windows.Controls.UserControl)manager.Regions[region].GetView(view);
                if (control == null)
                {
                    throw new NullReferenceException("The region manager could not locate the specified region or view.");
                }

                if (parameters == null)
                {
                    parameters = new NavigationParameters();
                }

                Application.Current.Dispatcher.Invoke(() => manager.RequestNavigate(region, control.GetType().Name, parameters), System.Windows.Threading.DispatcherPriority.Send);
                ViewChanged?.Invoke(null, new ViewEventArgs(view, region));
            }
            catch (Exception ex)
            {
                Core.Log.Error(ex);
            }
        }
Beispiel #27
0
        private void ChartControl_MouseDown(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Middle:
                _mouseDowned = true;
                _xStart      = _yStart = 0;
                try
                {
                    _xStart = _ptrAxisX.PixelPositionToValue(e.Location.X);
                    _yStart = _ptrAxisY.PixelPositionToValue(e.Location.Y);
                }
                catch (Exception)
                {
                    // ignored
                }
                break;

            case MouseButtons.Right:
                UpdateAxis(null, false, true);
                ViewChanged?.Invoke(this, null);
                break;
            }
        }
Beispiel #28
0
 public void AddViewChangedEvent(ViewChanged toAdd)
 {
     events = events.Add(toAdd);
     NotifyIfChangeIsExpected(toAdd);
 }
Beispiel #29
0
 /// <summary>
 /// Called when panel view mode is changed.
 /// </summary>
 /// <param name="e">.</param>
 /// <remarks>
 /// The base method triggers the <see cref="ViewChanged"/> event.
 /// </remarks>
 public void UIViewChanged(ViewChangedEventArgs e)
 {
     ViewChanged?.Invoke(this, e);
 }
Beispiel #30
0
 protected void OnViewChanged()
 {
     ViewChanged?.Invoke();
 }