예제 #1
0
        private void DrawingZone_MouseDown(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Right:
            {
                AddMenuItems();

                AddRegion.Show(this, new Point(e.X, e.Y));        //places the menu at the pointer position
            }
            break;

            case MouseButtons.Left:
            {
                if (!select)
                {
                    _listPoints.Add(new PointF(e.X, e.Y));
                    _listPoints.Add(new PointF(e.X, e.Y));

                    flagPaint = true;
                }
                else
                {
                    selectPointActions.MouseDown(e, _drawing.FiguresList, 1);
                }

                Refresh();
            }

            break;
            }
        }
        public async void AddRegion()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    Languages.CheckConnection,
                    Languages.Ok);

                return;
            }
            if (string.IsNullOrEmpty(Code) || string.IsNullOrEmpty(Description))
            {
                Value = true;
                return;
            }

            var region = new AddRegion
            {
                code        = Code,
                description = Description
            };
            var response = await apiService.Save <AddRegion>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/region",
                region);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }

            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("Medial", "Region Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }