示例#1
0
        protected virtual void SceneFocusChanged(object sender, GraphSceneEventArgs <IVisual, IVisualEdge> e)
        {
            if (ViewMode != SplitViewMode.GraphContent)
            {
                return;
            }
            var display = sender as IGraphSceneDisplay <IVisual, IVisualEdge>;

            CurrentDisplay = display;
            lock (locker) {
                var adjacent           = AdjacentDisplay(display);
                var contentViewManager = this.ContentViewManager;
                try {
                    display.ActionDispatcher.UserEventsDisabled  = true;
                    adjacent.ActionDispatcher.UserEventsDisabled = true;
                    contentViewManager.SheetViewer = adjacent;
                    contentViewManager.ShowViewer(sender, e);
                } catch (Exception ex) {
                    ExceptionHandler.Catch(ex, MessageType.OK);
                } finally {
                    display.ActionDispatcher.UserEventsDisabled  = false;
                    adjacent.ActionDispatcher.UserEventsDisabled = false;
                }
            }
        }
 public virtual void ShowLoadErrorPage()
 {
     if (!IsErrorPage)
     {
         IsErrorPage = true;
         Device.BeginInvokeOnMainThread(() =>
         {
             try
             {
                 var errorView       = new ErrorView();
                 var content         = Content;
                 Content             = errorView;
                 errorView.TryAgain += (sender, e) =>
                 {
                     this.IsErrorPage = false;
                     Content          = content;
                     ReloadPage();
                 };
             }
             catch (Exception e)
             {
                 ExceptionHandler.Catch(e);
             }
         });
     }
 }
示例#3
0
 private void InputCompleted(object sender, EventArgs e)
 {
     try
     {
         Entry input = (Entry)sender;
         var   text  = input.Text;
         if (!string.IsNullOrEmpty(text) && RemoveSpace)
         {
             text = text.Replace(" ", "");
         }
         var length = string.IsNullOrEmpty(text) ? 0 : text.Length;
         IsValid = length >= MinLength;
         if (!IsValid)
         {
             if (MinLength > 1)
             {
                 Reason = MinLength > 0 ? string.Format(AppResources.MinLength, FieldName, MinLength.ToString()) : string.Format(AppResources.RequiredMessage, FieldName);
             }
             else
             {
                 Reason = string.Format(AppResources.RequiredMessage, FieldName);
             }
         }
         else
         {
             Reason = " ";
         }
     }
     catch (Exception e1)
     {
         ExceptionHandler.Catch(e1);
     }
 }
 void ConfigurateServicePoint()
 {
     ServicePointManager.MaxServicePointIdleTime              = 1000;
     ServicePointManager.DnsRefreshTimeout                    = 0;
     ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
     {
         try
         {
             if (sender is System.Net.HttpWebRequest)
             {
                 var asystyouUrl = PCLAppConfig.ConfigurationManager.AppSettings["AsystyouUrl"];
                 System.Net.HttpWebRequest httpWebRequest = sender as System.Net.HttpWebRequest;
                 if (httpWebRequest.RequestUri.OriginalString.Contains(asystyouUrl) ||
                     httpWebRequest.RequestUri.OriginalString.Contains("firebase") ||
                     httpWebRequest.RequestUri.OriginalString.Contains("googleapis"))
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(true);
             }
         }
         catch (Exception e)
         {
             ExceptionHandler.Catch(e);
             return(true);
         }
     };
 }
示例#5
0
        /// <summary>
        /// returns an optimized image for fast drawing
        /// to have a fast Graphis.DrawImage, a Bitmap should be in PixelFormat.Format32bppPArgb
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public Image OptimizedImage(Image source)
        {
            if (source.PixelFormat == PixelFormat.Format32bppPArgb)
            {
                return(source);
            }
            else
            {
                try {
                    Image result = new Bitmap(source.Width, source.Height, PixelFormat.Format32bppPArgb);

                    using (var g = Graphics.FromImage(result)) {
                        g.InterpolationMode  = InterpolationMode.HighQualityBilinear;
                        g.CompositingMode    = CompositingMode.SourceCopy;
                        g.CompositingQuality = CompositingQuality.HighQuality;
                        // draws image too small:
                        // g.DrawImageUnscaled (source, 0, 0);
                        g.DrawImage(source, 0, 0, source.Width, source.Height);
                        g.Flush();
                    }
                    return(result);
                } catch (Exception ex) {
                    ExceptionHandler.Catch(ex, MessageType.OK);
                    return(source);
                }
            }
        }
示例#6
0
        void Control_Touch(object sender, TouchEventArgs e)
        {
            try
            {
                if (ImageTouch != null)
                {
                    switch (e.Event.Action)
                    {
                    case Android.Views.MotionEventActions.Pointer1Down:
                    case Android.Views.MotionEventActions.Down:
                        ImageTouch.RaiseOnTouch(true);
                        break;

                    case Android.Views.MotionEventActions.Up:
                    case Android.Views.MotionEventActions.Pointer1Up:
                    case Android.Views.MotionEventActions.Cancel:
                        ImageTouch.RaiseOnTouch(false);
                        break;
                    }
                }
            }
            catch (Exception e1)
            {
                ExceptionHandler.Catch(e1);
            }
        }
        public override void CheckLocationPermission(Action <bool> locationRequestAction)
        {
            try
            {
                LocationRequestActions.Add(locationRequestAction);

                //var fineLocation = ContextCompat.CheckSelfPermission(MainActivity, Manifest.Permission.AccessFineLocation);
                //var coarseLocation = ContextCompat.CheckSelfPermission(MainActivity, Manifest.Permission.AccessCoarseLocation);
                List <string> permissions = new List <string>();

                //if (coarseLocation == Android.Content.PM.Permission.Denied)
                {
                    permissions.Add(Manifest.Permission.AccessCoarseLocation);
                }
                //if (fineLocation == Android.Content.PM.Permission.Denied)
                {
                    permissions.Add(Manifest.Permission.AccessFineLocation);
                }

                //if (permissions.Count > 0)
                {
                    ActivityCompat.RequestPermissions(MainActivity, permissions.ToArray(), RequestLocationPermissionsCode);
                }
                //else
                //{
                //	InvokeLocationRequestActions(true);
                //}
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
示例#8
0
        protected App()
        {
            Assembly assembly     = typeof(App).GetTypeInfo().Assembly;
            Stream   configStream = assembly.GetManifestResourceStream("AsystBussiness.App.config");

            try
            {
                using (configStream)
                {
                    ConfigurationManager.Initialise(configStream);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }

            try
            {
                InitializeComponent();

                this.PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName == nameof(this.MainPage))
                    {
                        var appServices = DependencyService.Get <IAppServices>();
                        appServices.SetNetworkBar(false);
                    }
                };
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
示例#9
0
        protected void LoadStreamThing(ContentStreamViewer viewer, IThingGraph graph, IStreamThing thing)
        {
            try {
                viewer.IsStreamOwner = IsStreamOwner;
                if (viewer.ContentId != thing.Id)
                {
                    SaveStream(graph, viewer);

                    var content = graph.ContentOf(thing);
                    if (viewer is SheetViewer)
                    {
                        content.Source = thing.Id;
                    }

                    if (viewer is HtmlContentViewer)
                    {
                        var htmlViewr = (HtmlContentViewer)viewer;
                        htmlViewr.ContentThing = thing;
                        htmlViewr.ThingGraph   = graph;
                    }


                    viewer.SetContent(content);
                    viewer.ContentId = thing.Id;
                }
            } catch (Exception ex) {
                ExceptionHandler.Catch(ex, MessageType.OK);
            } finally {
                thing.ClearRealSubject(!IsStreamOwner);
            }
        }
        private bool TestIfGooglePlayServicesIsInstalled()
        {
            try
            {
                int queryResult = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this);
                if (queryResult == ConnectionResult.Success)
                {
                    return(true);
                }

                if (GoogleApiAvailability.Instance.IsUserResolvableError(queryResult))
                {
                    Dialog errorDialog = GoogleApiAvailability.Instance.GetErrorDialog(this, queryResult, InstallGooglePlayServicesId);
                    if (ErrorDialogFragment != null)
                    {
                        ErrorDialogFragment.Dismiss();
                    }
                    ErrorDialogFragment            = ErrorDialogFragment.NewInstance(errorDialog);
                    ErrorDialogFragment.Cancelable = false;
                    ErrorDialogFragment.Show(FragmentManager, "GooglePlayServicesDialog");
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }

            return(false);
        }
示例#11
0
 public void SetLocale(CultureInfo ci)
 {
     try
     {
         System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
         System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#12
0
        protected override void OnAppearing()
        {
            try
            {
                base.OnAppearing();

                ReloadData();
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
示例#13
0
 public void OnError(Java.Lang.Exception p0)
 {
     try
     {
         if (Callback != null)
         {
             Callback(this, p0);
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#14
0
 public void OnCancel(int p0)
 {
     try
     {
         if (Callback != null)
         {
             Callback(this, p0);
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
 public void OnLocationChanged(Location location)
 {
     try
     {
         mLastCurrentLocation      = location;
         appServices.LastLatitude  = location.Latitude;
         appServices.LastLongitude = location.Longitude;
         appServices.RaiseAppOnLocationChanged(true);
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#16
0
 public void RaiseOnRegionChanged(Position position)
 {
     try
     {
         if (RegionChanged != null)
         {
             RegionChanged(this, position);
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#17
0
 public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0)
 {
     try
     {
         if (Callback != null)
         {
             Callback(this, p0);
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#18
0
 public TranslateExtension()
 {
     try
     {
         if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
         {
             ci = DependencyService.Get <ILocalize>().GetCurrentCultureInfo();
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
 void ConfigureCultureInfo()
 {
     try
     {
         CultureInfo cultureInfo = new CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.Name, true);
         cultureInfo.NumberFormat   = NumberFormatInfo.InvariantInfo;
         cultureInfo.DateTimeFormat = DateTimeFormatInfo.InvariantInfo;
         CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#20
0
 public void RaiseOnTouch(bool isTouch)
 {
     try
     {
         if (Touch != null)
         {
             Touch(this, isTouch);
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#21
0
 protected override void OnAttachedTo(Entry bindable)
 {
     try
     {
         var length = string.IsNullOrEmpty(bindable.Text) ? 0 : bindable.Text.Length;
         IsValid               = length >= MinLength;
         this.Reason           = " ";
         bindable.TextChanged += InputCompleted;
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#22
0
        public void LoadMenu()
        {
            try
            {
                IsLoggedIn = Shared.IsLoggedIn;

                this.Pages.Clear();

                this.Pages.Add(new MasterPageItemViewModel
                {
                    Title      = "Dashboard",
                    IconSource = "home_white.png",
                    TargetType = typeof(DashboardPage)
                });

                this.Pages.Add(new MasterPageItemViewModel
                {
                    Title      = "Schedule Delivery",
                    IconSource = "calendar_white.png",
                    TargetType = typeof(ZipPage)
                });

                /*this.Pages.Add(new MasterPageItemViewModel
                 * {
                 *  Title = "Orders",
                 *  IconSource = "icon_cart.png",
                 *  TargetType = typeof(OrdersPage)
                 * });*/

                /*this.Pages.Add(new MasterPageItemViewModel
                 * {
                 *  Title = "Reports",
                 *  IconSource = "support.png",
                 *  TargetType = typeof(ReportsPage)
                 * });*/

                this.Pages.Add(new MasterPageItemViewModel
                {
                    Title      = "Profile",
                    IconSource = "my_profile.png",
                    TargetType = typeof(ProfilePage)
                });
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
 public void ShowNotificationAlert(LogisticsNotification logisticsNotification)
 {
     Device.BeginInvokeOnMainThread(async() =>
     {
         try
         {
             await appServices.ShowNotifitionAlert(logisticsNotification);
         }
         catch (Exception e)
         {
             ExceptionHandler.Catch(e);
             this.IsNeedRefresh         = true;
             this.LogisticsNotification = logisticsNotification;
         }
     });
 }
示例#24
0
 protected void LoadThing(ContentVisualViewer viewer, IGraph <IVisual, IVisualEdge> graph, IVisual visual)
 {
     try {
         //if (viewer.CurrentThingId != thing.Id) {
         //    //SaveContentOfViewers(graph, viewer);
         //}
         var thing = graph.ThingOf(visual);
         if (viewer.ContentId != thing.Id)
         {
             viewer.ContentId = thing.Id;
             viewer.SetContent(graph, visual);
         }
     } catch (Exception ex) {
         ExceptionHandler.Catch(ex, MessageType.OK);
     } finally {
     }
 }
示例#25
0
        public CustomCell()
        {
            try
            {
                this.ForceUpdateSize();

                BindingForceUpdateSize();
                this.BindingContextChanged += (sender, e) =>
                {
                    BindingForceUpdateSize();
                };
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
示例#26
0
        public override void SetContent(Content <Stream> content)
        {
            if (TextViewer == null)
            {
                return;
            }

            zoom = TextViewer.ZoomFactor;

            var stream = content.Data;

            var textType = TextViewerTextType.PlainText;

            try {
                var info = new RtfContentSpot().Use(content.Data);
                if (info != null && info.ContentType == ContentTypes.RTF)
                {
                    if (content.ContentType != info.ContentType)
                    {
                        Trace.WriteLine(this.GetType() + ":  wrong contenttype detected");
                    }
                    content.ContentType = info.ContentType;
                }

                if (content.ContentType == ContentTypes.RTF)
                {
                    textType = TextViewerTextType.RichText;
                    stream   = PrepareRead(stream);
                }
                else if (content.ContentType == ContentTypes.Text)
                {
                    textType = TextViewerTextType.UnicodePlainText;
                }

                TextViewer.Load(stream, textType);
            } catch (Exception ex) {
                ExceptionHandler.Catch(ex, MessageType.OK);
            } finally {
                if (IsStreamOwner)
                {
                    content.Data.Close();
                    content.Data = null;
                }
            }
        }
示例#27
0
        public HomeMasterPage()
        {
            try
            {
                InitializeComponent();
                IsLoggedIn   = Shared.IsLoggedIn;
                mAppServices = DependencyService.Get <IAppServices>();

                LabelAppVersion.Text = "v" + mAppServices.AppVersion + " " + AppResources.AppVersion;

                this.SizeChanged += (sender, e) =>
                {
                    try
                    {
                        ImageLogo.WidthRequest = this.Width * 0.6;
                        if (this.Width >= 350)
                        {
                            LabelAppVersion.FontSize = Device.GetNamedSize(NamedSize.Small, LabelAppVersion);
                        }
                        else if (this.Width >= 290)
                        {
                            LabelAppVersion.FontSize = Device.GetNamedSize(NamedSize.Small, LabelAppVersion) * 0.9;
                        }
                        else if (this.Width >= 250)
                        {
                            LabelAppVersion.FontSize = Device.GetNamedSize(NamedSize.Small, LabelAppVersion) * 0.8;
                        }
                        else
                        {
                            LabelAppVersion.FontSize = Device.GetNamedSize(NamedSize.Small, LabelAppVersion) * 0.7;
                        }
                    }
                    catch (Exception e1)
                    {
                        ExceptionHandler.Catch(e1);
                    }
                };

                LoadMenu();
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }
        }
示例#28
0
 public override void GetLocation(Action <bool> action, bool isRefresh = false)
 {
     try
     {
         Actions.Add(action);
         if (!isRefresh && (!LastLatitude.Equals(0) || !LastLongitude.Equals(0)))
         {
             RaiseAppOnLocationChanged(true);
         }
         else
         {
             MainActivity.GetLocation();
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#29
0
 public void InvokeLocationRequestActions(bool isPermissions)
 {
     try
     {
         var actions = LocationRequestActions.ToList();
         LocationRequestActions.Clear();
         foreach (var action in actions)
         {
             if (action != null)
             {
                 action.Invoke(isPermissions);
             }
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
示例#30
0
 public override void RaiseAppOnLocationChanged(bool isLocation)
 {
     try
     {
         var actions = Actions.ToList();
         Actions.Clear();
         foreach (var action in actions)
         {
             if (action != null)
             {
                 action.Invoke(isLocation);
             }
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }