/// ------------------------------------------------------------------------------------ /// <summary> /// Protected constructor for initialization in tests /// </summary> /// <param name="projectsRootFolder">The root folder for projects (typically the /// default, but if these setings represent a project elsewhere, then this will be the /// root folder for this project).</param> /// <param name="projectName">Name of the project.</param> /// <param name="linkedFilesPath">The linked files path.</param> /// <param name="sharedProjectFolder">A possibly alternate project path that /// should be used for things that should be shared.</param> /// <param name="originalProjType">Type of the project before converting for backup.</param> /// ------------------------------------------------------------------------------------ protected BackupProjectSettings(string projectsRootFolder, string projectName, string linkedFilesPath, string sharedProjectFolder, FDOBackendProviderType originalProjType) : base(projectsRootFolder, linkedFilesPath, sharedProjectFolder) { ProjectName = projectName; DbVersion = FDOBackendProvider.ModelVersion; FwVersion = new FwVersionInfoProvider(Assembly.GetExecutingAssembly(), false).FieldWorksVersion; // For DB4o projects, we need to convert them over to XML. We can't put the // converted project in the same directory so we convert them to a temporary // directory (see FWR-2813). DatabaseFolder = (originalProjType == FDOBackendProviderType.kXML) ? ProjectPath : Path.GetTempPath(); DestinationFolder = DirectoryFinder.DefaultBackupDirectory; BackupTime = DateTime.Now; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initialize text of controls prior to display /// </summary> /// ------------------------------------------------------------------------------------ protected void InitControlLabels() { try { // Set the Application label to the name of the app if (m_productExecutableAssembly != null) { FwVersionInfoProvider viProvider = new FwVersionInfoProvider(m_productExecutableAssembly, m_fDisplaySILInfo); lblProductName.Text = viProvider.ProductName; Text = lblProductName.Text; lblAppVersion.Text = viProvider.ApplicationVersion; lblFwVersion.Text = viProvider.FieldWorksVersion; lblCopyright.Text = viProvider.CopyrightString; } } catch { // ignore errors } }
/// ------------------------------------------------------------------------------------ /// <summary> /// When the window handle gets created we want to initialize the controls /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); try { // Set the Application label to the name of the app FwVersionInfoProvider viProvider = new FwVersionInfoProvider(ProductExecutableAssembly, true); lblName.Text = viProvider.ProductName; lblAppVersion.Text = viProvider.ApplicationVersion; lblFwVersion.Text = viProvider.FieldWorksVersion; lblCopyright.Text = viProvider.CopyrightString; // Set the title bar text Text = string.Format(m_sTitleFmt, viProvider.ProductName); string strRoot = Path.GetPathRoot(Application.ExecutablePath); // Set the memory information Win32.MemoryStatus ms = new Win32.MemoryStatus(); Win32.GlobalMemoryStatus(ref ms); edtAvailableMemory.Text = string.Format(m_sAvailableMemoryFmt, ms.dwAvailPhys / 1024, ms.dwTotalPhys / 1024); // Set the available disk space information. uint cSectorsPerCluster = 0, cBytesPerSector = 0, cFreeClusters = 0, cTotalClusters = 0; Win32.GetDiskFreeSpace(strRoot, ref cSectorsPerCluster, ref cBytesPerSector, ref cFreeClusters, ref cTotalClusters); uint cbKbFree = (uint)(((Int64)cFreeClusters * cSectorsPerCluster * cBytesPerSector) >> 10); edtAvailableDiskSpace.Text = string.Format(m_sAvailableDiskSpaceFmt, cbKbFree, strRoot); } catch { // ignore errors } }