Beispiel #1
0
        private void OnBackgroundEvent()
        {
            try
            {
                var       lastPersistence = new WinPersistenceLayer();
                IWorkbook newWorkbook     = lastPersistence.Open();
                using (this.workbook.WithDuplicateProtection())
                {
                    foreach (ITask newTask in newWorkbook.Tasks)
                    {
                        if (this.workbook.Tasks.All(t => t.Id != newTask.Id))
                        {
                            // this is a new task we don't have in the "current" workbook
                            var oldTask = this.workbook.CreateTask(newTask.Id);
                            ModelHelper.CloneTask(oldTask, newTask, this.workbook);
                        }

                        var existingTask = this.workbook.Tasks.FirstOrDefault(t => t.Id == newTask.Id);
                        if (existingTask != null && existingTask.Modified < newTask.Modified)
                        {
                            // this is a task that has been updated
                            ModelHelper.CloneTask(existingTask, newTask, this.workbook);
                        }
                    }
                    lastPersistence.CloseDatabase();
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "BackgroundTaskManager.OnBackgroundEvent");
            }
        }
Beispiel #2
0
        protected override void OnApplyTemplate()
        {
            try
            {
                this.SetPaneRoot(this.GetTemplateChild <Grid>("PaneRoot"));

                this.overlayRoot = this.GetTemplateChild <Grid>("OverlayRoot");
                this.SetPanArea(this.GetTemplateChild <Rectangle>("PanArea"));
                this.SetDismissLayer(this.GetTemplateChild <Rectangle>("DismissLayer"));

                var rootGrid = GetParent <Grid>(this.paneRoot);

                this.SetOpenSwipeablePaneAnimation(GetStoryboard(rootGrid, "OpenSwipeablePane"));
                this.SetCloseSwipeablePaneAnimation(GetStoryboard(rootGrid, "CloseSwipeablePane"));

                // initialization
                this.OnDisplayModeChanged(null, null);

                this.RegisterPropertyChangedCallback(DisplayModeProperty, this.OnDisplayModeChanged);

                // disable ScrollViewer as it will prevent finger from panning
                if (this.Pane is ListView || this.Pane is ListBox)
                {
                    ScrollViewer.SetVerticalScrollMode(this.Pane, ScrollMode.Disabled);
                }

                base.OnApplyTemplate();
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "SwipeableListView.OnApplyTemplate");
            }
        }
Beispiel #3
0
        protected IWorkbook InitializeWorkbook(IPersistenceLayer persistence, IPlatformService platformService)
        {
            IWorkbook workbook = null;

            if (persistence.HasSave)
            {
                try
                {
                    workbook = persistence.Open();
                }
                catch (Exception ex)
                {
                    TrackingManagerHelper.Exception(ex, "Initialize workbook");
                    platformService.DeleteFileAsync(persistence.DatabaseFilename).Wait(1000);
                }
            }

            if (workbook == null)
            {
                persistence.Initialize();
                workbook = this.CreateDefaultWorkbook(persistence.Context, platformService);
                persistence.Save();
            }

            // important: read view from persistence and not from workbook as they are not loaded yet in the workbook !
            if (persistence.Context.Views.Count() != DefaultDataCreator.ViewCount)
            {
                CreateDefaultViews(workbook);
            }

            workbook.Initialize();
            Ioc.RegisterInstance <IWorkbook, Workbook>((Workbook)workbook);

            return(workbook);
        }
Beispiel #4
0
        private static void OnTapped(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                FrameworkElement frameworkElement = (FrameworkElement)sender;
                FlyoutBase       flyoutBase       = FlyoutBase.GetAttachedFlyout(frameworkElement);
                if (flyoutBase != null)
                {
                    Flyout flyout = flyoutBase as Flyout;
                    if (flyout != null)
                    {
                        flyout.Placement = ResponsiveHelper.GetPopupPlacement();
                        if (flyout.Content is IFlyoutContent)
                        {
                            ((IFlyoutContent)flyout.Content).HandleFlyout(flyout);
                        }
                    }

                    flyoutBase.ShowAt(frameworkElement);
                }
            }
            catch (Exception ex)
            {
                var messageBoxService = Ioc.Resolve <IMessageBoxService>();
                messageBoxService.ShowAsync(
                    StringResources.Message_Information,
                    "It looks like 2Day is having trouble here - that seems due to the latest Windows 10 Mobile insiders build. You can change due date by sliding left a task in the task list for now :-)");

                TrackingManagerHelper.Exception(ex, "OpenFlyoutOnTap.OnTapped");
                throw;
            }
        }
Beispiel #5
0
        public static Uri Get(string uri)
        {
            try
            {
                if (uri == null)
                {
                    throw new ArgumentNullException(nameof(uri));
                }
                if (string.IsNullOrWhiteSpace(uri))
                {
                    throw new ArgumentNullException(nameof(uri));
                }

                return(new Uri(uri));
            }
            catch (Exception ex)
            {
                string strippedUri = uri;
                if (uri != null && uri.Length > 500)
                {
                    strippedUri = uri.Substring(0, 500);
                }

                int length = 0;
                if (uri != null)
                {
                    length = uri.Length;
                }

                TrackingManagerHelper.Exception(ex, $"Failed to created uri length {length} from: {strippedUri}");
                throw new ArgumentException($"Failed to created uri length {length}  from: {strippedUri}");
            }
        }
Beispiel #6
0
        public HyperlinkPopupContent()
        {
            this.InitializeComponent();

            this.border.PointerEntered += (sender, e11) =>
            {
                Window.Current.CoreWindow.PointerCursor = handCursor;
            };
            this.border.PointerExited += (sender, e11) =>
            {
                Window.Current.CoreWindow.PointerCursor = arrowCursor;
            };
            this.border.Tapped += (s, e1) =>
            {
                try
                {
                    Uri uri = SafeUri.Get(this.Hyperlink);
                    Launcher.LaunchUriAsync(uri);
                }
                catch (Exception ex)
                {
                    TrackingManagerHelper.Exception(ex, "Exception in HyperlinkPopupContent.border.Tapped");
                }
            };
        }
Beispiel #7
0
        public async Task TryUpdateWorkbookAsync()
        {
            try
            {
                // check if the background sync produced changes
                var metadata = await this.ReadSyncMetadataAsync();

                if (metadata == null)
                {
                    return;
                }

                var syncManager = (SynchronizationManager)Ioc.Resolve <ISynchronizationManager>();

                if (this.HasSyncProducedChanges(metadata))
                {
                    using (this.workbook.WithDuplicateProtection())
                    {
                        await this.UpdateWorkbookAsync(metadata);
                    }
                }

                // update the metadata with the latest version
                syncManager.Metadata = metadata;
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "TryUpdateWorkbookAsync");
            }
        }
Beispiel #8
0
        public static async Task AddAttachment(EmailMessage email, string filename, string name)
        {
            try
            {
                StorageFile attachmentFileCopy = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);

                BasicProperties properties = await attachmentFileCopy.GetBasicPropertiesAsync();

                if (properties.Size > 0)
                {
                    await attachmentFileCopy.CopyAsync(ApplicationData.Current.LocalFolder, filename + ".bak", NameCollisionOption.ReplaceExisting);

                    StorageFile attachmentFile = await ApplicationData.Current.LocalFolder.GetFileAsync(filename + ".bak");

                    if (attachmentFile != null)
                    {
                        var stream     = RandomAccessStreamReference.CreateFromFile(attachmentFile);
                        var attachment = new EmailAttachment(name, stream);
                        email.Attachments.Add(attachment);
                    }
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Adding attachment");
            }
        }
Beispiel #9
0
        private async void OnManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            try
            {
                var x = e.Velocities.Linear.X;

                // ignore a little bit velocity (+/-0.1)
                if (x <= -0.1)
                {
                    this.CloseSwipeablePane();
                }
                else if (x > -0.1 && x < 0.1)
                {
                    if (Math.Abs(this.panAreaTransform.TranslateX) > Math.Abs(this.PanAreaInitialTranslateX) / 2)
                    {
                        this.CloseSwipeablePane();
                    }
                    else
                    {
                        this.OpenSwipeablePane();
                    }
                }
                else
                {
                    this.OpenSwipeablePane();
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "SwipeableListView.OnManipulationCompleted");
            }
        }
Beispiel #10
0
        public DateTimePicker()
        {
            this.InitializeComponent();

            if (!DesignMode.DesignModeEnabled)
            {
                var workbook = Ioc.Resolve <IWorkbook>();
                this.CalendarView.FirstDayOfWeek = (Windows.Globalization.DayOfWeek)workbook.Settings.GetValue <DayOfWeek>(CoreSettings.FirstDayOfWeek);
            }

            this.Loaded += this.OnLoaded;

            this.CalendarView.SelectedDatesChanged += this.OnSelectedDateChanged;
            this.TimePicker.TimeChanged            += this.OnTimechanged;

            try
            {
                if (GetCurrentCulture().DateTimeFormat.ShortTimePattern.Contains("H"))
                {
                    this.TimePicker.ClockIdentifier = Windows.Globalization.ClockIdentifiers.TwentyFourHour;
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Getting short time pattern");
            }
        }
Beispiel #11
0
        public async Task <DialogClosedEventArgs> ShowAsync(string title, string content, IEnumerable <string> buttons)
        {
            try
            {
                var commands = buttons.Select(b => b.ToString()).ToList();

                var dialog = new ConcurrentMessageDialog(content, title);
                foreach (var command in commands)
                {
                    dialog.Commands.Add(new UICommand(command));
                }

                IUICommand uiResult = await dialog.ShowAsync();

                if (uiResult != null && !string.IsNullOrWhiteSpace(uiResult.Label))
                {
                    return(new DialogClosedEventArgs(commands.IndexOf(uiResult.Label)));
                }
                else
                {
                    return(new DialogClosedEventArgs(-1));
                }
            }
            catch (Exception e)
            {
                TrackingManagerHelper.Exception(e, string.Format("MessageBoxService.ShowAsync with buttons title: {0} content {1}", title, content));
                return(new DialogClosedEventArgs(-1));
            }
        }
Beispiel #12
0
        private void OnDisplayModeChanged(DependencyObject sender, DependencyProperty dp)
        {
            try
            {
                switch (this.DisplayMode)
                {
                case SplitViewDisplayMode.Inline:
                case SplitViewDisplayMode.CompactOverlay:
                case SplitViewDisplayMode.CompactInline:
                    this.PanAreaInitialTranslateX = 0d;
                    this.overlayRoot.Visibility   = Visibility.Collapsed;
                    break;

                case SplitViewDisplayMode.Overlay:
                    this.PanAreaInitialTranslateX = this.OpenPaneLength * -1;
                    this.overlayRoot.Visibility   = Visibility.Visible;
                    break;
                }

                if (this.paneRoot.RenderTransform is CompositeTransform)
                {
                    ((CompositeTransform)this.paneRoot.RenderTransform).TranslateX = this.PanAreaInitialTranslateX;
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "SwipeableListView.OnDisplayModeChanged");
            }
        }
Beispiel #13
0
        private void EnsureWorkbookHasSmartView(IEnumerable <VercorsSmartView> vercorsSmartViews)
        {
            foreach (var vercorsSmartView in vercorsSmartViews)
            {
                var smartView = this.Workbook.SmartViews.FirstOrDefault(f => f.SyncId == vercorsSmartView.Id);
                if (smartView == null)
                {
                    // no folder has the requested SyncId
                    // check if a folder has the same name
                    smartView = this.Workbook.SmartViews.FirstOrDefault(f => f.Name.Equals(vercorsSmartView.Name, StringComparison.OrdinalIgnoreCase));
                    if (smartView != null)
                    {
                        // symply update the SyncId
                        smartView.SyncId = vercorsSmartView.Id;
                    }
                    else
                    {
                        try
                        {
                            this.CreateSmartView(vercorsSmartView.Name, vercorsSmartView.Rules, vercorsSmartView.Id);
                        }
                        catch (Exception ex)
                        {
                            LogService.Log("VercorsSync", $"Error while adding smart view: {ex}");
                            TrackingManagerHelper.Exception(ex, $"Error while adding smart view: {ex}");
                        }

                        this.Changes.LocalAdd++;
                    }
                }
            }
        }
Beispiel #14
0
        private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs e)
        {
            try
            {
                if (e.Visible && Ioc.HasType <IMainPageViewModel>())
                {
                    Ioc.Resolve <IMainPageViewModel>().RefreshAsync();
                }

                if (this.platformService != null && this.platformService.DeviceFamily == DeviceFamily.WindowsMobile)
                {
                    if (!e.Visible)
                    {
                        this.mutex.ReleaseMutex();
                        this.mutex.Dispose();
                    }
                    else
                    {
                        this.mutex = new Mutex(true, Constants.SyncPrimitiveAppRunningForeground);
                    }
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Exception App in OnVisibilityChanged");
            }
        }
Beispiel #15
0
        public static void ToastMessage(string title, string message, string launchArgument = null)
        {
            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            try
            {
                var xmlDoc = NotificationContentBuilder.CreateSimpleToastNotification(title, message, launchArgument);
                if (xmlDoc != null)
                {
                    ToastNotification notification  = new ToastNotification(xmlDoc);
                    ToastNotifier     toastNotifier = ToastNotificationManager.CreateToastNotifier();

                    toastNotifier.Show(notification);
                }
            }
            catch (Exception ex)
            {
                // we might have an exception if the message is too long
                TrackingManagerHelper.Exception(ex, string.Format("ToastMessage exception: {0}", ex.Message));
            }
        }
Beispiel #16
0
        private async void OnRichEditBoxPaste(object sender, TextControlPasteEventArgs e)
        {
            try
            {
                DataPackageView dataPackageView = Clipboard.GetContent();
                string          text            = null;
                string          html            = null;

                if (dataPackageView.Contains(StandardDataFormats.Text))
                {
                    text = await dataPackageView.GetTextAsync();
                }

                if (dataPackageView.Contains(StandardDataFormats.Html))
                {
                    html = await dataPackageView.GetHtmlFormatAsync();
                }

                // lots of hack, but basically, it's just for OneNote...
                if (this.rtbNotes.Document.Selection != null && html != null && html.Contains("Version:1.0") && !html.Contains("SourceURL") && html.Contains("<meta name=Generator content=\"Microsoft OneNote"))
                {
                    this.rtbNotes.Document.Selection.TypeText(text);
                    e.Handled = true;
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Exception while pasting data: " + ex);
                e.Handled = false;
            }
        }
        public static XmlDocument CreateTaskToastNotification(ITask task)
        {
            string content = string.Empty;

            try
            {
                XmlDocument xmlDocument = new XmlDocument();

                const string templateXml = @"
                    <toast scenario='reminder'>
                        <visual>
                            <binding template='ToastGeneric'>
                                <text>{0}</text>
                                <text>{1}</text>
                                <image placement='AppLogoOverride' src='{2}' />
                            </binding>
                        </visual>
                        <actions>
                            <input id='snoozeTime' type='selection' defaultInput='5'>
                              <selection id='5' content='5 {3}' />
                              <selection id='30' content='30 {3}' />
                              <selection id='60' content='1 {4}' />
                              <selection id='240' content='4 {5}' />
                              <selection id='1440' content='1 {6}' />
                            </input>
                            <action activationType='system' arguments='snooze' hint-inputId='snoozeTime' content=''/>
                            <action content='{7}' arguments='{8}' activationType='background' />
                            <action content='{9}' arguments='{10}' activationType='foreground' />
                        </actions>
                        <audio src='ms-winsoundevent:Notification.Reminder' />
                    </toast>
                    ";

                content = string.Format(
                    templateXml,
                    SafeEscape(task.Title),                         // 0
                    SafeEscape(task.Note ?? string.Empty),          // 1
                    ResourcesLocator.GetAppIconPng(),               // 2
                    StringResources.Notification_SnoozeMinutes,     // 3
                    StringResources.Notification_SnoozeHour,        // 4
                    StringResources.Notification_SnoozeHours,       // 5
                    StringResources.Notification_SnoozeDay,         // 6
                    StringResources.Notification_Done,              // 7
                    LaunchArgumentsHelper.GetArgCompleteTask(task), // 8
                    StringResources.Notification_Edit,              // 9
                    LaunchArgumentsHelper.GetArgEditTask(task)      // 10
                    );

                xmlDocument.LoadXml(content);

                return(xmlDocument);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, string.Format("Exception CreateTaskToastNotification: {0}", content));
                return(null);
            }
        }
Beispiel #18
0
        public static string FindPhoneNumber(IPlatformService platformService, params string[] contents)
        {
            if (contents == null || contents.Length == 0)
            {
                return(null);
            }

            string           result  = null;
            HashSet <string> matches = new HashSet <string>();

            try
            {
                if (platformService == null || platformService.DeviceFamily != DeviceFamily.WindowsMobile)
                {
                    return(null);
                }

                foreach (string content in contents)
                {
                    if (content == null)
                    {
                        continue;
                    }

                    foreach (var regex in phoneRegexes)
                    {
                        var match = regex.Match(content);
                        if (match.Success && !string.IsNullOrWhiteSpace(match.Value))
                        {
                            string candidate = match.Value.Trim();
                            if (!matches.Contains(candidate))
                            {
                                matches.Add(candidate);
                            }
                        }
                    }
                }

                int length = -1;
                foreach (string match in matches)
                {
                    if (match.Length > length)
                    {
                        result = match;
                        length = match.Length;
                    }
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Error while getting phone numbers");
            }

            return(result);
        }
Beispiel #19
0
 private void OnTextChanging(RichEditBox sender, RichEditBoxTextChangingEventArgs args)
 {
     try
     {
         this.HighlightLinks();
     }
     catch (Exception ex)
     {
         TrackingManagerHelper.Exception(ex, "Exception in CustomRichEditBox.OnTextChanging");
     }
 }
Beispiel #20
0
        private async void ImageSourceChanged()
        {
            this.Children.Clear();

            string source = this.ImageSource;

            if (!string.IsNullOrEmpty(source))
            {
                this.bitmapSource = new BitmapImage();

                var image = new Image {
                    Stretch = Stretch.UniformToFill
                };
                this.bitmapSource.ImageOpened += this.ImageOnImageOpened;
                this.bitmapSource.ImageFailed += this.ImageOnImageFailed;

                try
                {
                    if (source.StartsWith("/"))
                    {
                        // embedded resource
                        this.bitmapSource.UriSource = SafeUri.Get("ms-appx://" + source, UriKind.Absolute);
                    }
                    else
                    {
                        // file stored in local app folder
                        // try to open the file
                        StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync(source);

                        using (IRandomAccessStream fileStream = await storageFile.OpenAsync(FileAccessMode.Read))
                        {
                            await this.bitmapSource.SetSourceAsync(fileStream);
                        }
                    }
                }
                catch (Exception ex)
                {
                    TrackingManagerHelper.Exception(ex, "Exception TileCanvas.ImageSourceChanged");
                }

                image.Source = this.bitmapSource;

                if (this.Children.Count == 0)
                {
                    this.Children.Add(image);
                }
            }

            if (this.opacityBorder != null)
            {
                this.opacityBorder.Opacity = 1 - this.ImageOpacity;
            }
        }
Beispiel #21
0
 private void OnManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
 {
     try
     {
         this.panAreaTransform  = GetCompositeTransform(this.panArea);
         this.paneRootTransform = GetCompositeTransform(this.paneRoot);
     }
     catch (Exception ex)
     {
         TrackingManagerHelper.Exception(ex, "SwipeableListView.OnManipulationStarted");
     }
 }
Beispiel #22
0
        public async Task InitializeAsync()
        {
            bool backgroundTaskAccess = await this.RegisterBackgroundTaskAsync();

            this.workbook.Settings.SetValue(CoreSettings.BackgroundAccess, backgroundTaskAccess);

            if (!backgroundTaskAccess)
            {
                return;
            }

            KeyValuePair <Guid, IBackgroundTaskRegistration> taskTimer = BackgroundTaskRegistration.AllTasks.FirstOrDefault(t => t.Value.Name == BackgroundTaskTimerName);

            if (taskTimer.Key == Guid.Empty || taskTimer.Value == null)
            {
                try
                {
                    var builder = new BackgroundTaskBuilder {
                        Name = BackgroundTaskTimerName, TaskEntryPoint = BackgroundTaskTimerEntryPoint
                    };
                    builder.SetTrigger(new TimeTrigger(BackgroundTaskRefreshTimeMin, false));
                    builder.Register();
                }
                catch (Exception ex)
                {
                    TrackingManagerHelper.Exception(ex, "Error while registering timer background task");
                }
            }

            KeyValuePair <Guid, IBackgroundTaskRegistration> taskNotification = BackgroundTaskRegistration.AllTasks.FirstOrDefault(t => t.Value.Name == BackgroundTaskNotificationName);

            if (taskNotification.Key == Guid.Empty || taskNotification.Value == null)
            {
                try
                {
                    var builder = new BackgroundTaskBuilder {
                        Name = BackgroundTaskNotificationName, TaskEntryPoint = BackgroundTaskNotificationEntryPoint
                    };
                    builder.SetTrigger(new ToastNotificationActionTrigger());
                    builder.Register();
                }
                catch (Exception ex)
                {
                    TrackingManagerHelper.Exception(ex, "Error while registering notification background task");
                }
            }

            // wait handle that is triggered when the workbook changes because of
            // Cortana's background service (eg. voice command to create a task)
            // OR notification toast (eg. complete a task with the toast shown
            WaitHandleHelper.RegisterForSignal(Constants.SyncPrimitiveBackgroundEvent, this.OnBackgroundEvent);
        }
Beispiel #23
0
        public async Task <DialogResult> ShowAsync(string title, string content, DialogButton button = DialogButton.OK)
        {
            try
            {
                var dialog = new ConcurrentMessageDialog(content, title);

                switch (button)
                {
                case DialogButton.OK:
                    dialog.Commands.Add(new UICommand(StringResources.General_LabelOk));
                    break;

                case DialogButton.OKCancel:
                    dialog.Commands.Add(new UICommand(StringResources.General_LabelOk));
                    dialog.Commands.Add(new UICommand(StringResources.General_LabelCancel));
                    break;

                case DialogButton.YesNo:
                    dialog.Commands.Add(new UICommand(StringResources.General_LabelYes));
                    dialog.Commands.Add(new UICommand(StringResources.General_LabelNo));
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(button));
                }

                IUICommand result = await dialog.ShowAsync();

                if (result == null)
                {
                    return(DialogResult.Cancel);
                }
                else if (result.Label == StringResources.General_LabelOk)
                {
                    return(DialogResult.OK);
                }
                else if (result.Label == StringResources.General_LabelCancel)
                {
                    return(DialogResult.Cancel);
                }
                else if (result.Label == StringResources.General_LabelYes)
                {
                    return(DialogResult.Yes);
                }
            }
            catch (Exception e)
            {
                TrackingManagerHelper.Exception(e, string.Format("MessageBoxService.ShowAsync title: {0} content: {1}", title, content));
            }

            return(DialogResult.No);
        }
Beispiel #24
0
        protected override void OnTapped(TappedRoutedEventArgs e)
        {
            base.OnTapped(e);

            try
            {
                this.HandleTap(e);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Exception in CustomRichEditBox.OnTapped");
            }
        }
Beispiel #25
0
        private ToastNotifier CreateToastNotifier()
        {
            try
            {
                return(ToastNotificationManager.CreateToastNotifier());
            }
            catch (Exception e)
            {
                TrackingManagerHelper.Exception(e, "Error while creating toast notifier in AlarmManager");
            }

            return(null);
        }
Beispiel #26
0
        private async Task <bool> RegisterBackgroundTaskAsync()
        {
            try
            {
                await BackgroundExecutionManager.RequestAccessAsync();

                return(true);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "BackgroundTaskManager.RegisterBackgroundTaskAsync");
                return(false);
            }
        }
Beispiel #27
0
 private void OnCloseSwipeablePaneCompleted(object sender, object e)
 {
     try
     {
         if (this.dismissLayer != null)
         {
             this.dismissLayer.IsHitTestVisible = false;
         }
     }
     catch (Exception ex)
     {
         TrackingManagerHelper.Exception(ex, "SwipeableListView.OnCloseSwipeablePaneCompleted");
     }
 }
Beispiel #28
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            await this.BootstrapFrame(e, null);

            try
            {
                var platform = Ioc.Resolve <IPlatformService>();
                var synchronizationManager = Ioc.Resolve <ISynchronizationManager>();
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Exception while setting update Localytics");
            }
        }
Beispiel #29
0
        private static async void OnElementTapped(object sender, TappedRoutedEventArgs e)
        {
            string target = GetTarget((DependencyObject)sender);

            try
            {
                if (!string.IsNullOrEmpty(target))
                {
                    await Launcher.LaunchUriAsync(SafeUri.Get(target));
                }
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Exception OpenHyperlinkOnTap.OnElementTapped");
            }
        }
Beispiel #30
0
 private static void OnTapped(object sender, TappedRoutedEventArgs e)
 {
     try
     {
         FrameworkElement frameworkElement = (FrameworkElement)sender;
         var popup = TreeHelper.FindParent <Popup>(frameworkElement);
         if (popup != null)
         {
             popup.IsOpen = false;
         }
     }
     catch (Exception ex)
     {
         TrackingManagerHelper.Exception(ex, "CloseFlyoutOnTap.OnTapped");
     }
 }