Permalink
Browse files

Added error handling in configurator, fixed issue where it would cras…

…h when not podcasts existed

Removed select podcast dir from UI ad it was causing clutter

git-svn-id: https://videobrowser.googlecode.com/svn/trunk@1180 096cc86f-8a4c-0410-9b85-8b5e0eee1c45
  • Loading branch information...
1 parent 43f800d commit d2c16ff8e8613c96d29d5ee1c431ad8c2ae7f46b sam.saffron committed Jun 10, 2009
Showing with 35 additions and 45 deletions.
  1. +5 −8 Configurator/MainWindow.xaml
  2. +30 −37 Configurator/MainWindow.xaml.cs
@@ -66,14 +66,11 @@
</TabItem>
<TabItem Header="podcasts" FontSize="14">
<Grid>
- <Label HorizontalAlignment="Left" Margin="21,0,0,42" VerticalAlignment="Bottom" Width="173" Height="35" Content="Podcast storage location:"/>
- <Label VerticalAlignment="Bottom" Height="35" Content="C:\ProgramData\MediaBrowser" Margin="200,0,19,42" x:Name="podcastsPath"/>
- <Button Margin="92,0,0,17" VerticalAlignment="Bottom" Height="30" Content="Change..." x:Name="changePodcastPath" Click="ChangePodcastPathClick" HorizontalAlignment="Left" Width="90" ToolTip="Change podcast data storage location" />
- <ListBox IsSynchronizedWithCurrentItem="True" Margin="21,20.38,0,130" x:Name="podcastList" DisplayMemberPath="Name" HorizontalAlignment="Left" Width="287" SelectionChanged="podcastList_SelectionChanged"/>
- <Button HorizontalAlignment="Left" Margin="21,0,0,92" VerticalAlignment="Bottom" Width="90" Height="32" Content="Add" x:Name="addPodcast" Click="addPodcast_Click" ToolTip="Add a video RSS feed" />
- <Button HorizontalAlignment="Left" Margin="123,0,0,92" VerticalAlignment="Bottom" Width="90" Height="32" Content="Remove" x:Name="removePodcast" Click="removePodcast_Click" ToolTip="Remove selected video RSS feed" />
- <Button Margin="224,0,0,92" VerticalAlignment="Bottom" Height="32" Content="Rename" x:Name="renamePodcast" HorizontalAlignment="Left" Width="84" Click="renamePodcast_Click" ToolTip="Rename video RSS feed display name" />
- <TextBlock Text="http://somepodcast.com/podcast.rss" d:LayoutOverrides="HorizontalAlignment, Height" x:Name="podcastUrl" VerticalAlignment="Bottom" Margin="0,0,36,92" FontSize="12" Height="38" TextWrapping="Wrap" HorizontalAlignment="Right" Width="285" />
+ <ListBox IsSynchronizedWithCurrentItem="True" Margin="21,20.38,0,76" x:Name="podcastList" DisplayMemberPath="Name" HorizontalAlignment="Left" Width="287" SelectionChanged="podcastList_SelectionChanged"/>
+ <Button HorizontalAlignment="Left" Margin="21,0,0,25" VerticalAlignment="Bottom" Width="90" Height="32" Content="Add" x:Name="addPodcast" Click="addPodcast_Click" ToolTip="Add a video RSS feed" />
+ <Button HorizontalAlignment="Left" Margin="123,0,0,25" VerticalAlignment="Bottom" Width="90" Height="32" Content="Remove" x:Name="removePodcast" Click="removePodcast_Click" ToolTip="Remove selected video RSS feed" />
+ <Button Margin="224,0,0,25" VerticalAlignment="Bottom" Height="32" Content="Rename" x:Name="renamePodcast" HorizontalAlignment="Left" Width="84" Click="renamePodcast_Click" ToolTip="Rename video RSS feed display name" />
+ <TextBlock Text="http://somepodcast.com/podcast.rss" d:LayoutOverrides="HorizontalAlignment, Height" x:Name="podcastUrl" VerticalAlignment="Bottom" Margin="0,0,33,76" FontSize="12" Height="38" TextWrapping="Wrap" HorizontalAlignment="Right" Width="285" />
<Label Height="29" Margin="0,21,36,0" Name="podcastName" VerticalAlignment="Top" FontWeight="Bold" HorizontalAlignment="Right" Width="285">The Cook and the Chef</Label>
<TextBlock Text="This is the podcast description hdkjhfsdk fdskfjhskfjhfdskjf kjshkfsjhfskjsdhkjh" Margin="323,67,33,136" Name="podcastDescription" TextWrapping="Wrap" />
</Grid>
@@ -41,71 +41,74 @@ public partial class MainWindow : Window
public MainWindow()
{
- Kernel.Init(KernelLoadDirective.ShadowPlugins);
+ try {
+ Initialize();
+ } catch (Exception ex) {
+ MessageBox.Show("Failed to start up, please post this contents on mediabrowser.tv/forums " + ex.ToString());
+ }
+
+ }
+ private void Initialize() {
+ Kernel.Init(KernelLoadDirective.ShadowPlugins);
+
InitializeComponent();
LoadComboBoxes();
- config = ConfigData.FromFile(ApplicationPaths.ConfigFile);
+ config = Kernel.Instance.ConfigData;
infoPanel.Visibility = Visibility.Hidden;
infoPlayerPanel.Visibility = Visibility.Hidden;
// first time the wizard has run
- if (config.InitialFolder != ApplicationPaths.AppInitialDirPath)
- {
- try
- {
+ if (config.InitialFolder != ApplicationPaths.AppInitialDirPath) {
+ try {
MigrateOldInitialFolder();
- }
- catch
- {
+ } catch {
MessageBox.Show("For some reason we were not able to migrate your old initial path, you are going to have to start from scratch.");
}
}
+
config.InitialFolder = ApplicationPaths.AppInitialDirPath;
RefreshItems();
RefreshPodcasts();
RefreshPlayers();
- LoadConfigurationSettings();
- for (char c = 'D'; c <= 'Z'; c++)
- {
+ LoadConfigurationSettings();
+
+ for (char c = 'D'; c <= 'Z'; c++) {
daemonToolsDrive.Items.Add(c.ToString());
}
- try
- {
+ try {
daemonToolsDrive.SelectedValue = config.DaemonToolsDrive;
- }
- catch
- {
+ } catch {
// someone bodged up the config
}
daemonToolsLocation.Content = config.DaemonToolsLocation;
-
+
RefreshExtenderFormats();
RefreshDisplaySettings();
-
- podcastsPath.Content = config.PodcastHome;
podcastDetails(false);
SaveConfig();
-
}
private void RefreshPodcasts() {
var podcasts = Kernel.Instance.GetItem<Folder>(config.PodcastHome);
- podcasts.ValidateChildren();
-
podcastList.Items.Clear();
- foreach (var item in podcasts.Children) {
- if (item is VodCast) {
- (item as VodCast).ValidateChildren();
- podcastList.Items.Add(item);
+
+ if (podcasts != null) {
+ podcasts.ValidateChildren();
+
+ foreach (var item in podcasts.Children) {
+ if (item is VodCast) {
+ (item as VodCast).ValidateChildren();
+ podcastList.Items.Add(item);
+ }
}
}
}
@@ -751,16 +754,6 @@ private void btnWeatherID_Click(object sender, RoutedEventArgs e)
SaveConfig();
}
- private void ChangePodcastPathClick(object sender, RoutedEventArgs e) {
- BrowseForFolderDialog dlg = new BrowseForFolderDialog();
-
- if (true == dlg.ShowDialog(this)) {
- config.PodcastHome = dlg.SelectedFolder;
- podcastsPath.Content = dlg.SelectedFolder;
- SaveConfig();
- }
- }
-
private void addPodcast_Click(object sender, RoutedEventArgs e) {
var form = new AddPodcastForm();
form.Owner = this;

0 comments on commit d2c16ff

Please sign in to comment.