예제 #1
0
        public WelcomeListView()
        {
            InitializeComponent();

            MainForm.Instance.EventController.VolumeNeedsRefreshing += new VolumeDescriptorChangedHandler(EventController_VolumeDescriptorActiveChanged);

            this.mVolumeListView.EmptyListMsg = "Press 'Add' to set up a new backup volume";

            mFileImageListTreeViewHelper = new FileImageListViewHelper(mColumn, mImageList);

            mColumn.AspectName = "Name";

            mStatusColumn.Text         = "Status";
            mStatusColumn.Width        = 100;
            mStatusColumn.TextAlign    = HorizontalAlignment.Left;
            mStatusColumn.AspectGetter = delegate(object modelObject)
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject);
                return(rootObject.VolumeDescriptor.StateString);
            };

            mLastBackupColumn.Text         = "Last backup";
            mLastBackupColumn.Width        = 100;
            mLastBackupColumn.TextAlign    = HorizontalAlignment.Center;
            mLastBackupColumn.AspectGetter = delegate(object modelObject)
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject);
                if (rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable)
                {
                    if (rootObject.VolumeDescriptor.Volume != null && rootObject.VolumeDescriptor.Volume.BackupInProgress)
                    {
                        return("In Progress");
                    }
                    else
                    {
                        return(rootObject.VolumeDescriptor.LastAttemptedBackupFuzzyString);
                    }
                }
                else
                {
                    return("");
                }
            };

            mPathColumn.Text         = "Path";
            mPathColumn.Width        = 180;
            mPathColumn.TextAlign    = HorizontalAlignment.Left;
            mPathColumn.AspectGetter = delegate(object modelObject)
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject);
                if (rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable)
                {
                    return(rootObject.VolumeDescriptor.Volume.Source.GetOnDiskPath(""));
                }
                else
                {
                    return("");
                }
            };

            mSizeOnDiskColumn.Text  = "Size on disk";
            mSizeOnDiskColumn.Width = 80;

            mSizeOnDiskColumn.TextAlign    = HorizontalAlignment.Center;
            mSizeOnDiskColumn.AspectGetter = delegate(object modelObject)
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject);
                return(rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable ? rootObject.VolumeDescriptor.TotalDatabaseSizeString : "");
            };

            mRevisionsAvailableColumn.Text         = "Revisions";
            mRevisionsAvailableColumn.Width        = 60;
            mRevisionsAvailableColumn.TextAlign    = HorizontalAlignment.Center;
            mRevisionsAvailableColumn.AspectGetter = delegate(object modelObject)
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject);
                return(rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable ? rootObject.VolumeDescriptor.Volume.Database.GetRevisionHistory().Count.ToString() : "");
            };

            mVolumeListView.Columns.Add(mStatusColumn);
            mVolumeListView.Columns.Add(mLastBackupColumn);
            mVolumeListView.Columns.Add(mPathColumn);
            mVolumeListView.Columns.Add(mSizeOnDiskColumn);
            mVolumeListView.Columns.Add(mRevisionsAvailableColumn);

            mVolumeListView.SelectedIndexChanged += new EventHandler(mVolumeListView_SelectedIndexChanged);

            mVolumeListView.CustomSorter = new BrightIdeasSoftware.SortDelegate(CustomSortHandler);

            System.Reflection.Assembly assem = System.Reflection.Assembly.GetEntryAssembly();

//			System.Diagnostics.Debug.WriteLine( string.Join( ", ", assem.GetManifestResourceNames() ) );

            CreateIcon(assem, "AutoUSBBackup.Resources.pendrive32x32.png", out mIconIndex, out mIcon);
            CreateIcon(assem, "AutoUSBBackup.Resources.pendrivebusy32x32.png", out mBusyIconIndex, out mBusyIcon);
            CreateIcon(assem, "AutoUSBBackup.Resources.localfolder32x32.png", out mFolderIconIndex, out mFolderIcon);
            CreateIcon(assem, "AutoUSBBackup.Resources.localfolderbusy32x32.png", out mFolderBusyIconIndex, out mFolderBusyIcon);
            CreateIcon(assem, "", out mNullIconIndex, out mNullIcon);

            mVolumeListView.LargeImageList       = mImageList;
            mVolumeListView.SmallImageList       = mImageList;
            mVolumeListView.ShowImagesOnSubItems = true;

            mButtonOptions.Visible = false;

            MainForm.Instance.EventController.BackupFinished += new VolumeBackupHandler(Spine_BackupFinished);

            mVolumeListView.CheckStateGetter = new BrightIdeasSoftware.CheckStateGetterDelegate(CheckStateGetterMethod);
            mVolumeListView.CheckStatePutter = new BrightIdeasSoftware.CheckStatePutterDelegate(CheckStateSetterMethod);
        }
예제 #2
0
        public WelcomeListView()
        {
            InitializeComponent();

            MainForm.Instance.EventController.VolumeNeedsRefreshing += new VolumeDescriptorChangedHandler( EventController_VolumeDescriptorActiveChanged );

            this.mVolumeListView.EmptyListMsg = "Press 'Add' to set up a new backup volume";

            mFileImageListTreeViewHelper = new FileImageListViewHelper(mColumn, mImageList);

            mColumn.AspectName = "Name";

            mStatusColumn.Text = "Status";
            mStatusColumn.Width = 100;
            mStatusColumn.TextAlign = HorizontalAlignment.Left;
            mStatusColumn.AspectGetter = delegate( object modelObject )
            {
                InternalRootObject rootObject = (( InternalRootObject )modelObject );
                return rootObject.VolumeDescriptor.StateString;
            };

            mLastBackupColumn.Text = "Last backup";
            mLastBackupColumn.Width = 100;
            mLastBackupColumn.TextAlign = HorizontalAlignment.Center;
            mLastBackupColumn.AspectGetter = delegate( object modelObject )
            {
                InternalRootObject rootObject = ( ( InternalRootObject )modelObject );
                if ( rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable )
                {
                    if ( rootObject.VolumeDescriptor.Volume != null && rootObject.VolumeDescriptor.Volume.BackupInProgress )
                        return "In Progress";
                    else
                        return rootObject.VolumeDescriptor.LastAttemptedBackupFuzzyString;
                }
                else
                    return "";
            };

            mPathColumn.Text = "Path";
            mPathColumn.Width = 180;
            mPathColumn.TextAlign = HorizontalAlignment.Left;
            mPathColumn.AspectGetter = delegate( object modelObject )
            {
                InternalRootObject rootObject = ( ( InternalRootObject )modelObject );
                if ( rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable )
                {
                    return rootObject.VolumeDescriptor.Volume.Source.GetOnDiskPath( "" );
                }
                else
                    return "";
            };

            mSizeOnDiskColumn.Text = "Size on disk";
            mSizeOnDiskColumn.Width = 80;

            mSizeOnDiskColumn.TextAlign = HorizontalAlignment.Center;
            mSizeOnDiskColumn.AspectGetter = delegate( object modelObject )
            {
                InternalRootObject rootObject = ( ( InternalRootObject )modelObject );
                return rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable ? rootObject.VolumeDescriptor.TotalDatabaseSizeString : "";
            };

            mRevisionsAvailableColumn.Text = "Revisions";
            mRevisionsAvailableColumn.Width = 60;
            mRevisionsAvailableColumn.TextAlign = HorizontalAlignment.Center;
            mRevisionsAvailableColumn.AspectGetter = delegate( object modelObject )
            {
                InternalRootObject rootObject = ( ( InternalRootObject )modelObject );
                return rootObject.VolumeDescriptor != null && rootObject.VolumeDescriptor.IsAvailable ? rootObject.VolumeDescriptor.Volume.Database.GetRevisionHistory().Count.ToString() : "";
            };

            mVolumeListView.Columns.Add( mStatusColumn );
            mVolumeListView.Columns.Add( mLastBackupColumn );
            mVolumeListView.Columns.Add( mPathColumn );
            mVolumeListView.Columns.Add( mSizeOnDiskColumn );
            mVolumeListView.Columns.Add( mRevisionsAvailableColumn );

            mVolumeListView.SelectedIndexChanged += new EventHandler( mVolumeListView_SelectedIndexChanged );

            mVolumeListView.CustomSorter = new BrightIdeasSoftware.SortDelegate( CustomSortHandler );

            System.Reflection.Assembly assem = System.Reflection.Assembly.GetEntryAssembly();

            //			System.Diagnostics.Debug.WriteLine( string.Join( ", ", assem.GetManifestResourceNames() ) );

            CreateIcon( assem, "AutoUSBBackup.Resources.pendrive32x32.png", out mIconIndex, out mIcon );
            CreateIcon( assem, "AutoUSBBackup.Resources.pendrivebusy32x32.png", out mBusyIconIndex, out mBusyIcon );
            CreateIcon( assem, "AutoUSBBackup.Resources.localfolder32x32.png", out mFolderIconIndex, out mFolderIcon );
            CreateIcon( assem, "AutoUSBBackup.Resources.localfolderbusy32x32.png", out mFolderBusyIconIndex, out mFolderBusyIcon );
            CreateIcon( assem, "", out mNullIconIndex, out mNullIcon );

            mVolumeListView.LargeImageList = mImageList;
            mVolumeListView.SmallImageList = mImageList;
            mVolumeListView.ShowImagesOnSubItems = true;

            mButtonOptions.Visible = false;

            MainForm.Instance.EventController.BackupFinished += new VolumeBackupHandler( Spine_BackupFinished );

            mVolumeListView.CheckStateGetter = new BrightIdeasSoftware.CheckStateGetterDelegate( CheckStateGetterMethod );
            mVolumeListView.CheckStatePutter = new BrightIdeasSoftware.CheckStatePutterDelegate( CheckStateSetterMethod );
        }