示例#1
0
        private void optionsFolderManagement_Click(object sender, EventArgs e)
        {
            frmFolderManagement f   = new frmFolderManagement();
            DialogResult        drs = f.ShowDialog();

            if (drs == System.Windows.Forms.DialogResult.OK)
            {
                bool      needSync  = false;
                DataTable dtChanges = FocasaMonitoredFolders.GetChanges();
                if (dtChanges == null)
                {
                    return;
                }
                DataTable dt = dtChanges.Copy();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
                        {
                            Dictionary <string, string> dic = new Dictionary <string, string>();

                            foreach (DataColumn dc in dt.Columns)
                            {
                                dic.Add(dc.ColumnName, dr[dc.ColumnName].ToString());
                            }
                            db.Insert("focasaMonitoredFolders", dic);
                            needSync = true;
                        }
                    }
                }

                if (needSync)
                {
                    Synchronizer = new FileSynchronization(ref FocasaMonitoredFolders, new string[] { ".jpg", ".jpeg", ".tif", ".tiff", ".bmp", ".png" });
                    FileSynchronization.OnSyncStateUpdate += FileSynchronization_OnSyncStateUpdate;
                    Task <int> t = FileSynchronization.Sync(dt);
                    int        i = t.Result;

                    mainDialog = new ucMain(this);
                    flpMain.Controls.Clear();
                    flpMain.Controls.Add(mainDialog);
                }
            }
        }
示例#2
0
        private void optionsFolderManagement_Click(object sender, EventArgs e)
        {
            frmFolderManagement f = new frmFolderManagement();
            DialogResult drs = f.ShowDialog();
            if (drs == System.Windows.Forms.DialogResult.OK)
            {
                bool needSync = false;
                DataTable dtChanges = FocasaMonitoredFolders.GetChanges();
                if (dtChanges == null)
                    return;
                DataTable dt = dtChanges.Copy();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
                        {
                            Dictionary<string, string> dic = new Dictionary<string, string>();

                            foreach (DataColumn dc in dt.Columns)
                            {
                                dic.Add(dc.ColumnName, dr[dc.ColumnName].ToString());
                            }
                            db.Insert("focasaMonitoredFolders", dic);
                            needSync = true;
                        }
                    }
                }

                if (needSync)
                {
                    Synchronizer = new FileSynchronization(ref FocasaMonitoredFolders, new string[]{".jpg",".jpeg",".tif",".tiff",".bmp",".png"});
                    FileSynchronization.OnSyncStateUpdate+=FileSynchronization_OnSyncStateUpdate;
                    Task<int> t = FileSynchronization.Sync(dt);
                    int i = t.Result;

                    mainDialog = new ucMain(this);
                    flpMain.Controls.Clear();
                    flpMain.Controls.Add(mainDialog);
                }
            }
        }