Skip to content

Commit

Permalink
Display # of animations (remained count)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongTae Jeong committed Sep 25, 2013
1 parent fa37608 commit f396dbc
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 4 deletions.
20 changes: 20 additions & 0 deletions Client/OfficeController/Generated/WPFAux.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public class Properties
public const string Memo = " Memo";
public const string TagData = " TagData";
public const string IsSelected = " IsSelected";
public const string AnimationRemains = " AnimationRemains";
}

BitmapImage _image;
Expand Down Expand Up @@ -275,6 +276,25 @@ public bool IsSelected
}
}

int _animationRemains;
/// <exclude />
[DataMember]
public int AnimationRemains
{
get { return this._animationRemains; }

set
{
if (this._animationRemains == value)
{
return;
}

this._animationRemains = value;
OnPropertyChanged("AnimationRemains");
}
}


public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
Expand Down
1 change: 1 addition & 0 deletions Client/OfficeController/Generated/WPFAux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<property name="Memo" type="string" />
<property name="TagData" type="SlideItemData" />
<property name="IsSelected" type="bool" />
<property name="AnimationRemains" type="int" />
</properties>
</type>

Expand Down
33 changes: 33 additions & 0 deletions Client/OfficeController/IntegerZeroHiddenConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;

namespace OfficeController
{
public class IntegerZeroHiddenConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
{
return Visibility.Collapsed;
}

int animationRemains = (int)value;
if (animationRemains <= 0)
{
return Visibility.Collapsed;
}

return Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion Client/OfficeController/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="Office Controller" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Office Controller ver 1.2" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>

<!--ContentPanel - place additional content here-->
Expand Down
1 change: 1 addition & 0 deletions Client/OfficeController/OfficeController.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>WPFAux.tt</DependentUpon>
</Compile>
<Compile Include="IntegerZeroHiddenConverter.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
Expand Down
22 changes: 20 additions & 2 deletions Client/OfficeController/PPTController.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True">

<phone:PhoneApplicationPage.Resources>
<local:IntegerZeroHiddenConverter x:Key="converter" />
</phone:PhoneApplicationPage.Resources>

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -46,8 +50,8 @@
<controls:Panorama.HeaderTemplate>
<DataTemplate></DataTemplate>
</controls:Panorama.HeaderTemplate>
<controls:Panorama.ItemTemplate>

<controls:Panorama.ItemTemplate>
<DataTemplate>
<Grid Margin="0">
<Grid.RowDefinitions>
Expand All @@ -57,6 +61,20 @@

<Image Source="{Binding Path=Image}"></Image>
<TextBox IsReadOnly="True" Text="{Binding Path=Memo}" Grid.Row="1" />

<Border VerticalAlignment="Top"
HorizontalAlignment="Left"
Width="40" Height="40"
Background="Black"
CornerRadius="20"
Visibility="{Binding Path=AnimationRemains, Converter={StaticResource converter}}"
BorderBrush="Blue" BorderThickness="4">
<TextBlock
TextAlignment="Center"
FontWeight="Bold"
Foreground="Yellow"
Text="{Binding Path=AnimationRemains}" />
</Border>
</Grid>
</DataTemplate>
</controls:Panorama.ItemTemplate>
Expand Down
10 changes: 9 additions & 1 deletion Client/OfficeController/PPTController.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void LoadDocument()
SlidePage page = new SlidePage();
page.Image = bitmapImage;
page.Memo = item.Note;
page.AnimationRemains = item.AnimationCount;

SlideItemData tagData = new SlideItemData();
tagData.AnimationCount = item.AnimationCount;
Expand Down Expand Up @@ -111,7 +112,10 @@ void panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
return;
}

SlideItemData tagData = (e.AddedItems[0] as SlidePage).TagData;
SlidePage slidePage = (e.AddedItems[0] as SlidePage);
SlideItemData tagData = slidePage.TagData;

slidePage.AnimationRemains = tagData.AnimationCount;

int slideIndex = tagData.SlideIndex;
SetSlide(slideIndex, tagData.AnimationCount);
Expand Down Expand Up @@ -194,6 +198,10 @@ void SetNextAnimation()
}

_animationLock = true;

SlidePage currentPage = (panorama.SelectedItem as SlidePage);
currentPage.AnimationRemains--;

System.Diagnostics.Debug.WriteLine("AniStart: " + _animationLock);

string url = string.Format("http://{0}:{1}/nextAnimation", _ipAddress, _port);
Expand Down

0 comments on commit f396dbc

Please sign in to comment.