Exemple #1
0
        // Open archive button
        private async void OpenArchiveButton_OnClicked(object sender, EventArgs e)
        {
            var file = await _browser.BrowseForLoad();

            if (file == null)
            {
                return;
            }

            try
            {
                // Load Archive in the background
                var archive = await Task.Run(() => Archive.Archive.Open(file));

                foreach (var session in archive.Sessions)
                {
                    session.Register();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"ERROR OPENING ARCHIVE: {ex.Message} \n{ex}");
                await XamarinHelpers.GetCurrentPage().DisplayAlert("Open error", $"Could not open archive:\n{ex.Message}", "OK");
            }
        }
 private void RootFrameOnPreviewKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (XamarinHelpers.GetCurrentPage() is KeypressPage keyPage)
     {
         var keyArgs = KeypressHandler.VirtualKeyToKeyEvent(e.Key, e.Handled, true);
         KeypressHandler.KeyPageKeyDown(keyPage, keyArgs);
         e.Handled = keyArgs.Handled;
     }
 }
Exemple #3
0
        private void OnCloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
        {
            if (!(XamarinHelpers.GetCurrentPage() is SavingPage savingPage))
            {
                return;
            }

            e.Handled = savingPage.ExitShouldBeInterrupted(e.Handled, ForceClose);
        }
Exemple #4
0
        public CustomNavigationBar()
        {
            InitializeComponent();

            _browser = DependencyService.Get <IFileBrowser>();
            if (_browser == null)
            {
                XamarinHelpers.GetCurrentPage(Navigation).DisplayAlert("Critical error", "Could get file browser. Will not be able to open and save files.", "OK");
            }
        }
        public PlayerPage()
        {
            InitializeComponent();
            _browser = DependencyService.Get <IFileBrowser>();
            if (_browser == null)
            {
                XamarinHelpers.GetCurrentPage(Navigation).DisplayAlert("Critical error",
                                                                       "Could get file browser. Will not be able to open and save files.", "OK");
            }

            NavigationBar.MainPageButton.BackgroundColor = Color.FromHex("23A2B1");
            ViewerContext?.SetSynchronizedToWorldClock(true);

            Appearing    += OnAppearing;
            Disappearing += OnDisappearing;
        }
Exemple #6
0
        // Import files handling
        private static async void DoImportFiles(IEnumerable <IReadSeekStreamFactory> files)
        {
            var pluginPages = new Dictionary <IImportPlugin, (List <IReadSeekStreamFactory>, ImportParametersPage)>();

            foreach (var file in files)
            {
                var ext = file.Extension.ToLower();
                // FIXME: This should probably be handled somewhere else?
                // FIXME: This should also handle a case where multiple importers are possible
                // TODO: Should probably be run on a background thread...

                // Find the proper import plugin to use
                var plugins = PluginService.GetAll <IImportPlugin>(ext);

                if (!plugins.Any())
                {
                    await XamarinHelpers.GetCurrentPage().DisplayAlert("Import error", $"Could not find a plugin for extension \"{ext}\" files", "OK");

                    continue;
                }

                foreach (var plugin in plugins)
                {
                    try
                    {
                        if (!(await plugin.CanParse(file)))
                        {
                            continue;
                        }
                    } catch (Exception ex)
                    {
                        await ShowError(file.Name, ex);
                    }
                    try
                    {
                        List <IReadSeekStreamFactory> streamFactoryList;

                        if (!pluginPages.TryGetValue(plugin, out var listPage))
                        {
                            var parameters = new Dictionary <string, (object, string)>
                            {
Exemple #7
0
        public SavingPage()
        {
            InitializeComponent();
            NavigationBar.SaveArchiveButton.BackgroundColor = Color.FromHex("23A2B1");
            DataRegistry.ProviderAdded   += el => DataTree.Tree.Children.Add(el);
            DataRegistry.ProviderRemoved += el => DataTree.Tree.Children.Remove(el);

            // Add current items
            foreach (var dataProvider in DataRegistry.Providers)
            {
                DataTree.Tree.Children.Add(dataProvider);
            }

            SavingTree.ItemDroppedOn  += SavingTreeOnItemDroppedOn;
            RemovalTree.ItemDroppedOn += RemovalTreeOnItemDroppedOn;

            _browser = DependencyService.Get <IFileBrowser>();
            if (_browser == null)
            {
                XamarinHelpers.GetCurrentPage(Navigation).DisplayAlert("Critical error", "Could get file browser. Will not be able to open and save files.", "OK");
            }
        }