Permalink
Browse files

Add functionality for renaming subscriptions in the UI

  • Loading branch information...
1 parent 3633193 commit 8e2daf6efa54b04c5c6beb5c67ee970083760f98 @igstan committed Oct 25, 2010
Showing with 97 additions and 0 deletions.
  1. +1 −0 Nemira/MainWindow.xaml
  2. +14 −0 Nemira/MainWindow.xaml.cs
  3. +7 −0 Nemira/Nemira.csproj
  4. +41 −0 Nemira/RenameSubscription.xaml
  5. +34 −0 Nemira/RenameSubscription.xaml.cs
View
@@ -99,6 +99,7 @@
Padding="5,5,5,5"
Name="editSubscription"
ToolTip="Rename Subscription"
+ Click="OnRenameSubscription"
Style="{DynamicResource RenameSubscriptionButton}"/>
<Separator/>
<Button IsEnabled="False"
View
@@ -157,6 +157,20 @@ private void OnDeleteSubscription(object sender, RoutedEventArgs e)
}
}
+ private void OnRenameSubscription(object sender, RoutedEventArgs e)
+ {
+ var subscription = subscriptions.SelectedItem as Subscription;
+ var renameDialog = new RenameSubscription();
+ renameDialog.Owner = this;
+ renameDialog.SubscriptionName = subscription.Title;
+
+ if (renameDialog.ShowDialog() == true)
+ {
+ readerAccount.RenameSubscription(subscription, renameDialog.SubscriptionName);
+ LoadSubscriptions();
+ }
+ }
+
private void LoadSubscriptions()
{
subscriptions.ItemsSource = new Subscriptions(readerAccount);
View
@@ -103,6 +103,9 @@
<Compile Include="LoginWindow.xaml.cs">
<DependentUpon>LoginWindow.xaml</DependentUpon>
</Compile>
+ <Compile Include="RenameSubscription.xaml.cs">
+ <DependentUpon>RenameSubscription.xaml</DependentUpon>
+ </Compile>
<Compile Include="StubHttpClient.cs" />
<Page Include="Buttons.xaml">
<SubType>Designer</SubType>
@@ -128,6 +131,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="RenameSubscription.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -0,0 +1,41 @@
+<Window x:Class="Nemira.RenameSubscription"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="Rename Subscription"
+ SizeToContent="WidthAndHeight"
+ ResizeMode="NoResize"
+ ShowInTaskbar="False"
+ WindowStartupLocation="CenterOwner"
+ TextOptions.TextFormattingMode="Display"
+ FocusManager.FocusedElement="{Binding ElementName=name}"
+ Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
+ <Grid Margin="5">
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="28"/>
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="70"/>
+ <ColumnDefinition Width="300"/>
+ </Grid.ColumnDefinitions>
+
+ <Label Grid.Row="0"
+ Grid.Column="0"
+ HorizontalContentAlignment="Right"
+ Content="Name:"/>
+ <TextBox Grid.Row="0"
+ Grid.Column="1"
+ Name="name"/>
+
+ <StackPanel Grid.Row="1"
+ Grid.ColumnSpan="2"
+ Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ Margin="0,5,0,0">
+ <Button Click="OnSubmit" Content="Add" Padding="10,2,10,2"/>
+ <Button IsCancel="True" Content="Cancel" Margin="5,0,0,0" Padding="10,2,10,2"/>
+ </StackPanel>
+
+ </Grid>
+</Window>
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Nemira
+{
+ public partial class RenameSubscription : Window
+ {
+ public RenameSubscription()
+ {
+ InitializeComponent();
+ }
+
+ private void OnSubmit(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ }
+
+ public string SubscriptionName
+ {
+ get { return name.Text; }
+ set { name.Text = value; }
+ }
+ }
+}

0 comments on commit 8e2daf6

Please sign in to comment.