Exemplo n.º 1
0
        public ucMain(frmMain f)
        {
            main = f;

            InitializeComponent();

            Synchronizer = new FileSynchronization(ref frmParent.FocasaMonitoredFolders, new string[] { ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".png" });

            using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
            {
                LoadFolders();
                LoadItems();
            }
        }
Exemplo n.º 2
0
        public ucMain(frmMain f)
        {
            main = f;

            InitializeComponent();

            Synchronizer = new FileSynchronization(ref frmParent.FocasaMonitoredFolders, new string[] { ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".png" });

            using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
            {
                LoadFolders();
                LoadItems();
            }
        }
Exemplo n.º 3
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);
                }
            }
        }
Exemplo n.º 4
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);
                }
            }
        }