public async void AddContainer()
        {
            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(Description))
            {
                Value = true;
                return;
            }
            if (Valuem3 == 0 || ValueSeaFreight == 0)
            {
                Value = true;
                return;
            }
            if (Currency == null)
            {
                Value = true;
                return;
            }
            var _seaFreight = new SeaFreight
            {
                value    = ValueSeaFreight,
                currency = Currency
            };
            var container = new AddContainer
            {
                description = Description,
                value       = Valuem3,
                seaFreight  = _seaFreight
            };
            var response = await apiService.Save <AddContainer>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/container",
                container);

            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", "Container Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Exemplo n.º 2
0
 private void AddCamera_Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         AddContainer.Child = (UIElement)AddContainer.FindResource("textbox");
         AddContainer.Child.Focus();
     }
     catch (Exception err)
     {
         GUIUtilities.ReportUnexpectedException(err);
     }
 }
Exemplo n.º 3
0
 private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Escape)
         {
             AddContainer.Child = (UIElement)AddContainer.FindResource("button");
         }
     }
     catch (Exception err)
     {
         GUIUtilities.ReportUnexpectedException(err);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a container to the linkcollector list.
        /// </summary>
        /// <param name="type">The value can be: DLC, RSDF, CCF or CRAWLJOB</param>
        /// <param name="content">File as dataurl. https://de.wikipedia.org/wiki/Data-URL </param>
        public bool AddContainer(ContainerType type, string content)
        {
            AddContainer container = new AddContainer
            {
                Type    = type.ToString(),
                Content = content
            };

            var json     = JsonConvert.SerializeObject(container);
            var param    = new[] { json };
            var response = ApiHandler.CallAction <object>(Device, "/linkgrabberv2/addContainer",
                                                          param, JDownloaderHandler.LoginObject);

            return(response != null);
        }
Exemplo n.º 5
0
 private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     try
     {
         var textbox = sender as TextBox;
         if (e.Text.EndsWith("\n") || e.Text.EndsWith("\r"))
         {
             if (textbox.Text.Length > 0)
             {
                 addCameraWatch(textbox.Text, true);
             }
             AddContainer.Child = (UIElement)AddContainer.FindResource("button");
         }
     }
     catch (Exception err)
     {
         GUIUtilities.ReportUnexpectedException(err);
     }
 }