|
By default whenever a new album is added the Publishing Settings is set to Upload. How can I make the default in FotoVision only?
thanks,
jeff reed | | MigrationUser 1 Thursday, August 12, 2004 5:48 PM | New albums are created in the panes\AlbumsPane.vb \ CreateNewAlbum method. One way to do this, is to raise the event that specifies the album publish setting in this method. For example:
' create a new album, use the next available album name Public Sub CreateNewAlbum() Try ' create new album in the photos location Dim newAlbum As String = FileManager.AddNewAlbum() AddItem(newAlbum) RaiseEvent NewAlbumCreated(Me, New AlbumNameEventArgs(newAlbum))
<b>' don't publish the new album RaiseEvent PublishAlbumClicked(Me, _ New PublishAlbumEventArgs(Me.SelectedAlbum, False))</b> Catch ex As Exception Global.DisplayError("A new album could not be created.", ex) End Try End Sub
-- ralph arvesen
| | MigrationUser 1 Friday, August 13, 2004 11:29 AM | Ralph,
Thanks for your input, as it was most enlightening.
jeff
| | MigrationUser 1 Monday, August 16, 2004 1:04 PM | Ralph,
Your feedback provided the information when creating a “new album� \
However, when creating a new album via “import folder…�nbsp;or “import photos…�nbsp;or when drag and drop �nbsp;the new album is still created with the Publishing Settings set to upload.
I have examined the methods for these action but am unable to determine how the new album is created under these circumstances.
Do you know how to make new album creation consistent?
TIA,
jeff
' display the import photos dialog and add selected photos ' to the current album, create a new album is necessary Public Sub ImportPhotos() ' create file open dialog, allow multiple photos to be selected ' restore the FilterIndex and InitialDirectory to the previous selections Dim dialog As New OpenFileDialog dialog.Title = Consts.ImportPhotoDialogTitle dialog.Multiselect = True dialog.Filter = FileManager.OpenFilter dialog.FilterIndex = Global.Settings.GetInt(SettingKey.ImportFilterIndex) dialog.InitialDirectory = Global.Settings.GetString(SettingKey.ImportLocation)
If dialog.ShowDialog() = DialogResult.OK Then ' store selected filter index Global.Settings.SetValue(SettingKey.ImportFilterIndex, dialog.FilterIndex)
' store location If dialog.FileNames.Length > 0 Then Global.Settings.SetValue(SettingKey.ImportLocation, _ IO.Path.GetDirectoryName(dialog.FileName)) End If
' add the selected files ImportFiles(dialog.FileNames) End If End Sub
' display the folder browser dialog and add the folder ' to the local photos Public Sub ImportFolder() ' create file browser dialog ' restore the selected folder location Dim dialog As New FolderBrowserDialog dialog.Description = Consts.ImportFolderDescription dialog.ShowNewFolderButton = False dialog.SelectedPath = Global.Settings.GetString(SettingKey.ImportLocation)
If dialog.ShowDialog() = DialogResult.OK Then ' store the location Global.Settings.SetValue(SettingKey.ImportLocation, dialog.SelectedPath)
' add the files in the selected location Dim files(0) As String files(0) = dialog.SelectedPath ProcessDroppedFilesRoot(files, False) End If End Sub
| | MigrationUser 1 Monday, August 16, 2004 6:39 PM | You are exactly right Jeff, sorry about that, I'm not sure what I was thinking.
Albums are folders on the file system and are created in <b>AddAlbum</b> method of the <b>util\FileManager</b> class. That is the correct place to modify the default properties of an album; you can modify that method to the following:
' add the album to the local photos area Public Shared Sub AddAlbum(ByVal name As String) ' full path to the album Dim albumPath As String = Path.Combine(Location, name)
' create the folder Directory.CreateDirectory(albumPath)
' set default album properties (not published) Dim album As New Album album.Path = albumPath album.Publish = False album.WriteXml() End Sub
By default, the album does not contain an xml file and the <b>Publish</b> property defaults to True. A second option (and less code), is to set the default <b>Publish</b> value to False in the <b>ReadXml</b> method of the <b>util\Album</b> class.
Let me know if either of these work out for you. -- ralph arvesen | | MigrationUser 1 Tuesday, August 17, 2004 10:40 AM | Setting Me.Publish = False in the ReadXml method works for all new albums. Although I was having some issues, I'll do some more testing with the AddAlbum method later.
Thanks for the help, it's much appreciated.
jr | | MigrationUser 1 Wednesday, August 18, 2004 3:28 PM |
|