Ejemplo n.º 1
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     using (var db = new Models.PydioContext())
     {
         Server = db.Servers.Where(b => b.ServerId == (int)e.Parameter).First();
         API    = new Pydio.API(Server);
         BrowseRoot();
     }
 }
Ejemplo n.º 2
0
 private void PageLoaded(object sender, RoutedEventArgs e)
 {
     using (var db = new Models.PydioContext())
     {
         pydioServers = new ObservableCollection<Models.Server>(db.Servers.ToList());
         Servers.ItemsSource = pydioServers;
         System.Diagnostics.Debug.WriteLine("Servers:"+ pydioServers.Count);
     }
 }
Ejemplo n.º 3
0
 private void PageLoaded(object sender, RoutedEventArgs e)
 {
     using (var db = new Models.PydioContext())
     {
         pydioServers        = new ObservableCollection <Models.Server>(db.Servers.ToList());
         Servers.ItemsSource = pydioServers;
         System.Diagnostics.Debug.WriteLine("Servers:" + pydioServers.Count);
     }
 }
Ejemplo n.º 4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            using (var db = new Models.PydioContext())
            {

                Server = db.Servers.Where(b => b.ServerId == (int)e.Parameter).First();
                API = new Pydio.API(Server);
                BrowseRoot();
            }
        }
Ejemplo n.º 5
0
        private void refreshServers()
        {
            using (var db = new Models.PydioContext())
            {
                pydioServers = new ObservableCollection <Models.Server>(db.Servers.ToList());
                MasterListView.ItemsSource = pydioServers;
                System.Diagnostics.Debug.WriteLine("Servers:" + pydioServers.Count);

                UpdateForVisualState(AdaptiveStates.CurrentState);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            using (var db = new Models.PydioContext())
            {
                db.Database.Migrate();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            using (var db = new Models.PydioContext())
            {
                db.Database.Migrate();
            }
        }
Ejemplo n.º 8
0
        private async void delete_Click(object sender, RoutedEventArgs e)
        {
            if (_lastSelectedItem != null)
            {
                using (var db = new Models.PydioContext())
                {
                    var dialog = new Windows.UI.Popups.MessageDialog("Delete server ?");

                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("Yes")
                    {
                        Id = 0
                    });
                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("No")
                    {
                        Id = 1
                    });


                    dialog.DefaultCommandIndex = 0;
                    dialog.CancelCommandIndex  = 1;

                    var result = await dialog.ShowAsync();

                    System.Diagnostics.Debug.WriteLine("result:" + result.Id.ToString());


                    if (result.Id.ToString().Equals("0"))
                    {
                        db.Servers.Remove(_lastSelectedItem);
                        db.SaveChanges();
                        _lastSelectedItem = null;

                        setServer();
                        isEditting = false;
                        adjustColumns();
                        refreshServers();
                        Notify("Server Deleted");
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private async void saveServer(object sender, RoutedEventArgs e)
        {
            using (var db = new Models.PydioContext())
            {
                Models.Server server = new Models.Server();
                server.Name     = label.Text.Trim();
                server.Url      = serverAddress.Text.Trim();
                server.Password = password.Password;
                server.Username = userName.Text;

                string dialogText;

                if (_lastSelectedItem != null)
                {
                    server.ServerId   = _lastSelectedItem.ServerId;
                    _lastSelectedItem = server;
                    db.Servers.Update(_lastSelectedItem);
                    dialogText = "Server saved !";
                }
                else
                {
                    db.Servers.Add(server);
                    dialogText = "Server added !";
                }
                db.SaveChanges();



                refreshServers();

                Notify("Server Saved");
                //var dialog = new Windows.UI.Popups.MessageDialog(dialogText);
                //dialog.Commands.Add(new Windows.UI.Popups.UICommand("Ok") { Id = 0 });

                //var result = await dialog.ShowAsync();
                isEditting = false;
                adjustColumns();
            }
        }
Ejemplo n.º 10
0
        private void refreshServers()
        {
            using (var db = new Models.PydioContext())
            {
                pydioServers = new ObservableCollection<Models.Server>(db.Servers.ToList());
                MasterListView.ItemsSource = pydioServers;
                System.Diagnostics.Debug.WriteLine("Servers:" + pydioServers.Count);

                UpdateForVisualState(AdaptiveStates.CurrentState);
            }
        }
Ejemplo n.º 11
0
        private async void delete_Click(object sender, RoutedEventArgs e)
        {
            if (_lastSelectedItem != null)
            {
                using (var db = new Models.PydioContext())
                {
                    var dialog = new Windows.UI.Popups.MessageDialog("Delete server ?");

                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("Yes") { Id = 0 });
                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("No") { Id = 1 });


                    dialog.DefaultCommandIndex = 0;
                    dialog.CancelCommandIndex = 1;

                    var result = await dialog.ShowAsync();

                    System.Diagnostics.Debug.WriteLine("result:" + result.Id.ToString());


                    if (result.Id.ToString().Equals("0"))
                    {
                        db.Servers.Remove(_lastSelectedItem);
                        db.SaveChanges();
                        _lastSelectedItem = null;

                        setServer();
                        isEditting = false;
                        adjustColumns();
                        refreshServers();
                        Notify("Server Deleted");

                    }
                }
            }
        }
Ejemplo n.º 12
0
        private async void saveServer(object sender, RoutedEventArgs e)
        {
            using (var db = new Models.PydioContext())
            {

                Models.Server server = new Models.Server();
                server.Name = label.Text.Trim();
                server.Url = serverAddress.Text.Trim();
                server.Password = password.Password;
                server.Username = userName.Text;

                string dialogText;

                if (_lastSelectedItem != null)
                {
                    server.ServerId = _lastSelectedItem.ServerId;
                    _lastSelectedItem = server;
                    db.Servers.Update(_lastSelectedItem);
                    dialogText = "Server saved !";
                }
                else {
                    db.Servers.Add(server);
                    dialogText = "Server added !";
                }
                db.SaveChanges();



                refreshServers();

                Notify("Server Saved");
                //var dialog = new Windows.UI.Popups.MessageDialog(dialogText);
                //dialog.Commands.Add(new Windows.UI.Popups.UICommand("Ok") { Id = 0 });

                //var result = await dialog.ShowAsync();
                isEditting = false;
                adjustColumns();
            }

        }