Esempio n. 1
0
        public void Start(SVBookLibrary lib)
        {
            Library = lib;
            LocalDb = lib.GetLocalFileDatabase();
            updaterSelectFiles1.Library = lib;

            if (lib.Status == SVBookLibrary.DBStatus.Idle ||
                lib.Status == SVBookLibrary.DBStatus.Stopped)
            {
                lib.FetchRemote(new SVBookLibrary.OnStringCompletedDelegate(OnStepCompletedAsync));
                SelectTab(0);
            }
            else if (lib.Status == SVBookLibrary.DBStatus.Fetching)
            {
                if (Library.Callback == null)
                {
                    Library.Callback = new SVBookLibrary.OnStringCompletedDelegate(OnStepCompletedAsync);
                }
                SelectTab(0);
            }
            else if (lib.Status == SVBookLibrary.DBStatus.Updated)
            {
                SelectTab(1);
                updaterSelectFiles1.UpdateLists();
            }

            updaterGetStatus1.SetStatus(lib.Status, "Error");
        }
Esempio n. 2
0
        public ViewFrame()
        {
            InitializeComponent();
            AdjustLayoutPageView();

            pageView1.mainFrameDelegate = this;
            pageView1.InitBitmaps();

            panelBook.Dock           = DockStyle.Fill;
            panelFiles.Dock          = DockStyle.Fill;
            panelUpdater.Dock        = DockStyle.Fill;
            panelSelectLanguage.Dock = DockStyle.Fill;

            panelDownload          = new UpdaterDownloader();
            panelDownload.Parent   = this;
            panelDownload.Location = panelBook.Location;
            panelDownload.Size     = panelBook.Size;
            this.Controls.Add(panelDownload);
            panelDownload.Dock                = DockStyle.Fill;
            panelDownload.OnExit             += new GeneralArgsEvent(panelDownload_OnExit);
            panelDownload.OnDownloadComplete += new GeneralArgsEvent(panelDownload_OnDownloadComplete);
            panelDownload.Visible             = false;

            string dir = Properties.Settings.Default.FilesDirectory;

            if (!Directory.Exists(dir))
            {
                bool bOdmietnute = true;
                while (bOdmietnute)
                {
                    FolderBrowserDialog fbd = new FolderBrowserDialog();
                    fbd.Description = "Select folder on your local computer, where all data files will be stored for this application.";
                    if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        dir = fbd.SelectedPath;
                        Properties.Settings.Default.FilesDirectory = dir;
                        Properties.Settings.Default.Save();
                        bOdmietnute = false;
                    }
                }
            }

            Library.LastDirectory = dir;
            Library.GetCurrentBookDatabase(dir);
            Library.CalculateDatabaseStatus();
            Library.FetchRemote(null);

            ReviewFrame.DisplayWindow();
        }