Esempio n. 1
0
        public SyncControlGridItemSet(LibrarySyncManager.SyncRequest sync_request, GlobalSyncDetail global_sync_detail)
        {
            this.sync_request       = sync_request;
            this.global_sync_detail = global_sync_detail;

            // Populate the grid datasource
            grid_items = new List <SyncControlGridItem>();
            foreach (var library_sync_detail in global_sync_detail.library_sync_details)
            {
                var grid_item = new SyncControlGridItem(library_sync_detail);

                grid_items.Add(grid_item);
            }
        }
        private void btnEditSyncSettings_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SyncControlGridItem dataRowView = (SyncControlGridItem)((Button)e.Source).DataContext;

                string id = dataRowView.Id;
                foreach (SyncControlGridItem item in sync_control_grid_item_set.grid_items)
                {
                    if (item.Id == id)
                    {
                        // turn this lib into an IntranetLibrary with a new path?
                        //
                        // https://stackoverflow.com/questions/11624298/how-to-use-openfiledialog-to-select-a-folder/41511598#answer-41511598
                        using (CommonOpenFileDialog dialog = new CommonOpenFileDialog())
                        {
                            dialog.InitialDirectory = item.SyncTarget;
                            dialog.IsFolderPicker   = true;
                            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                            {
                                try
                                {
                                    item.SyncTarget = dialog.FileName;
                                    GridLibraryGrid.Items.Refresh();
                                }
                                catch (NotImplementedException ex)
                                {
                                    MessageBoxes.Warn(ex.Message);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }