commit f49d45332936bb09dd75a9a16bf1a8d7fc6160fb Author: Bharatvaj Hemanth <bharatvaj@yahoo.com> Date: Thu, 3 Apr 2025 01:03:15 +0530 File360 (AMI) Initial Source Commit Diffstat:
133 files changed, 5930 insertions(+), 0 deletions(-)
diff --git a/File360.sln b/File360.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "File360", "File360\File360.csproj", "{12DBCDD7-C235-40E7-B8FD-71E8074350BD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|Any CPU.ActiveCfg = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|Any CPU.Build.0 = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|Any CPU.Deploy.0 = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|ARM.ActiveCfg = Debug|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|ARM.Build.0 = Debug|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|ARM.Deploy.0 = Debug|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|x86.ActiveCfg = Debug|x86 + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|x86.Build.0 = Debug|x86 + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Debug|x86.Deploy.0 = Debug|x86 + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|Any CPU.Build.0 = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|Any CPU.Deploy.0 = Release|Any CPU + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|ARM.ActiveCfg = Release|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|ARM.Build.0 = Release|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|ARM.Deploy.0 = Release|ARM + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|x86.ActiveCfg = Release|x86 + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|x86.Build.0 = Release|x86 + {12DBCDD7-C235-40E7-B8FD-71E8074350BD}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/File360/AMI.png b/File360/AMI.png Binary files differ. diff --git a/File360/AlphaKeyGroup.cs b/File360/AlphaKeyGroup.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; +using System.Globalization; +using Microsoft.Phone.Globalization; + +namespace File360 +{ + public class AlphaKeyGroup<T> : List<T> + { + /// <summary> + /// The delegate that is used to get the key information. + /// </summary> + /// <param name="item">An object of type T</param> + /// <returns>The key value to use for this object</returns> + public delegate string GetKeyDelegate(T item); + + /// <summary> + /// The Key of this group. + /// </summary> + public string Key { get; private set; } + + /// <summary> + /// Public constructor. + /// </summary> + /// <param name="key">The key for this group.</param> + public AlphaKeyGroup(string key) + { + Key = key; + } + + /// <summary> + /// Create a list of AlphaGroup<T> with keys set by a SortedLocaleGrouping. + /// </summary> + /// <param name="slg">The </param> + /// <returns>Theitems source for a LongListSelector</returns> + private static List<AlphaKeyGroup<T>> CreateGroups(SortedLocaleGrouping slg) + { + List<AlphaKeyGroup<T>> list = new List<AlphaKeyGroup<T>>(); + + foreach (string key in slg.GroupDisplayNames) + { + list.Add(new AlphaKeyGroup<T>(key)); + } + + return list; + } + + /// <summary> + /// Create a list of AlphaGroup<T> with keys set by a SortedLocaleGrouping. + /// </summary> + /// <param name="items">The items to place in the groups.</param> + /// <param name="ci">The CultureInfo to group and sort by.</param> + /// <param name="getKey">A delegate to get the key from an item.</param> + /// <param name="sort">Will sort the data if true.</param> + /// <returns>An items source for a LongListSelector</returns> + public static List<AlphaKeyGroup<T>> CreateGroups(IEnumerable<T> items, CultureInfo ci, GetKeyDelegate getKey, bool sort) + { + SortedLocaleGrouping slg = new SortedLocaleGrouping(ci); + List<AlphaKeyGroup<T>> list = CreateGroups(slg); + + foreach (T item in items) + { + int index = 0; + if (slg.SupportsPhonetics) + { + //check if your database has yomi string for item + //if it does not, then do you want to generate Yomi or ask the user for this item. + //index = slg.GetGroupIndex(getKey(Yomiof(item))); + } + else + { + index = slg.GetGroupIndex(getKey(item)); + } + if (index >= 0 && index < list.Count) + { + list[index].Add(item); + } + } + + if (sort) + { + foreach (AlphaKeyGroup<T> group in list) + { + group.Sort((c0, c1) => { return ci.CompareInfo.Compare(getKey(c0), getKey(c1)); }); + } + } + + return list; + } + + } +} diff --git a/File360/App.xaml b/File360/App.xaml @@ -0,0 +1,698 @@ +<Application + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" + xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" + mc:Ignorable="d" + x:Class="File360.App" + > + + <!--Application Resources--> + <Application.Resources> + <local:LocalizedStrings xmlns:local="clr-namespace:File360" x:Key="LocalizedStrings"/> + + <Style x:Key="SideMenuInitiater" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates" ec:ExtendedVisualStateManager.UseFluidLayout="True"> + <VisualStateGroup.Transitions> + <VisualTransition/> + </VisualStateGroup.Transitions> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle1"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle2"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Thickness>12</Thickness> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle1"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle2"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <VisualStateManager.CustomVisualStateManager> + <ec:ExtendedVisualStateManager/> + </VisualStateManager.CustomVisualStateManager> + <Rectangle x:Name="rectangle2" Fill="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Left" Height="3" Margin="15,16,0,0" VerticalAlignment="Top" Width="33"/> + <Rectangle x:Name="rectangle1" Fill="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Left" Height="3" Margin="15,22,0,0" VerticalAlignment="Top" Width="33"/> + <Rectangle x:Name="rectangle" Fill="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Left" Height="3" Margin="15,28,0,0" VerticalAlignment="Top" Width="33"/> + <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="CurvedTextBox" TargetType="TextBox"> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/> + <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/> + <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/> + <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="Padding" Value="2"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="TextBox"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <SolidColorBrush Color="White"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Foreground)" Storyboard.TargetName="ContentElement"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <SolidColorBrush Color="Black"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"/> + <VisualState x:Name="ReadOnly"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MainBorder"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ReadonlyBorder"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ReadonlyBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ReadonlyBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <SolidColorBrush Color="White"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Foreground)" Storyboard.TargetName="ContentElement"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <SolidColorBrush Color="Black"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Rectangle x:Name="rectangle" Fill="{StaticResource PhoneDisabledBrush}" HorizontalAlignment="Left" Height="56" Stroke="{StaticResource PhoneInactiveBrush}" VerticalAlignment="Top" Width="216" RadiusY="29" RadiusX="29" Margin="0,10,0,0"/> + <Border x:Name="MainBorder" BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource PhoneTouchTargetOverhang}"/> + <Border x:Name="ReadonlyBorder" BorderBrush="{StaticResource PhoneDisabledBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed"/> + <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch" Foreground="{StaticResource PhoneBackgroundBrush}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="SearchButton" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <SolidColorBrush Color="White"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="10" Background="{StaticResource PhoneAccentBrush}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="MainBarButton" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="ellipse"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneChromeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <ImageBrush ImageSource="greyhome.png" Stretch="Uniform"/> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="ellipse"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneChromeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="rectangle"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Ellipse x:Name="ellipse" HorizontalAlignment="Left" Height="39" Margin="17,16,0,0" VerticalAlignment="Top" Width="40" Fill="{StaticResource PhoneAccentBrush}"/> + <Rectangle x:Name="rectangle" HorizontalAlignment="Left" Height="21" VerticalAlignment="Top" Width="16" Margin="29,25,0,0" Fill="{StaticResource PhoneChromeBrush}"/> + <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="SliderStyle" TargetType="Slider"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="BorderBrush" Value="Transparent"/> + <Setter Property="Maximum" Value="10"/> + <Setter Property="Minimum" Value="0"/> + <Setter Property="Value" Value="0"/> + <Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="HorizontalTemplate" Margin="{StaticResource PhoneHorizontalMargin}"> + <Rectangle HorizontalAlignment="Left" Height="24" Margin="0,16,0,0" VerticalAlignment="Top" Width="282" RadiusY="12" RadiusX="12" RenderTransformOrigin="0.5,0.542" Opacity="0.25" Fill="Black"/> + <Rectangle x:Name="HorizontalTrack" Fill="{TemplateBinding Background}" Height="12" IsHitTestVisible="False" Margin="0,22,0,50"/> + <Rectangle x:Name="HorizontalFill" Fill="{TemplateBinding Foreground}" Height="12" IsHitTestVisible="False" Margin="0,22,0,50"> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 6, 12"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="HorizontalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Left" Height="24" Margin="0,16,0,44" Width="12"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + <Grid x:Name="VerticalTemplate" Margin="{StaticResource PhoneVerticalMargin}"> + <Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"/> + <Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 12, 6"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="VerticalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" Height="12" Margin="12,0,12,0" VerticalAlignment="Top" Width="24"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="Play" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}" Background="{StaticResource PhoneChromeBrush}"> + <Border.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/play.png"/> + </Border.OpacityMask> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="Forward" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ColorAnimation Duration="0" To="{StaticResource PhoneAccentColor}" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBackground" d:IsOptimized="True"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <Border.Background> + <SolidColorBrush Color="{StaticResource PhoneChromeColor}"/> + </Border.Background> + <Border.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="Resources/Assets/Images/next.png"/> + </Border.OpacityMask> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{StaticResource PhoneAccentBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="Previous" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"> + <Storyboard> + <ColorAnimation Duration="0" To="#FF1F1F1F" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBackground" d:IsOptimized="True"/> + </Storyboard> + </VisualState> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ColorAnimation Duration="0" To="{StaticResource PhoneAccentColor}" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBackground" d:IsOptimized="True"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <Border.Background> + <SolidColorBrush Color="{StaticResource PhoneChromeColor}"/> + </Border.Background> + <Border.OpacityMask> + <ImageBrush ImageSource="Resources/Assets/Images/previous.png" Stretch="Uniform"/> + </Border.OpacityMask> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{StaticResource PhoneTextBoxBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ButtonTemplate" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Foreground="{StaticResource PhoneInverseBackgroundBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="PlainButtonTemplate" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent" Margin="0,1,0,19"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Foreground)" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="3,3,0,0"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ButtonPlay" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ColorAnimation Duration="0" To="{StaticResource PhoneAccentColor}" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBackground" d:IsOptimized="True"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <Border.Background> + <SolidColorBrush Color="#FF1F1F1F"/> + </Border.Background> + <Border.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="Resources/Assets/Images/play.png"/> + </Border.OpacityMask> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="MusicCD" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke)" Storyboard.TargetName="arc"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="arc1"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke)" Storyboard.TargetName="arc"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill)" Storyboard.TargetName="arc1"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInverseBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + <es:Arc x:Name="arc" ArcThickness="35" ArcThicknessUnit="Pixel" EndAngle="360" HorizontalAlignment="Left" Height="100" Stretch="None" StartAngle="0" UseLayoutRounding="False" VerticalAlignment="Top" Width="100" Fill="{StaticResource PhoneChromeBrush}"/> + <es:Arc x:Name="arc1" ArcThickness="7" ArcThicknessUnit="Pixel" EndAngle="360" Fill="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Left" Height="35.53" Margin="33.665,31.999,0,0" Stretch="None" StartAngle="0" UseLayoutRounding="False" VerticalAlignment="Top" Width="32.77" Stroke="{StaticResource PhoneDisabledBrush}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </Application.Resources> + + <Application.ApplicationLifetimeObjects> + <!--Required object that handles lifetime events for the application--> + <shell:PhoneApplicationService + Launching="Application_Launching" Closing="Application_Closing" + Activated="Application_Activated" Deactivated="Application_Deactivated"/> + </Application.ApplicationLifetimeObjects> + +</Application> diff --git a/File360/App.xaml.cs b/File360/App.xaml.cs @@ -0,0 +1,231 @@ +using System; +using System.Diagnostics; +using System.Resources; +using System.Windows; +using System.Windows.Markup; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using File360.Resources; + +namespace File360 +{ + public partial class App : Application + { + + /// <summary> + /// Provides easy access to the root frame of the Phone Application. + /// </summary> + /// <returns>The root frame of the Phone Application.</returns> + public static PhoneApplicationFrame RootFrame { get; private set; } + + /// <summary> + /// Constructor for the Application object. + /// </summary> + public App() + { + // Global handler for uncaught exceptions. + UnhandledException += Application_UnhandledException; + + // Standard XAML initialization + InitializeComponent(); + + // Phone-specific initialization + InitializePhoneApplication(); + + // Language display initialization + InitializeLanguage(); + + // Show graphics profiling information while debugging. + if (Debugger.IsAttached) + { + // Display the current frame rate counters + Application.Current.Host.Settings.EnableFrameRateCounter = true; + + // Show the areas of the app that are being redrawn in each frame. + //Application.Current.Host.Settings.EnableRedrawRegions = true; + + // Enable non-production analysis visualization mode, + // which shows areas of a page that are handed off to GPU with a colored overlay. + //Application.Current.Host.Settings.EnableCacheVisualization = true; + + // Prevent the screen from turning off while under the debugger by disabling + // the application's idle detection. + // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run + // and consume battery power when the user is not using the phone. + PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; + } + } + + // Code to execute when the application is launching (eg, from Start) + // This code will not execute when the application is reactivated + private void Application_Launching(object sender, LaunchingEventArgs e) + { + } + + // Code to execute when the application is activated (brought to foreground) + // This code will not execute when the application is first launched + private void Application_Activated(object sender, ActivatedEventArgs e) + { + // Ensure that application state is restored appropriately + + } + + // Code to execute when the application is deactivated (sent to background) + // This code will not execute when the application is closing + private void Application_Deactivated(object sender, DeactivatedEventArgs e) + { + } + + // Code to execute when the application is closing (eg, user hit Back) + // This code will not execute when the application is deactivated + private void Application_Closing(object sender, ClosingEventArgs e) + { + // Ensure that required application state is persisted here. + } + + // Code to execute if a navigation fails + private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) + { + if (Debugger.IsAttached) + { + MessageBox.Show((e.Uri).ToString()); + MessageBox.Show(e.Exception.ToString()); + // A navigation has failed; break into the debugger + Debugger.Break(); + } + + } + + // Code to execute on Unhandled Exceptions + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + if (Debugger.IsAttached) + { + // An unhandled exception has occurred; break into the debugger + //Debugger.Break(); + } + } + + #region Phone application initialization + + // Avoid double-initialization + private bool phoneApplicationInitialized = false; + + // Do not add any additional code to this method + private void InitializePhoneApplication() + { + if (phoneApplicationInitialized) + return; + + // Create the frame but don't set it as RootVisual yet; this allows the splash + // screen to remain active until the application is ready to render. + RootFrame = new PhoneApplicationFrame(); + RootFrame.Navigated += CompleteInitializePhoneApplication; + + RootFrame.UriMapper = new UriMapper(); + + // Handle navigation failures + RootFrame.NavigationFailed += RootFrame_NavigationFailed; + + // Handle reset requests for clearing the backstack + RootFrame.Navigated += CheckForResetNavigation; + + // Ensure we don't initialize again + phoneApplicationInitialized = true; + } + + // Do not add any additional code to this method + private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) + { + // Set the root visual to allow the application to render + if (RootVisual != RootFrame) + RootVisual = RootFrame; + + // Remove this handler since it is no longer needed + RootFrame.Navigated -= CompleteInitializePhoneApplication; + } + + private void CheckForResetNavigation(object sender, NavigationEventArgs e) + { + // If the app has received a 'reset' navigation, then we need to check + // on the next navigation to see if the page stack should be reset + if (e.NavigationMode == NavigationMode.Reset) + RootFrame.Navigated += ClearBackStackAfterReset; + } + + private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) + { + // Unregister the event so it doesn't get called again + RootFrame.Navigated -= ClearBackStackAfterReset; + + // Only clear the stack for 'new' (forward) and 'refresh' navigations + if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) + return; + + // For UI consistency, clear the entire page stack + while (RootFrame.RemoveBackEntry() != null) + { + ; // do nothing + } + } + + #endregion + + // Initialize the app's font and flow direction as defined in its localized resource strings. + // + // To ensure that the font of your application is aligned with its supported languages and that the + // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage + // and ResourceFlowDirection should be initialized in each resx file to match these values with that + // file's culture. For example: + // + // AppResources.es-ES.resx + // ResourceLanguage's value should be "es-ES" + // ResourceFlowDirection's value should be "LeftToRight" + // + // AppResources.ar-SA.resx + // ResourceLanguage's value should be "ar-SA" + // ResourceFlowDirection's value should be "RightToLeft" + // + // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072. + // + private void InitializeLanguage() + { + try + { + // Set the font to match the display language defined by the + // ResourceLanguage resource string for each supported language. + // + // Fall back to the font of the neutral language if the Display + // language of the phone is not supported. + // + // If a compiler error is hit then ResourceLanguage is missing from + // the resource file. + RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); + + // Set the FlowDirection of all elements under the root frame based + // on the ResourceFlowDirection resource string for each + // supported language. + // + // If a compiler error is hit then ResourceFlowDirection is missing from + // the resource file. + FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection); + RootFrame.FlowDirection = flow; + } + catch + { + // If an exception is caught here it is most likely due to either + // ResourceLangauge not being correctly set to a supported language + // code or ResourceFlowDirection is set to a value other than LeftToRight + // or RightToLeft. + + if (Debugger.IsAttached) + { + Debugger.Break(); + } + + throw; + } + } + } +} +\ No newline at end of file diff --git a/File360/AppSettings.cs b/File360/AppSettings.cs @@ -0,0 +1,108 @@ +using System; +using System.IO.IsolatedStorage; +using System.Diagnostics; +using System.Collections.Generic; + +namespace File360 +{ + public class AppSettings + { + // Our settings + IsolatedStorageSettings settings; + + //Key Names + const string SideBarColorKeyName = "SideBarColor"; + const string PageColorKeyName = "PageColor"; + + // The default value of our settings + const string SideBarColorDefault = "{StaticResource PhoneChromeBrush}"; + const string PageColorDefault = "{StaticResource PhoneChromeBrush}"; + + public AppSettings() + { + settings = IsolatedStorageSettings.ApplicationSettings; + } + + public bool AddOrUpdateValue(string Key, Object value) + { + bool valueChanged = false; + + // If the key exists + if (settings.Contains(Key)) + { + // If the value has changed + if (settings[Key] != value) + { + // Store the new value + settings[Key] = value; + valueChanged = true; + } + } + // Otherwise create the key. + else + { + settings.Add(Key, value); + valueChanged = true; + } + return valueChanged; + } + + public T GetValueOrDefault<T>(string Key, T defaultValue) + { + T value; + + // If the key exists, retrieve the value. + if (settings.Contains(Key)) + { + value = (T)settings[Key]; + } + // Otherwise, use the default value. + else + { + value = defaultValue; + } + return value; + } + + /// <summary> + /// Save the settings. + /// </summary> + public void Save() + { + settings.Save(); + } + + + /// <summary> + /// Property to get and set a ListBox Setting Key. + /// </summary> + public string SideBarColor + { + get + { + return GetValueOrDefault<string>(SideBarColorKeyName, SideBarColorDefault); + } + set + { + if (AddOrUpdateValue(SideBarColorKeyName, value)) + { + Save(); + } + } + } + public string PageColor + { + get + { + return GetValueOrDefault<string>(PageColorKeyName, PageColorDefault); + } + set + { + if (AddOrUpdateValue(PageColorKeyName, value)) + { + Save(); + } + } + } + } +} +\ No newline at end of file diff --git a/File360/Assets/ApplicationIcon.png b/File360/Assets/ApplicationIcon.png Binary files differ. diff --git a/File360/BoolToColorConverter.cs b/File360/BoolToColorConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace File360 +{ + public class BoolToColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + + return (value is bool && (bool)value) ? Application.Current.Resources["PhoneAccentBrush"] : Application.Current.Resources["PhoneSubtleBrush"]; + } + + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/File360/EBookReader.xaml b/File360/EBookReader.xaml @@ -0,0 +1,16 @@ +<phone:PhoneApplicationPage + x:Class="File360.EbookReader" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + FontFamily="{StaticResource PhoneFontFamilyNormal}" + FontSize="{StaticResource PhoneFontSizeNormal}" + Foreground="{StaticResource PhoneForegroundBrush}" + SupportedOrientations="Portrait" Orientation="Portrait" + mc:Ignorable="d" + shell:SystemTray.IsVisible="True"> + +</phone:PhoneApplicationPage> +\ No newline at end of file diff --git a/File360/EBookReader.xaml.cs b/File360/EBookReader.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; + +namespace File360 +{ + public partial class EbookReader : PhoneApplicationPage + { + public EbookReader() + { + InitializeComponent(); + } + } +} +\ No newline at end of file diff --git a/File360/FILE360.png b/File360/FILE360.png Binary files differ. diff --git a/File360/FTPServerPage.xaml b/File360/FTPServerPage.xaml @@ -0,0 +1,47 @@ +<phone:PhoneApplicationPage + x:Class="File360.FTPServerPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + FontFamily="{StaticResource PhoneFontFamilyNormal}" + FontSize="{StaticResource PhoneFontSizeNormal}" + Foreground="{StaticResource PhoneForegroundBrush}" + SupportedOrientations="Portrait" Orientation="Portrait" + mc:Ignorable="d" + shell:SystemTray.IsVisible="True"> + + <!--LayoutRoot is the root grid where all page content is placed--> + <Grid x:Name="LayoutRoot" Background="Transparent"> + + <!--TitlePanel contains the name of the application and page title--> + <StackPanel Grid.Row="0" Margin="12,17,0,643"> + <TextBlock Text="FILE360" Style="{StaticResource PhoneTextNormalStyle}"/> + <TextBlock Text="ftp server" Margin="9,-7,0,0" FontSize="48" FontFamily="Segoe WP Light"/> + </StackPanel> + + <!--ContentPanel - place additional content here--> + <Grid x:Name="ContentPanel" Margin="10,0,14,0"> + <toolkit:PhoneTextBox Hint="FTP Server Address" x:Name="txtIp" toolkit:TiltEffect.IsTiltEnabled="True" Margin="0,129,178,560"/> + <toolkit:PhoneTextBox Hint="Port" x:Name="txtPortNumber" toolkit:TiltEffect.IsTiltEnabled="True" Text="21" Margin="278,129,83,560" /> + <Button Content="" HorizontalAlignment="Left" Margin="373,129,0,0" VerticalAlignment="Top" BorderBrush="{x:Null}" Width="83" Height="79" Background="{StaticResource PhoneForegroundBrush}" Click="Connect_Click"> + <Button.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/go.png"/> + </Button.OpacityMask> + </Button> + <TextBlock x:Name="WarningP" HorizontalAlignment="Left" Height="32" Margin="10,208,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="436" FontSize="22" FontFamily="Segoe WP Semibold" Foreground="#FFE43D3D"/> + <toolkit:PhoneTextBox Hint="Command" x:Name="txtCmd" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="363" Margin="0,232,0,0"/> + <phone:LongListSelector x:Name="lstLogs" HorizontalAlignment="Left" Height="449" VerticalAlignment="Top" Width="436" Margin="10,309,0,0" Background="{x:Null}"/> + <Button Click="Command_Click" HorizontalAlignment="Left" Margin="363,240,0,0" VerticalAlignment="Top" Width="83" Height="64" BorderBrush="{x:Null}" Background="{StaticResource PhoneForegroundBrush}"> + <Button.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/go.png"/> + </Button.OpacityMask> + </Button> + <TextBlock x:Name="sds" HorizontalAlignment="Left" Height="114" Margin="217,10,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="229" Foreground="White"/> + </Grid> + </Grid> + +</phone:PhoneApplicationPage> +\ No newline at end of file diff --git a/File360/FTPServerPage.xaml.cs b/File360/FTPServerPage.xaml.cs @@ -0,0 +1,186 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.IO; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using Windows.Storage; +using Windows.System; +using System.IO.IsolatedStorage; +using WinPhoneFtp.FtpService; +using System.Threading.Tasks; +using Windows.Networking.Sockets; +using Windows.UI.Core; + +namespace File360 +{ + public partial class FTPServerPage : PhoneApplicationPage + { + public FTPServerPage() + { + InitializeComponent(); + } + + FtpClient ftpClient = null; + Logger logger = null; + + + async private void Connect_Click(object sender, RoutedEventArgs e) + { + logger = Logger.GetDefault(this.Dispatcher); + lstLogs.ItemsSource = logger.Logs; + ftpClient = new FtpClient(txtIp.Text, this.Dispatcher); + //ftpClient = new PqaFtpClient(txtIp.Text); + ftpClient.FtpConnected += ftpClient_FtpConnected; + ftpClient.FtpDisconnected += ftpClient_FtpDisconnected; + ftpClient.FtpAuthenticationSucceeded += ftpClient_FtpAuthenticationSucceeded; + ftpClient.FtpAuthenticationFailed += ftpClient_FtpAuthenticationFailed; + ftpClient.FtpDirectoryChangedFailed += ftpClient_FtpDirectoryChangedFailed; + ftpClient.FtpDirectoryChangedSucceded += ftpClient_FtpDirectoryChangedSucceded; + ftpClient.FtpPresentWorkingDirectoryReceived += ftpClient_FtpPresentWorkingDirectoryReceived; + ftpClient.FtpFileUploadSucceeded += ftpClient_FtpFileUploadSucceeded; + ftpClient.FtpFileDownloadSucceeded += ftpClient_FtpFileDownloadSucceeded; + ftpClient.FtpFileUploadFailed += ftpClient_FtpFileUploadFailed; + ftpClient.FtpFileDownloadFailed += ftpClient_FtpFileDownloadFailed; + ftpClient.FtpDirectoryListed += ftpClient_FtpDirectoryListed; + ftpClient.FtpFileTransferProgressed += ftpClient_FtpFileTransferProgressed; + await ftpClient.ConnectAsync(); + } + + void ftpClient_FtpDisconnected(object sender, FtpDisconnectedEventArgs e) + { + logger.AddLog(String.Format("FTP Disconnected. Reason: {0}", e.DisconnectReason)); + } + + void ftpClient_FtpFileTransferProgressed(object sender, FtpFileTransferProgressedEventArgs e) + { + logger.AddLog(String.Format("File {0}, Data Transferred: {1}", e.IsUpload ? "Upload" : "Download", e.BytesTransferred)); + } + + void ftpClient_FtpDirectoryListed(object sender, FtpDirectoryListedEventArgs e) + { + logger.AddLog("Directory Listing"); + + foreach (String filename in e.GetFilenames()) + { + logger.AddLog("file: " + filename); + } + + foreach (String dir in e.GetDirectories()) + { + logger.AddLog("directory: " + dir); + } + } + + async private void Command_Click(object sender, RoutedEventArgs e) + { + if (txtCmd.Text.StartsWith("STOR")) + { + logger.Logs.Clear(); + String Filename = txtCmd.Text.Split(new char[] { ' ', '/' }, StringSplitOptions.RemoveEmptyEntries).Last(); + StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync(txtCmd.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[1]); + await ftpClient.UploadFileAsync(await file.OpenStreamForReadAsync(), "123.wmv"); + return; + } + + if (txtCmd.Text.StartsWith("RETR")) + { + logger.Logs.Clear(); + String Filename = txtCmd.Text.Split(new char[] { ' ', '/' }, StringSplitOptions.RemoveEmptyEntries).Last(); + StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync(txtCmd.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[1], CreationCollisionOption.OpenIfExists); + await ftpClient.DownloadFileAsync(await file.OpenStreamForWriteAsync(), Filename); + return; + } + + if (txtCmd.Text.Equals("PWD")) + { + logger.Logs.Clear(); + await ftpClient.GetPresentWorkingDirectoryAsync(); + return; + } + + if (txtCmd.Text.Equals("LIST")) + { + logger.Logs.Clear(); + await ftpClient.GetDirectoryListingAsync(); + return; + } + + if (txtCmd.Text.StartsWith("CWD")) + { + logger.Logs.Clear(); + await ftpClient.ChangeWorkingDirectoryAsync(txtCmd.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[1]); + return; + } + + if (txtCmd.Text.Equals("QUIT")) + { + logger.Logs.Clear(); + await ftpClient.DisconnectAsync(); + return; + } + } + + void ftpClient_FtpFileDownloadFailed(object sender, FtpFileTransferFailedEventArgs e) + { + //e.LocalFileStream.Close(); + //e.LocalFileStream.Dispose(); + logger.AddLog("download failed"); + } + + void ftpClient_FtpFileUploadFailed(object sender, FtpFileTransferFailedEventArgs e) + { + //e.LocalFileStream.Close(); + //e.LocalFileStream.Dispose(); + logger.AddLog("upload failed"); + } + + void ftpClient_FtpFileDownloadSucceeded(object sender, FtpFileTransferEventArgs e) + { + //e.LocalFileStream.Close(); + //e.LocalFileStream.Dispose(); + logger.AddLog("download done"); + } + + void ftpClient_FtpFileUploadSucceeded(object sender, FtpFileTransferEventArgs e) + { + //e.LocalFileStream.Close(); + //e.LocalFileStream.Dispose(); + logger.AddLog("upload done"); + } + + async void ftpClient_FtpConnected(object sender, EventArgs e) + { + await (sender as FtpClient).AuthenticateAsync("admin","admin"); + } + + void ftpClient_FtpPresentWorkingDirectoryReceived(object sender, FtpPresentWorkingDirectoryEventArgs e) + { + logger.AddLog(String.Format("Present working directory is: {0}", e.PresentWorkingDirectory)); + } + + void ftpClient_FtpDirectoryChangedSucceded(object sender, FtpDirectoryChangedEventArgs e) + { + logger.AddLog(String.Format("Directory {0} change succeeded", e.RemoteDirectory)); + } + + void ftpClient_FtpDirectoryChangedFailed(object sender, FtpDirectoryChangedEventArgs e) + { + logger.AddLog("Directory change failed"); + } + + void ftpClient_FtpAuthenticationFailed(object sender, EventArgs e) + { + logger.AddLog("Authentication failed"); + } + + void ftpClient_FtpAuthenticationSucceeded(object sender, EventArgs e) + { + logger.AddLog("Authentication succeeded"); + } + } +} +\ No newline at end of file diff --git a/File360/File360.Logo.Large.png b/File360/File360.Logo.Large.png Binary files differ. diff --git a/File360/File360.Logo.Medium.png b/File360/File360.Logo.Medium.png Binary files differ. diff --git a/File360/File360.Logo.Small.png b/File360/File360.Logo.Small.png Binary files differ. diff --git a/File360/File360.Logo.png b/File360/File360.Logo.png Binary files differ. diff --git a/File360/File360.csproj b/File360/File360.csproj @@ -0,0 +1,371 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>10.0.20506</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{12DBCDD7-C235-40E7-B8FD-71E8074350BD}</ProjectGuid> + <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>File360</RootNamespace> + <AssemblyName>File360</AssemblyName> + <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier> + <TargetFrameworkVersion>v8.0</TargetFrameworkVersion> + <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> + <SilverlightApplication>true</SilverlightApplication> + <SupportedCultures> + </SupportedCultures> + <XapOutputs>true</XapOutputs> + <GenerateSilverlightManifest>true</GenerateSilverlightManifest> + <XapFilename>File360_$(Configuration)_$(Platform).xap</XapFilename> + <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> + <SilverlightAppEntry>File360.App</SilverlightAppEntry> + <ValidateXaml>true</ValidateXaml> + <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> + <ThrowErrorsInValidation>true</ThrowErrorsInValidation> + <ExpressionBlendVersion>12.0.50716.0</ExpressionBlendVersion> + <TargetFrameworkProfile /> + <DefaultLanguage>en-US</DefaultLanguage> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>Bin\Debug</OutputPath> + <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>Bin\Release</OutputPath> + <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>Bin\x86\Debug</OutputPath> + <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>Bin\x86\Release</OutputPath> + <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>Bin\ARM\Debug</OutputPath> + <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>Bin\ARM\Release</OutputPath> + <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget /> + </PropertyGroup> + <ItemGroup> + <Compile Include="AboutPage.xaml.cs"> + <DependentUpon>AboutPage.xaml</DependentUpon> + </Compile> + <Compile Include="AlphaKeyGroup.cs" /> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="AppSettings.cs" /> + <Compile Include="BoolToColorConverter.cs" /> + <Compile Include="musiclist.cs" /> + <Compile Include="PersonalizationPage.xaml.cs"> + <DependentUpon>PersonalizationPage.xaml</DependentUpon> + </Compile> + <Compile Include="picturelist.cs" /> + <Compile Include="SkydrivePage.xaml.cs"> + <DependentUpon>SkydrivePage.xaml</DependentUpon> + </Compile> + <Compile Include="EBookReader.xaml.cs"> + <DependentUpon>EBookReader.xaml</DependentUpon> + </Compile> + <Compile Include="FTPServerPage.xaml.cs"> + <DependentUpon>FTPServerPage.xaml</DependentUpon> + </Compile> + <Compile Include="LinqToVisualTree.cs" /> + <Compile Include="LocalizedStrings.cs" /> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="picturelist.cs" /> + <Compile Include="MetroInMotion.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Resources\AppResources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>AppResources.resx</DependentUpon> + </Compile> + <Compile Include="sdlist.cs" /> + <Compile Include="SecurityPage.xaml.cs"> + <DependentUpon>SecurityPage.xaml</DependentUpon> + </Compile> + <Compile Include="settinglist.cs" /> + <Compile Include="SettingsPage.xaml.cs"> + <DependentUpon>SettingsPage.xaml</DependentUpon> + </Compile> + <Compile Include="TiltEffect.cs" /> + <Compile Include="UriMapper.cs" /> + <Compile Include="URISchemeExtensionsLandingPage.xaml.cs"> + <DependentUpon>URISchemeExtensionsLandingPage.xaml</DependentUpon> + </Compile> + <Compile Include="vaultlist.cs" /> + <Compile Include="VaultPage.xaml.cs"> + <DependentUpon>VaultPage.xaml</DependentUpon> + </Compile> + <Compile Include="VideoPlayer.xaml.cs"> + <DependentUpon>VideoPlayer.xaml</DependentUpon> + </Compile> + <Compile Include="WinPhoneFtp.FtpService\DataReceivedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\ErrorOccuredEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpClient.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpCommand.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpDirectoryChangedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpDirectoryListedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpDisconnectedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpDisconnectReason.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpFileOperationInfo.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpFileTransferEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpFileTransferFailedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpFileTransferFailureReason.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpFileTransferProgressedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpPassiveOperation.cs" /> + <Compile Include="WinPhoneFtp.FtpService\FtpPresentWorkingDirectoryEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\Logger.cs" /> + <Compile Include="WinPhoneFtp.FtpService\SocketClosedEventArgs.cs" /> + <Compile Include="WinPhoneFtp.FtpService\SocketCloseReason.cs" /> + <Compile Include="WinPhoneFtp.FtpService\TcpClientSocket.cs" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </ApplicationDefinition> + <Page Include="AboutPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="PersonalizationPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="SkydrivePage.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="EBookReader.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="MainPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="SecurityPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="SettingsPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="URISchemeExtensionsLandingPage.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="VaultPage.xaml"> + <Generator>MSBuild:MarkupCompilePass1</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="VideoPlayer.xaml"> + <Generator>MSBuild:MarkupCompilePass1</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + <None Include="packages.config" /> + <None Include="Properties\AppManifest.xml" /> + <None Include="Properties\WMAppManifest.xml"> + <SubType>Designer</SubType> + </None> + </ItemGroup> + <ItemGroup> + <Content Include="123.wmv"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="AMI.png" /> + <Content Include="Assets\BadgeLogo.png" /> + <Content Include="Assets\Logo.png" /> + <Content Include="Assets\SplashScreen.png" /> + <Content Include="Assets\SquareTile150x150.png" /> + <Content Include="Assets\SquareTile71x71.png" /> + <Content Include="Assets\StoreLogo.png" /> + <Content Include="Assets\WideLogo.png" /> + <Content Include="Resources\Assets\Images\audio.png" /> + <Content Include="Resources\Assets\Images\cover_art.jpg" /> + <Content Include="Resources\Assets\Images\cover_art.png" /> + <Content Include="Resources\Assets\Images\documents.png" /> + <Content Include="Resources\Assets\Images\download.png" /> + <Content Include="Resources\Assets\Images\greySearch.png" /> + <Content Include="Resources\Assets\Images\Hamburger_alpha.png" /> + <Content Include="Resources\Assets\Images\headphone.png" /> + <Content Include="Resources\Assets\Images\MusicBar.png" /> + <Content Include="Resources\Assets\Images\phone.png" /> + <Content Include="Resources\Assets\Images\sdcard.png" /> + <Content Include="Resources\Assets\Images\Search.png" /> + <Content Include="Resources\Assets\Images\skydrive.png" /> + <Content Include="Resources\Assets\Images\Hamburger.png" /> + <Content Include="Resources\Assets\File_Types\7z.png" /> + <Content Include="Resources\Assets\File_Types\avi.png" /> + <Content Include="Resources\Assets\File_Types\csv.png" /> + <Content Include="Resources\Assets\File_Types\mkv.png" /> + <Content Include="Resources\Assets\File_Types\pdf.png" /> + <Content Include="Resources\Assets\AlignmentGrid.png" /> + <Content Include="Resources\Assets\ApplicationIcon.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\File_Types\rar.png" /> + <Content Include="Resources\Assets\Images\flatIcon.PNG" /> + <Content Include="Resources\Assets\Images\add.png" /> + <Content Include="Resources\Assets\Images\folder.png" /> + <Content Include="Resources\Assets\Images\list.png" /> + <Content Include="Resources\Assets\Images\mute.png" /> + <Content Include="Resources\Assets\Images\pause.png" /> + <Content Include="Resources\Assets\Images\settings_dark.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Images\settings_light.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Images\share.png" /> + <Content Include="Resources\Assets\Images\whiteSearch.png" /> + <Content Include="Resources\Assets\Wallpaper\bg1.jpg" /> + <Content Include="Resources\Assets\Wallpaper\bg2.jpg" /> + <Content Include="Resources\Assets\Images\transport.ff.png" /> + <Content Include="Resources\Assets\Images\user.png" /> + <Content Include="Resources\Assets\Images\video.png" /> + <Content Include="Resources\Assets\Images\back.png" /> + <Content Include="Toolkit.Content\home.png" /> + <Resource Include="greyhome.png" /> + <Resource Include="Resources\Assets\Images\next.png" /> + <Resource Include="Resources\Assets\Images\onedrive.png" /> + <Resource Include="Resources\Assets\Images\play.png" /> + <Resource Include="Resources\Assets\Images\previous.png" /> + <Resource Include="Resources\Assets\Images\slider_alpha.png" /> + <Resource Include="Resources\Assets\Images\transport.pause.png" /> + <Resource Include="Resources\Assets\Images\transport.play.png" /> + <Content Include="Resources\Assets\Images\transport.rew.png" /> + <Content Include="Resources\Assets\Tiles\FlipCycleTileLarge.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Tiles\FlipCycleTileMedium.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Tiles\FlipCycleTileSmall.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Tiles\IconicTileMediumLarge.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="Resources\Assets\Tiles\IconicTileSmall.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="File360.Logo.Large.png" /> + <Content Include="File360.Logo.Medium.png" /> + <Content Include="File360.Logo.png" /> + <Content Include="File360.Logo.Small.png" /> + <Content Include="README_FIRST.txt" /> + <Content Include="Resources\Assets\Images\settings.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="SplashScreenImage.jpg" /> + <Content Include="Resources\Assets\File_Types\svg.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Add.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Cancel.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Check.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Delete.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Select.png" /> + <Content Include="Toolkit.Content\ApplicationBar.Sort.png" /> + <Resource Include="Resources\Assets\Settings\ftp.png" /> + <Resource Include="whitehome.png" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Resources\AppResources.resx"> + <Generator>PublicResXFileCodeGenerator</Generator> + <LastGenOutput>AppResources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <EmbeddedResource Include="Resources\AppResources.ta.resx" /> + </ItemGroup> + <ItemGroup> + <Reference Include="Microsoft.Expression.Drawing" /> + <Reference Include="Microsoft.Expression.Interactions" /> + <Reference Include="Microsoft.Phone.Controls.Maps, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" /> + <Reference Include="Microsoft.Phone.Controls.Toolkit, Version=8.0.1.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL"> + <HintPath>..\packages\WPtoolkit.4.2013.08.16\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Windows.Interactivity" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Resources\Assets\Images\favs.png" /> + <Resource Include="Resources\Assets\Images\mute.png" /> + <Resource Include="Resources\Assets\Images\repeat.png" /> + <Resource Include="Resources\Assets\Images\volume_high.png" /> + <Resource Include="Resources\Assets\Images\volume_low.png" /> + <Resource Include="share.png" /> + <Resource Include="slider_alpha.png" /> + <Folder Include="FileTypeAssociation\" /> + <Folder Include="GaussianBlur\" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" /> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <ProjectExtensions /> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\Expression\Blend\WindowsPhone\v8.0\Microsoft.Expression.Blend.WindowsPhone.targets" /> +</Project> diff --git a/File360/LocalizedStrings.cs b/File360/LocalizedStrings.cs @@ -0,0 +1,14 @@ +using File360.Resources; + +namespace File360 +{ + /// <summary> + /// Provides access to string resources. + /// </summary> + public class LocalizedStrings + { + private static AppResources _localizedResources = new AppResources(); + + public AppResources LocalizedResources { get { return _localizedResources; } } + } +} +\ No newline at end of file diff --git a/File360/MainPage.xaml b/File360/MainPage.xaml @@ -0,0 +1,633 @@ +<phone:PhoneApplicationPage + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" + x:Class="File360.MainPage" + xmlns:local="clr-namespace:File360" + Orientation="Portrait" + mc:Ignorable="d" + shell:SystemTray.IsVisible="True"> + + <phone:PhoneApplicationPage.Resources> + <local:AppSettings x:Key="appSettings"> + </local:AppSettings> + <DataTemplate x:Name="File360FileTemplate"> + <Grid Tap="folderTap_Click" Height="130" Width="110" VerticalAlignment="Bottom" HorizontalAlignment="Right" Background="{x:Null}"> + <Rectangle Width="85" Height="65" Margin="0,0,0,22"> + <Rectangle.Fill> + <ImageBrush Stretch="Uniform" ImageSource="{Binding Name2}"/> + </Rectangle.Fill> + </Rectangle> + <TextBlock x:Name="folderTap" TextWrapping="NoWrap" TextTrimming="WordEllipsis" Text="{Binding Name}" Foreground="{StaticResource PhoneForegroundBrush}" Margin="0,92,0,0" TextAlignment="Center" FontFamily="Segoe UI Light" FontSize="16"/> + </Grid> + </DataTemplate> + <DataTemplate x:Name="SettingsItemTemplate"> + <Grid Tap="SettingTap_Tap" x:Name="SettingTap" Height="120"> + <TextBlock x:Name="txtB" Margin="116,10,10,48" Foreground="{StaticResource PhoneForegroundBrush}" Text="{Binding SettingName}" FontSize="36"/> + <TextBlock Margin="111,65,17,20" Foreground="{StaticResource PhoneSubtleBrush}" Text="{Binding SettingDescription}" FontFamily="Segoe UI Light"/> + <Rectangle HorizontalAlignment="Left" Height="75" Margin="6,24,0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="75" Fill="{StaticResource PhoneForegroundBrush}"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="{Binding SettingPicture}"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + </DataTemplate> + <Style x:Key="BackButtonEllipse" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent" Margin="0,0,0,2"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Margin="0,0,0,1" Background="{StaticResource PhoneForegroundBrush}"> + <Border.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/back.png"/> + </Border.OpacityMask> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="HamburgerButton" TargetType="Button"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/> + <Setter Property="Padding" Value="10,5,10,6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="SliderStyle" TargetType="Slider"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="BorderBrush" Value="Transparent"/> + <Setter Property="Maximum" Value="10"/> + <Setter Property="Minimum" Value="0"/> + <Setter Property="Value" Value="0"/> + <Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Margin="0,0,0,1" Background="{StaticResource PhoneChromeBrush}"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="HorizontalTemplate" Margin="10,0,10,10"> + <Rectangle x:Name="HorizontalTrack" IsHitTestVisible="False" Margin="0,15,0,16" Fill="{StaticResource PhoneBorderBrush}" RadiusY="3.5" RadiusX="3.5"/> + <Rectangle x:Name="HorizontalFill" IsHitTestVisible="False" Margin="0,15,0,16" RadiusX="3.5" RadiusY="3.5" StrokeThickness="2"> + <Rectangle.Fill> + <SolidColorBrush Color="White"/> + </Rectangle.Fill> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 6, 12"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="HorizontalCenterElement" HorizontalAlignment="Left" Margin="0,8" Width="22" Stroke="{StaticResource PhoneForegroundBrush}" Fill="{StaticResource PhoneChromeBrush}" RadiusY="9" RadiusX="9" StrokeThickness="4.5"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + <Grid x:Name="VerticalTemplate" Margin="{StaticResource PhoneVerticalMargin}"> + <Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"/> + <Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 12, 6"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="VerticalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" Height="12" Margin="12,0,12,0" VerticalAlignment="Top" Width="24"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="PhoneCurvedTextBoxStyle" TargetType="toolkit:PhoneTextBox"> + <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/> + <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/> + <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/> + <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/> + <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/> + <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/> + <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="Padding" Value="{StaticResource PhoneBorderThickness}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="toolkit:PhoneTextBox"> + <Grid x:Name="RootGrid" Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HintBorder"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TextBorder"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="TextBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="TextBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="0"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="HorizontalAlignment" Storyboard.TargetName="Text"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <HorizontalAlignment>Stretch</HorizontalAlignment> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="HintBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBackgroundBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="HintBorder"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBorderBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"/> + </VisualStateGroup> + <VisualStateGroup x:Name="LengthIndicatorStates"> + <VisualState x:Name="LengthIndicatorVisible"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="LengthIndicator"> + <DiscreteObjectKeyFrame KeyTime="0:0:0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="RootGrid"> + <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="0, 0, 0, 27"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="LengthIndicator"> + <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="0.6"/> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimation Duration="0:0:0.350" To="32" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="LengthIndicator"> + <DoubleAnimation.EasingFunction> + <ExponentialEase Exponent="6"/> + </DoubleAnimation.EasingFunction> + </DoubleAnimation> + </Storyboard> + </VisualState> + <VisualState x:Name="LengthIndicatorHidden"> + <Storyboard> + <DoubleAnimation Duration="0:0:0.350" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="LengthIndicator"> + <DoubleAnimation.EasingFunction> + <ExponentialEase Exponent="6"/> + </DoubleAnimation.EasingFunction> + </DoubleAnimation> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="RootGrid"> + <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="0, 0, 0, 0"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="LengthIndicator"> + <DiscreteObjectKeyFrame KeyTime="0:0:0.350" Value="0"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="LengthIndicator"> + <DiscreteObjectKeyFrame KeyTime="0:0:0.350"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="LengthIndicatorBorder"> + <TextBlock x:Name="LengthIndicator" Foreground="{StaticResource PhoneContrastBackgroundBrush}" FontSize="{StaticResource PhoneFontSizeNormal}" HorizontalAlignment="Right" Margin="{StaticResource PhoneMargin}" Opacity="0" TextAlignment="Right" VerticalAlignment="Bottom"> + <TextBlock.RenderTransform> + <TranslateTransform/> + </TextBlock.RenderTransform> + </TextBlock> + </Border> + <Border x:Name="HintBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource PhoneTouchTargetOverhang}"> + <Grid> + <ContentControl x:Name="HintContent" Background="Transparent" Content="{TemplateBinding Hint}" HorizontalAlignment="Left" Margin="3,0,3,0" Style="{TemplateBinding HintStyle}" Visibility="{TemplateBinding ActualHintVisibility}" VerticalAlignment="Center"/> + <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch"/> + <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="59" Margin="-3,-1,0,0" Stroke="Black" VerticalAlignment="Top" Width="373"/> + </Grid> + </Border> + <Border x:Name="TextBorder" BorderBrush="{StaticResource PhoneInverseBackgroundBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed"> + <TextBox x:Name="Text" Foreground="{StaticResource PhoneDisabledBrush}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="Left" SelectionForeground="{TemplateBinding SelectionForeground}" SelectionBackground="{TemplateBinding SelectionBackground}" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Text}" BorderBrush="{StaticResource PhoneChromeBrush}"/> + </Border> + <Border x:Name="ActionIconBorder" Background="Transparent" HorizontalAlignment="Right" Height="72" VerticalAlignment="Bottom" Width="84"> + <Image x:Name="ActionIcon" Height="26" Source="{TemplateBinding ActionIcon}" Width="26"/> + </Border> + <TextBlock x:Name="MeasurementTextBlock" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" IsHitTestVisible="False" Margin="8" Opacity="0" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Text}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style x:Key="ListPickerItemStyle" TargetType="toolkit:ListPickerItem"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="HorizontalContentAlignment" Value="Stretch"/> + <Setter Property="Padding" Value="8 10"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="toolkit:ListPickerItem"> + <Grid Background="{TemplateBinding Background}"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="SelectionStates"> + <VisualState x:Name="Unselected"/> + <VisualState x:Name="Selected"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </phone:PhoneApplicationPage.Resources> + + <phone:PhoneApplicationPage.ApplicationBar> + <shell:ApplicationBar x:Name="appBar" IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" BackgroundColor="Black" ForegroundColor="White" > + <shell:ApplicationBar.MenuItems> + <shell:ApplicationBarMenuItem x:Name="settings_appBar" IsEnabled="True" Click="Settings_Click" Text="settings"/> + </shell:ApplicationBar.MenuItems> + <shell:ApplicationBarIconButton IconUri="/Toolkit.Content/ApplicationBar.Select.png" IsEnabled="True" Text="multi select"/> + <shell:ApplicationBarIconButton IconUri="/Toolkit.Content/ApplicationBar.Add.png" IsEnabled="True" Text="new"/> + </shell:ApplicationBar> + </phone:PhoneApplicationPage.ApplicationBar> + <Canvas x:Name="canvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> + <Canvas.Resources> + <Storyboard x:Name="moveAnimation"> + <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="(Canvas.Left)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True" /> + </Storyboard> + </Canvas.Resources> + <Canvas CacheMode="BitmapCache" x:Name="LayoutRoot" Width="1320" VerticalAlignment="Stretch" Canvas.Left="-420" Height="768"> + <Border Width="420" CacheMode="BitmapCache" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="768" Background="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"> + <Grid x:Name="LeftGrid"> + <Grid.Background> + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#33000000" Offset="0"/> + <GradientStop Color="#333CF1F9" Offset="1"/> + </LinearGradientBrush> + </Grid.Background> + <Grid Height="92" VerticalAlignment="Top" HorizontalAlignment="Left" Width="420" Margin="0,3,0,0"> + <toolkit:PhoneTextBox Hint="Search" HidesActionItemWhenEmpty="True" TextChanged="searchBox_TextChanged" x:Name="searchBox" HorizontalAlignment="Left" Height="88" Margin="10,4,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="400" BorderBrush="{x:Null}" Style="{StaticResource PhoneCurvedTextBoxStyle}"> + <toolkit:PhoneTextBox.Foreground> + <SolidColorBrush Color="{StaticResource PhoneChromeColor}"/> + </toolkit:PhoneTextBox.Foreground> + </toolkit:PhoneTextBox> + <Rectangle HorizontalAlignment="Left" Height="58" VerticalAlignment="Top" Width="76" Margin="316,22,0,0" Fill="{StaticResource PhoneForegroundBrush}"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/go.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + <Grid HorizontalAlignment="Left" Width="420" Margin="0,95,0,0"> + <ListBox x:Name="SideBar" Height="635" VerticalAlignment="Bottom" Margin="10,0,10,38" Background="{x:Null}"> + <Grid Width="406" Height="122"> + <Grid.Background> + <SolidColorBrush Color="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"/> + </Grid.Background> + <TextBlock Text="Home" FontSize="26" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="126,42,124,49" Width="156" Foreground="{StaticResource PhoneForegroundBrush}"/> + <Rectangle Fill="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Left" Height="50" Margin="34,37,0,0" VerticalAlignment="Top" Width="50"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/home.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + <Grid Width="406" Height="121"> + <Grid.Background> + <SolidColorBrush Color="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"/> + </Grid.Background> + <TextBlock Margin="138,50,119,47" Text="OneDrive" FontSize="26" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneForegroundBrush}"/> + <Ellipse x:Name="oneFill" Fill="#FF094AB2" HorizontalAlignment="Left" Height="95" VerticalAlignment="Top" Width="95" Margin="11,16,0,0" Stroke="{StaticResource PhoneForegroundBrush}" StrokeThickness="3"> + <Ellipse.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/onedrive.png"/> + </Ellipse.OpacityMask> + </Ellipse> + </Grid> + <Grid x:Name="s" Tap="sdcard_menu_Tap" Width="406" Height="122"> + <Grid.Background> + <SolidColorBrush Color="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"/> + </Grid.Background> + <TextBlock x:Name="sdText" Margin="164,47,0,44" Text="SD" FontSize="26" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="{StaticResource PhoneForegroundBrush}"/> + <Rectangle x:Name="sdImage" Fill="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Left" Height="50" Margin="29,40,0,0" VerticalAlignment="Top" Width="50" Stretch="Uniform"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/sdcard.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + <Grid Width="406" Height="122"> + <Grid.Background> + <SolidColorBrush Color="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"/> + </Grid.Background> + <TextBlock Margin="157,51,0,38" Text="Phone" FontSize="26" TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center" Height="33" Foreground="{StaticResource PhoneForegroundBrush}"/> + <Rectangle Fill="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Left" Height="66" Margin="18,35,0,0" VerticalAlignment="Top" Width="75"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/phone.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + <Grid Height="137" Width="406"> + <Grid.Background> + <SolidColorBrush Color="{Binding Path=SideBarColor, Mode=OneWay, Source={StaticResource appSettings}}"/> + </Grid.Background> + <TextBlock Text="Downloads" FontSize="36" FontFamily="Segoe WP Light" Margin="27,10,206,71" Foreground="{StaticResource PhoneForegroundBrush}"/> + <TextBlock Text="there are no active downloads" FontSize="22" FontFamily="Segoe WP Light" Margin="27,66,-7,15" Foreground="{StaticResource PhoneBorderBrush}"/> + <Rectangle Fill="{StaticResource PhoneForegroundBrush}" Margin="200,10,141,71" Width="65"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/download.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + </ListBox> + </Grid> + </Grid> + </Border> + <Border Width="420" CacheMode="BitmapCache" Grid.Column="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="768" Canvas.Left="900"> + <Border.Background> + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#33000000" Offset="0"/> + <GradientStop Color="#333CF1F9" Offset="1"/> + </LinearGradientBrush> + </Border.Background> + <Grid RenderTransformOrigin="0.452,0.507"> + <Grid Tap="playState_Tap" HorizontalAlignment="Left" Height="125" VerticalAlignment="Top" Width="420" Background="{StaticResource PhoneChromeBrush}"> + <TextBlock x:Name="songName" HorizontalAlignment="Left" Height="40" Margin="37,50,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="373" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="28" FontFamily="Segoe WP Light"/> + <TextBlock x:Name="artistName" HorizontalAlignment="Left" Height="30" Margin="36,90,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="374" Foreground="{StaticResource PhoneAccentBrush}" FontSize="22" FontFamily="Segoe wp Light"/> + <TextBlock HorizontalAlignment="Left" Height="37" Margin="72,10,0,0" TextWrapping="Wrap" Text="NOW PLAYING" VerticalAlignment="Top" Width="256" FontFamily="Segoe WP Light" FontSize="30" Foreground="{StaticResource PhoneForegroundBrush}"/> + <Rectangle x:Name="playState" Fill="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Left" Height="40" Margin="18,10,0,0" StrokeThickness="6" VerticalAlignment="Top" Width="49"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/transport.play.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + <Slider Visibility="Collapsed" HorizontalAlignment="Left" Height="50" Margin="40,325,0,0" VerticalAlignment="Top" Width="315" Style="{StaticResource SliderStyle}" Background="#FFC7A3A3"/> + <ToggleButton Content="" HorizontalAlignment="Left" Height="50" Margin="364,4,0,0" VerticalAlignment="Top" Width="46" Background="{StaticResource PhoneForegroundBrush}" BorderThickness="0"> + <ToggleButton.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/like.png"/> + </ToggleButton.OpacityMask> + </ToggleButton> + </Grid> + </Border> + <Grid x:Name="grdCommands" CacheMode="BitmapCache" Grid.Column="1" Height="768" Width="480" Canvas.Left="420" Background="{Binding Path=PageColor, Mode=OneWay, Source={StaticResource appSettings}}" > + <Grid x:Name="header" Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,625"> + <TextBlock DoubleTap="Vault_DoubleTap" HorizontalAlignment="Left" Height="33" TextWrapping="Wrap" VerticalAlignment="Top" Width="131" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="24" Margin="74,16,0,0" FontFamily="Segoe UI Symbol"> + <Run Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"/> + <Run Foreground="{StaticResource PhoneAccentBrush}" Text="°"/> + </TextBlock> + + <Button Click="OpenClose_Right" HorizontalAlignment="Right" VerticalAlignment="Top" Width="71" Height="60" BorderBrush="{x:Null}" BorderThickness="0" Background="{x:Null}" Foreground="{x:Null}"/> + <Button Click="OpenClose_Left" Content="" VerticalAlignment="Top" Height="60" HorizontalAlignment="Right" Width="74" BorderThickness="0" Background="{StaticResource PhoneAccentBrush}" Margin="0,0,406,0" Style="{StaticResource HamburgerButton}"> + <Button.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/Hamburger.png"/> + </Button.OpacityMask> + </Button> + <TextBlock x:Name="fUrl" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Left" Height="44" Margin="10,99,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="460"> + <Span> + <Run x:Name="sdop" FontSize="30" FontWeight="Normal" Text="sd:\\" Foreground="{StaticResource PhoneAccentBrush}"/> + </Span> + <Span> + <Run x:Name="fileUrl" Text=" " FontWeight="Light" FontStretch="UltraCondensed" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="26"/> + </Span> + </TextBlock> + <TextBlock TextTrimming="WordEllipsis" x:Name="fileHeader" HorizontalAlignment="Left" Height="46" TextWrapping="Wrap" VerticalAlignment="Top" Width="445" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="34" FontFamily="Segoe WP" Margin="10,49,0,0"/> + </Grid> + <Popup x:Name="PasswordAccepter" Margin="0,0,0,71"> + <Grid Height="700" Width="480" Background="{StaticResource PhoneBackgroundBrush}"> + <Grid Margin="0,0,0,603"> + <TextBlock x:Name="passwordDisplay" VerticalAlignment="Center" HorizontalAlignment="Left" Height="72" Margin="51,16,0,9" TextWrapping="Wrap" Width="384" FontSize="48" TextAlignment="Center" Foreground="{StaticResource PhoneForegroundBrush}"/> + </Grid> + <toolkit:WrapPanel x:Name="wrapPanel" Margin="10,102,10,187" Height="307.5"/> + <Button Content="x" HorizontalAlignment="Left" Click="PopupCancel" Height="102.5" Margin="10,462,0,0" VerticalAlignment="Top" Width="153.3" BorderBrush="{x:Null}" Background="{x:Null}" FontSize="48" FontFamily="Ebrima"/> + <Button Content="0" Click="Numbers_Click" HorizontalAlignment="Left" Height="102.5" Margin="163,462,0,0" VerticalAlignment="Top" Width="153.3" BorderBrush="{x:Null}" FontSize="35" Background="{x:Null}"/> + <Button Content="" Click="PasswordBackspace" HorizontalAlignment="Left" Height="102.5" Margin="327,462,0,0" VerticalAlignment="Top" Width="153.3" BorderBrush="{x:Null}"> + <Button.Background> + <ImageBrush Stretch="Uniform" ImageSource="/Toolkit.Content/ApplicationBar.Cancel.png"/> + </Button.Background> + </Button> + <TextBlock HorizontalAlignment="Left" Height="56" Margin="199,603,0,0" TextWrapping="Wrap" Text="Forgot Password?" VerticalAlignment="Top" Width="235" FontSize="24" Foreground="{StaticResource PhoneForegroundBrush}" FontFamily="Segoe WP Semibold"/> + <TextBlock x:Name="WarningP" Visibility="Collapsed" HorizontalAlignment="Left" Height="57" Margin="0,97,0,0" TextWrapping="Wrap" Text="MAX PASSWORD CHARACTERS 4" VerticalAlignment="Top" Width="480" TextAlignment="Center" FontSize="30" Foreground="#FFB43D3D" FontFamily="Segoe UI Symbol"/> + </Grid> + </Popup> + <TextBlock x:Name="nosd" Visibility="Collapsed" Style="{StaticResource PhoneTextLargeStyle}" Margin="10,213,10,451" TextWrapping="Wrap" Height="104" Width="460" TextAlignment="Center" Foreground="{StaticResource PhoneForegroundBrush}"> + <Span Foreground="{StaticResource PhoneForegroundBrush}" FontSize="32"> + <Run Text="no "/> + </Span> + <Span Foreground="{StaticResource PhoneAccentBrush}" FontSize="32" > + <Run Text="sdcard " FontWeight="Bold"/> + </Span> + <Span Foreground="{StaticResource PhoneForegroundBrush}" FontSize="32"> + <Run Text="found, please insert one to view files. "/> + </Span> + </TextBlock> + <phone:LongListSelector + x:Name="sdlists" + LayoutMode="Grid" + GridCellSize="110,120" + ItemTemplate="{StaticResource File360FileTemplate}" + IsGroupingEnabled="False" + Margin="10,143,10,71" Background="{x:Null}"/> + <Popup x:Name="personalization" Margin="0,0,0,15"> + <Grid Height="754" Width="480"> + <Grid.Background> + <SolidColorBrush Color="#D8FFFFFF"/> + </Grid.Background> + <TextBlock Margin="22,21,2,655" Style="{StaticResource PhoneTextTitle1Style}" Text="personalization" FontSize="40" FontFamily="Segoe WP Light"/> + <ListBox x:Name="listBox" Margin="10,84,0,0"> + <toolkit:ToggleSwitch x:Name="Wallpaper" Checked="Wallpaper_Checked" Unchecked="Wallpaper_Unchecked" Content="Wallpaper" Width="436" Height="108"/> + <Grid x:Name="WallpaperTemp" Visibility="Visible" Height="341" Width="460"> + <Rectangle x:Name="SideMenuWallChanger" Margin="10,0,10,59" RadiusY="23.5" RadiusX="23.5"> + <Rectangle.Fill> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Wallpaper/bg1.jpg"/> + </Rectangle.Fill> + </Rectangle> + <Rectangle Fill="{StaticResource PhoneDisabledBrush}" Margin="0,318,0,17" RenderTransformOrigin="0.5,0.5"> + <Rectangle.RenderTransform> + <CompositeTransform ScaleY="-1"/> + </Rectangle.RenderTransform> + </Rectangle> + <TextBlock Tap="SideMenuWallChanger_Tap" HorizontalAlignment="Left" Height="59" Margin="181,184,0,0" VerticalAlignment="Top" Width="115" Text="change" FontSize="36" FontFamily="Segoe WP Light"> + <TextBlock.Foreground> + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#99FFFFFF" Offset="0"/> + <GradientStop Color="#BFFFFFFF" Offset="1"/> + </LinearGradientBrush> + </TextBlock.Foreground> + </TextBlock> + </Grid> + <toolkit:ToggleSwitch Content="Sound FX" Width="436" Height="106"/> + <Grid Width="470"> + <TextBlock TextWrapping="Wrap" Text=" Sidebar Color" Width="192" FontFamily="Segoe WP Light" FontSize="24" Margin="10,4,268,6"/> + <Rectangle Fill="{StaticResource PhoneChromeBrush}" Stroke="{StaticResource PhoneForegroundBrush}" StrokeThickness="10" Margin="174,0,246,0" Width="42"/> + </Grid> + <Grid Height="{Binding ElementName=listPicker, Path=ViewportWidth}" Width="470"> + <toolkit:ListPicker x:Name="listPicker" Margin="0,0,10,0" BorderBrush="{x:Null}" Foreground="{StaticResource PhoneAccentBrush}"> + <toolkit:ListPickerItem Content="Current Chrome Color" Style="{StaticResource ListPickerItemStyle}"/> + <toolkit:ListPickerItem Content="Current Background Color"/> + <toolkit:ListPickerItem Content="{Binding LocalizedResources.other, Source={StaticResource LocalizedStrings}}"/> + </toolkit:ListPicker> + </Grid> + </ListBox> + </Grid> + </Popup> + <Popup x:Name="settings" Margin="10,10,10,15"> + <Grid Height="743" Width="460" Background="{StaticResource PhoneSemitransparentBrush}"> + + <phone:LongListSelector + x:Name="SettingsList" + Style="{StaticResource LongListSelectorWithNoScrollBarStyle}" + ScrollViewer.VerticalScrollBarVisibility="Hidden" + ItemTemplate="{StaticResource SettingsItemTemplate}" + IsGroupingEnabled="False" Margin="10,93,10,0"/> + <TextBlock HorizontalAlignment="Left" Height="78" Margin="10,10,0,0" TextWrapping="Wrap" Text="settings" VerticalAlignment="Top" Width="348" FontFamily="Segoe WP Light" FontSize="40" Foreground="{StaticResource PhoneForegroundBrush}"/> + </Grid> + </Popup> + <Popup x:Name="security"> + <Grid Height="734"> + <Grid.Background> + <SolidColorBrush Color="#D8000000"/> + </Grid.Background> + <toolkit:ToggleSwitch x:Name="passw" Checked="passw_Checked" Unchecked="passw_Unchecked" HorizontalAlignment="Left" Margin="10,148,0,0" VerticalAlignment="Top" Width="460" Content="password"/> + <toolkit:ToggleSwitch x:Name="shake" Checked="shake_Checked" Unchecked="shake_Unchecked" HorizontalAlignment="Left" Margin="10,256,0,0" VerticalAlignment="Top" Width="460" Content="shake to hide"/> + <TextBox x:Name="pb" HorizontalAlignment="Left" Height="84" Margin="10,359,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="460" TextChanged="PSetter" Foreground="{StaticResource PhoneBackgroundBrush}" SelectionBackground="{x:Null}" SelectionForeground="{x:Null}"/> + <TextBlock HorizontalAlignment="Left" Height="81" Margin="16,31,0,0" TextWrapping="Wrap" Text="security" VerticalAlignment="Top" Width="378" Foreground="White" FontFamily="Segoe WP Light" FontSize="40"/> + </Grid> + </Popup> + <Popup x:Name="about" IsOpen="False"> + <Grid Background="#D8000000" Width="479" Height="740"> + <Rectangle x:Name="bgChanger"/> + <Image HorizontalAlignment="Left" Height="91" Margin="105,197,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Source="/AMI.png" Width="256"/> + <HyperlinkButton Content="am Industries inc." HorizontalAlignment="Left" Margin="136,306,0,0" Grid.Row="1" VerticalAlignment="Top" FontFamily="Segoe WP Light" Foreground="{StaticResource PhoneForegroundBrush}"/> + <TextBlock HorizontalAlignment="Left" Margin="28,144,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" Text="developed & produced by" Foreground="{StaticResource PhoneForegroundBrush}" FontFamily="Segoe WP Light" FontSize="18"/> + <TextBlock Text="contact developer:" HorizontalAlignment="Left" Margin="41,379,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="38" Foreground="{StaticResource PhoneForegroundBrush}" FontFamily="Segoe WP Light" FontSize="22"/> + <HyperlinkButton HorizontalAlignment="Left" Margin="213,375,0,0" VerticalAlignment="Top" Width="230" Height="38" Content="bharatvaj@yahoo.com" FontFamily="Segoe WP Light" FontSize="22" Foreground="{StaticResource PhoneForegroundBrush}"/> + <ListBox Grid.RowSpan="2" Margin="10,437,10,12" Background="{x:Null}"/> + <Rectangle x:Name="blue" HorizontalAlignment="Left" Height="100" Margin="286,188,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="75"/> + <Rectangle x:Name="red" HorizontalAlignment="Left" Height="100" Margin="105,188,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="75"/> + <Rectangle x:Name="green" HorizontalAlignment="Left" Height="100" Margin="197,188,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="75"/> + <TextBlock HorizontalAlignment="Left" Height="60" Margin="28,32,0,0" TextWrapping="Wrap" Text="about" VerticalAlignment="Top" Width="276" FontSize="40" FontFamily="Segoe WP Light" Foreground="{StaticResource PhoneForegroundBrush}"/> + </Grid> + </Popup> + </Grid> + <Grid x:Name="Blurer" ManipulationStarted="canvas_ManipulationStarted" ManipulationDelta="canvas_ManipulationDelta" ManipulationCompleted="canvas_ManipulationCompleted" Visibility="Collapsed" Height="768" Width="480" Canvas.Left="420"> + <Grid.Background> + <SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}"/> + </Grid.Background> + </Grid> + </Canvas> + </Canvas> +</phone:PhoneApplicationPage> +\ No newline at end of file diff --git a/File360/MainPage.xaml.cs b/File360/MainPage.xaml.cs @@ -0,0 +1,708 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using System.Windows.Input; +using System.Windows.Media.Animation; +using System.IO.IsolatedStorage; +using Microsoft.Phone.Storage; +using System.Windows.Media; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Windows.Media.Imaging; +using Microsoft.Devices.Sensors; +using System.Windows.Data; + +namespace File360 +{ + public partial class MainPage : PhoneApplicationPage + { + List<sdlist> l = new List<sdlist>(); + ExternalStorageFolder tempFolder; + IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; + public string btns; + string txts; + List<settinglist> sl = new List<settinglist>(); + AppSettings apps = new AppSettings(); + public MainPage() + { + InitializeComponent(); + StateHelper(); + VisualStateManager.GoToState(this, "Normal", false); + #region InitialKeyUpdater + if (appSettings.Count == 0) + { + appSettings.Add("Shaker", "Off"); + appSettings.Save(); + appSettings.Add("Passer", "Off"); + appSettings.Save(); + appSettings.Add("PasswordValue", "2580"); + appSettings.Save(); + appSettings.Add("WallPaper", "/Resources/Assets/Wallpaper/bg1.jpg"); + appSettings.Save(); + } + #endregion + PopupPasswordKeyboard(); + #region InitialSettings + sl.Add(new settinglist("ftp", "configure file transfer protocol", "/Resources/Assets/Settings/ftp.png")); + sl.Add(new settinglist("bluetooth", "bluetooth settings", "/Resources/Assets/Settings/bluetooth.png")); + sl.Add(new settinglist("nfc", "nfc configuration", "/Resources/Assets/Settings/nfc.png")); + sl.Add(new settinglist("personalization", "get a look", "/Resources/Assets/Settings/personalization.png")); + sl.Add(new settinglist("music", "change your music settings", "/Resources/Assets/Settings/music.png")); + sl.Add(new settinglist("security", "protect your files", "/Resources/Assets/Settings/security.png")); + sl.Add(new settinglist("about", "About Us!", "/Resources/Assets/Settings/about.png")); + SettingsList.ItemsSource = sl; + #endregion + MusicDisplay(); + #region ThemeChecker + Visibility themeHold = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"]; + if (themeHold == System.Windows.Visibility.Visible) + { + ApplicationBar.BackgroundColor = Colors.White; + ApplicationBar.ForegroundColor = Colors.Black; + apps.SideBarColor = "{StaticResource PhoneSemitransparentBrush}"; + } + #endregion + #region AccelerometerReader + if (!Accelerometer.IsSupported) + { + shake.IsEnabled = false; + } + Settings_Checker(); + #endregion + } + + #region Wallpaper + public void WallpaperChanger(BitmapImage bitm) + { + ApplyGaussianFilter(bitm); + } + public void ApplyGaussianFilter(BitmapImage image) + { + //do some fancy work + //then send to ImageApply to apply the Image. + ImageApply(image); + } + + public void ImageApply(BitmapImage imt) + { + ImageBrush im = new ImageBrush(); + im.ImageSource = imt; + LayoutRoot.Background = im; + } + #endregion + #region LateralMenu + private void OpenClose_Left(object sender, RoutedEventArgs e) + { + var left = Canvas.GetLeft(LayoutRoot); + if (left > -100) + { + ApplicationBar.IsVisible = true; + MoveViewWindow(-420); + Blurer.Visibility = System.Windows.Visibility.Collapsed; + } + else + { + ApplicationBar.IsVisible = false; + MoveViewWindow(0); + Blurer.Visibility = System.Windows.Visibility.Visible; + } + } + private void OpenClose_Right(object sender, RoutedEventArgs e) + { + var left = Canvas.GetLeft(LayoutRoot); + if (left > -520) + { + ApplicationBar.IsVisible = false; + MoveViewWindow(-840); + Blurer.Visibility = System.Windows.Visibility.Visible; + } + else + { + ApplicationBar.IsVisible = true; + MoveViewWindow(-420); + Blurer.Visibility = System.Windows.Visibility.Collapsed; + + } + } + + void MoveViewWindow(double left) + { + _viewMoved = true; + if (left==-420) + ApplicationBar.IsVisible = true; + else + ApplicationBar.IsVisible = false; + ((Storyboard)canvas.Resources["moveAnimation"]).SkipToFill(); + ((DoubleAnimation)((Storyboard)canvas.Resources["moveAnimation"]).Children[0]).To = left; + ((Storyboard)canvas.Resources["moveAnimation"]).Begin(); + } + + private void canvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) + { + if (e.DeltaManipulation.Translation.X != 0) + Canvas.SetLeft(LayoutRoot, Math.Min(Math.Max(-840, Canvas.GetLeft(LayoutRoot) + e.DeltaManipulation.Translation.X), 0)); + } + + double initialPosition; + bool _viewMoved = false; + private void canvas_ManipulationStarted(object sender, ManipulationStartedEventArgs e) + { + _viewMoved = false; + initialPosition = Canvas.GetLeft(LayoutRoot); + } + + private void canvas_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) + { + var left = Canvas.GetLeft(LayoutRoot); + if (_viewMoved) + return; + if (Math.Abs(initialPosition - left) < 100) + { + //bouncing back + MoveViewWindow(initialPosition); + return; + } + //change of state + if (initialPosition - left > 0) + { + //slide to the left + if (initialPosition > -420) + { + MoveViewWindow(-420); + Blurer.Visibility = System.Windows.Visibility.Collapsed; + } + } + else + { + //slide to the right + if (initialPosition< -420) + MoveViewWindow(-420); + Blurer.Visibility = System.Windows.Visibility.Collapsed; + + } + + } + #endregion + #region AppBar + private void MultiSelect_Click(object sender, RoutedEventArgs e) + { + + } + private void NewFolder_Click(object sender, RoutedEventArgs e) + { + + } + private void Settings_Click(object sender, EventArgs e) + { + settings.IsOpen = true; + ApplicationBar.IsVisible = false; + } + #endregion + #region FileLister + async public void StateHelper() + { + ExternalStorageDevice sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault(); + if (sdCard != null) + { + ExternalStorageFolder sdrootFolder = sdCard.RootFolder; + tempFolder = sdrootFolder; + var folder = await sdrootFolder.GetFoldersAsync(); + var files = await sdrootFolder.GetFilesAsync(); + fileHeader.Text = "sdroot"; + fileUrl.Text = " "; + foreach (ExternalStorageFolder currentChildFolder in folder) + { + l.Add(new sdlist(currentChildFolder.Name, "/Resources/Assets/Images/folder.png")); + } + foreach (ExternalStorageFile currentChildFile in files) + { + if (currentChildFile.Name.EndsWith(".pdf")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/pdf.png")); + if (currentChildFile.Name.EndsWith(".svg")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/svg.png")); + if (currentChildFile.Name.EndsWith(".mkv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/mkv.png")); + if (currentChildFile.Name.EndsWith(".rar")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/rar.png")); + if (currentChildFile.Name.EndsWith(".csv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/csv.png")); + if (currentChildFile.Name.EndsWith(".avi")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/avi.png")); + if (currentChildFile.Name.EndsWith(".7z")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/7z.png")); + } + sdlists.ItemsSource = null; + sdlists.ItemsSource = l; + } + + else + { + nosd.Visibility = System.Windows.Visibility.Visible; + } + } + async private void folderTap_Click(object sender, System.Windows.Input.GestureEventArgs e) + { + Grid grd = (Grid)sender; + TextBlock txt = (TextBlock)grd.FindName("folderTap"); + btns = txt.Text; + fileHeader.Text = btns; + if (btns.EndsWith(".7z") || btns.EndsWith(".avi") || btns.EndsWith(".mkv")) + { + if (btns.EndsWith(".7z")) + { + MessageBox.Show("It's a 7-zip File"); + } + if (btns.EndsWith(".avi")) + { + MessageBox.Show("It's a avi File"); + } + if (btns.EndsWith(".mkv")) + { + MessageBox.Show("It's a mkv File"); + } + } + else + { + var tempFolders = await tempFolder.GetFoldersAsync(); + foreach (ExternalStorageFolder subTemp in tempFolders) + { + if (btns == subTemp.Name) + { + tempFolder = subTemp; + var subTemps = await subTemp.GetFoldersAsync(); + var files = await subTemp.GetFilesAsync(); + l.Clear(); + fileUrl.Text = subTemp.Path; + //l.Add(new sdlist("back", "/Resources/Assets/Images/back.png")); + foreach (ExternalStorageFolder folder in subTemps) + { + l.Add(new sdlist(folder.Name, "/Resources/Assets/Images/folder.png")); + } + foreach (ExternalStorageFile currentChildFile in files) + { + if (currentChildFile.Name.EndsWith(".pdf")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/pdf.png")); + if (currentChildFile.Name.EndsWith(".svg")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/svg.png")); + if (currentChildFile.Name.EndsWith(".mkv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/mkv.png")); + if (currentChildFile.Name.EndsWith(".rar")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/rar.png")); + if (currentChildFile.Name.EndsWith(".csv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/csv.png")); + if (currentChildFile.Name.EndsWith(".avi")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/avi.png")); + if (currentChildFile.Name.EndsWith(".7z")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/7z.png")); + } + } + } + } + sdlists.ItemsSource = null; + sdlists.ItemsSource = l; + } + #endregion + #region Video + async public void VideoLister(object sender, System.Windows.Input.GestureEventArgs e) + { + oneFill.Fill = null; + fileHeader.Text = "videos"; + Blurer.Visibility = System.Windows.Visibility.Collapsed; + //HomeBrush.ImageSource = new BitmapImage(new Uri("pack://application:/Resources/Assets/Images/Video.png", UriKind.Absolute)); + ExternalStorageDevice sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault(); + if (sdCard != null) + { + ExternalStorageFolder sdrootFolder = sdCard.RootFolder; + tempFolder = sdrootFolder; + var folder = await sdrootFolder.GetFoldersAsync(); + l.Clear(); + foreach (ExternalStorageFolder currentChildFolder in folder) + { + var files = await currentChildFolder.GetFilesAsync(); + foreach (ExternalStorageFile currentChildFile in files) + { + if (currentChildFile.Name.EndsWith(".avi")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/avi.png")); + if (currentChildFile.Name.EndsWith(".mkv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/mkv.png")); + } + var folderss = await currentChildFolder.GetFoldersAsync(); + foreach (ExternalStorageFolder currentChildFolder2 in folderss) + { + var filess = await currentChildFolder2.GetFilesAsync(); + foreach (ExternalStorageFile currentChildFile in filess) + { + if (currentChildFile.Name.EndsWith(".avi")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/avi.png")); + if (currentChildFile.Name.EndsWith(".mkv")) + l.Add(new sdlist(currentChildFile.Name, "/Resources/Assets/File_Types/mkv.png")); + } + } + + } + + } + + else + { + nosd.Visibility = System.Windows.Visibility.Visible; + + } + List<AlphaKeyGroup<sdlist>> DataSource = AlphaKeyGroup<sdlist>.CreateGroups(l, System.Threading.Thread.CurrentThread.CurrentUICulture, (sdlist s) => { return s.Name; }, true); + sdlists.ItemsSource = DataSource; + } + #endregion + #region PopupPassword + public void PopupPasswordKeyboard() + { + for (int i = 1; i < 10; i++) + { + Button btn = new Button(); + btn.Content = i.ToString(); + btn.Width = 153.3; + btn.Height = 102.5; + btn.BorderBrush = null; + btn.FontSize = 35; + btn.Click += new RoutedEventHandler(Numbers_Click); + wrapPanel.Children.Add(btn); + } + } + + private void Numbers_Click(object sender, RoutedEventArgs e) + { + Button btn = (Button)sender; + if (passwordDisplay.Text.Length < 4) + { + string i = btn.Content.ToString(); + passwordDisplay.Text += i; + if(passwordDisplay.Text == (string)appSettings["PasswordValue"]) + { + passwordDisplay.Text = null; + PasswordAccepter.IsOpen = false; + l.Add(new sdlist("Hidden Folder", "/Resources/Assets/Images/hiddenFolder.png")); + sdlists.ItemsSource = null; + sdlists.ItemsSource = l; + } + + } + else + { + passwordDisplay.Text = null; + PasswordAccepter.IsOpen = false; + } + } + + private void Vault_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e) + { + if ((string)appSettings["Passer"] == "On") + { + PasswordAccepter.IsOpen = true; + ApplicationBar.IsVisible = false; + } + if ((string)appSettings["Passer"] == "Off") + { + l.Add(new sdlist("Hidden Folder", "/Resources/Assets/Images/hiddenFolder.png")); + sdlists.ItemsSource = null; + sdlists.ItemsSource = l; + } + } + private void PopupCancel(object sender, RoutedEventArgs e) + { + PasswordAccepter.IsOpen = false; + } + private void PasswordBackspace(object sender, RoutedEventArgs e) + { + passwordDisplay.Text = null; + } + #endregion + #region LeftSidemenu + private void downloads_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + fileHeader.Text = "downloads"; + fileUrl.Text = "downloads"; + l.Clear(); + List<AlphaKeyGroup<sdlist>> DataSource = AlphaKeyGroup<sdlist>.CreateGroups(l, System.Threading.Thread.CurrentThread.CurrentUICulture, (sdlist s) => { return s.Name; }, true); + sdlists.ItemsSource = DataSource; + MoveViewWindow(-420); + Blurer.Visibility = System.Windows.Visibility.Collapsed; + } + + private void sdcard_menu_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + fileHeader.Text = "sdroot"; + fileUrl.Text = null; + l.Clear(); + StateHelper(); + MoveViewWindow(-420); + sdText.Foreground = App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush; + sdImage.Fill = App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush; + Blurer.Visibility = System.Windows.Visibility.Collapsed; + } + + private void oneFill_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + oneFill.Fill = App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush; + Blurer.Visibility = System.Windows.Visibility.Collapsed; + } + + async private void searchBox_TextChanged(object sender, TextChangedEventArgs e) + { + if (searchBox.Text != null) + { + ExternalStorageDevice sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault(); + ExternalStorageFolder sdrootFolder = sdCard.RootFolder; + tempFolder = sdrootFolder; + var folder = await sdrootFolder.GetFoldersAsync(); + foreach (ExternalStorageFolder currentChildFolder in folder) + { + var files = await currentChildFolder.GetFilesAsync(); + foreach (ExternalStorageFile currentChildFile in files) + { + l.Clear(); + if (currentChildFile.Name.EndsWith(searchBox.Text)) + l.Add(new sdlist(searchBox.Text, "/Resources/Assets/Images/folder.png")); + } + } + sdlists.ItemsSource = l; + } + } + #endregion + #region RightMenu + #endregion + #region Music + + private void MusicDisplay() + { + try + { + if (MediaPlayer.State == MediaState.Playing) + { + songName.Text = MediaPlayer.Queue.ActiveSong.Name; + artistName.Text = (MediaPlayer.Queue.ActiveSong.Artist).ToString(); + ImageBrush im = new ImageBrush(); + im.ImageSource = new BitmapImage(new Uri("pack://application:/Resources/Assets/Images/transport.pause.png", UriKind.Absolute)); + playState.OpacityMask = im; + } + if (MediaPlayer.State == MediaState.Paused) + { + songName.Text = MediaPlayer.Queue.ActiveSong.Name; + artistName.Text = (MediaPlayer.Queue.ActiveSong.Artist).ToString(); + ImageBrush im = new ImageBrush(); + im.ImageSource = new BitmapImage(new Uri("pack://application:/Resources/Assets/Images/transport.play.png", UriKind.Absolute)); + playState.OpacityMask = im; + } + if (MediaPlayer.State == MediaState.Stopped) + { + songName.Text = "No Media"; + artistName.Text = null; + ImageBrush im = new ImageBrush(); + im.ImageSource = new BitmapImage(new Uri("pack://application:/Resources/Assets/Images/transport.play.png", UriKind.Absolute)); + playState.OpacityMask = im; + } + } + catch (Exception) + { + + MessageBox.Show("Error throw!"); + } + } + private void playState_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + if (MediaPlayer.State == MediaState.Playing) + { + + FrameworkDispatcher.Update(); + MediaPlayer.Pause(); + MusicDisplay(); + } + else + { + FrameworkDispatcher.Update(); + MediaPlayer.Resume(); + MusicDisplay(); + } + //if (MediaPlayer.State == MediaState.Stopped) + //{ + // FrameworkDispatcher.Update(); + // MediaLibrary mLibrary = new MediaLibrary(); + // SongCollection songs = mLibrary.Songs; + // MediaPlayer.Play(songs); + // MusicDisplay(); + //} + } + + #endregion + #region Personalisation + private void SideMenuWallChanger_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + WallpaperChanger(new BitmapImage(new Uri("pack://application:/Resources/Assets/Wallpaper/bg2.jpg", UriKind.Absolute))); + } + + private void Wallpaper_Checked(object sender, RoutedEventArgs e) + { + WallpaperTemp.Visibility = Visibility.Visible; + } + + private void Wallpaper_Unchecked(object sender, RoutedEventArgs e) + { + WallpaperTemp.Visibility = Visibility.Collapsed; + } + #endregion + #region Settings + + public async void SettingTap_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + Grid grd = (Grid)sender; + TextBlock txt = (TextBlock)grd.FindName("txtB"); + txts = (txt.Text).ToString(); + if (txts == "about") + { + settings.IsOpen = false; + about.IsOpen = true; + } + + if (txts == "security") + { + settings.IsOpen = false; + security.IsOpen = true; + } + + if (txts == "bluetooth") + { + await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:")); + } + + if (txts == "nfc") + { + MessageBox.Show("coming soon..."); + } + + if (txts == "personalization") + { + //settings.IsOpen = false; + personalization.IsOpen = true; + } + + if (txts == "ftp") + { + NavigationService.Navigate(new Uri("/FTPServerPage.xaml", UriKind.Relative)); + } + if (txts == "music") + { + MessageBox.Show("coming soon..."); + } + } + #endregion + #region Security + + #region ToggleSwitcher + + private void shake_Checked(object sender, RoutedEventArgs e) + { + appSettings["Shaker"] = "On"; + appSettings.Save(); + } + + private void shake_Unchecked(object sender, RoutedEventArgs e) + { + appSettings["Shaker"] = "Off"; + appSettings.Save(); + } + + private void passw_Checked(object sender, RoutedEventArgs e) + { + appSettings["Passer"] = "On"; + } + + private void passw_Unchecked(object sender, RoutedEventArgs e) + { + appSettings["Passer"] = "Off"; + } + + + private void PSetter(object sender, TextChangedEventArgs e) + { + + appSettings["PasswordValue"] = pb.Text; + } + + #endregion + #region SettingsUpdater + + public void Settings_Checker() + { + if ((string)appSettings["Shaker"] == "On") + { + shake.IsChecked = true; + } + + if ((string)appSettings["Shaker"] == "Off") + { + shake.IsChecked = false; + } + + if ((string)appSettings["Passer"] == "On") + { + passw.IsChecked = true; + } + + if ((string)appSettings["Passer"] == "Off") + { + passw.IsChecked = false; + } + } + #endregion + #endregion + #region BackButtonPress + protected override void OnBackKeyPress(CancelEventArgs e) + { + if (PasswordAccepter.IsOpen == true) + { + e.Cancel = true; + PasswordAccepter.IsOpen = false; + ApplicationBar.IsVisible = true; + } + if (fileUrl.Text != " ") + { + e.Cancel = true; + StateHelper(); + } + if (settings.IsOpen == true) + { + e.Cancel = true; + settings.IsOpen = false; + ApplicationBar.IsVisible = true; + } + if (about.IsOpen == true) + { + e.Cancel = true; + about.IsOpen = false; + settings.IsOpen = true; + } + if (personalization.IsOpen == true) + { + e.Cancel = true; + personalization.IsOpen = false; + settings.IsOpen = true; + } + if (security.IsOpen == true) + { + e.Cancel = true; + security.IsOpen = false; + settings.IsOpen = true; + } + else + {} + } + #endregion + } +} +\ No newline at end of file diff --git a/File360/Properties/AppManifest.xml b/File360/Properties/AppManifest.xml @@ -0,0 +1,5 @@ +<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Deployment.Parts> + </Deployment.Parts> +</Deployment> diff --git a/File360/Properties/AssemblyInfo.cs b/File360/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("File360")] +[assembly: AssemblyDescription("Best File Manager for Windows Phone 8.0")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("AMI")] +[assembly: AssemblyProduct("File360")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("AMI")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9d7b1f07-3c45-4014-baca-2741880a5f97")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/File360/Properties/WMAppManifest.xml b/File360/Properties/WMAppManifest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0"> + <DefaultLanguage xmlns="" code="en-US" /> + <App xmlns="" ProductID="{12dbcdd7-c235-40e7-b8fd-71e8074350bd}" Title="File360" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="File360 author" Description="Sample description" Publisher="File360" PublisherID="{28733bbf-6cf5-4fb4-b91a-c7b8ef0434d6}"> + <IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath> + <Capabilities> + <Capability Name="ID_CAP_NETWORKING" /> + <Capability Name="ID_CAP_MEDIALIB_AUDIO" /> + <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" /> + <Capability Name="ID_CAP_SENSORS" /> + <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" /> + <Capability Name="ID_CAP_REMOVABLE_STORAGE" /> + </Capabilities> + <Tasks> + <DefaultTask Name="_default" NavigationPage="MainPage.xaml" /> + </Tasks> + <Tokens> + <PrimaryToken TokenID="File360Token" TaskName="_default"> + <TemplateFlip> + <SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI> + <Count>0</Count> + <BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI> + <Title>File360</Title> + <BackContent> + </BackContent> + <BackBackgroundImageURI> + </BackBackgroundImageURI> + <BackTitle> + </BackTitle> + <DeviceLockImageURI> + </DeviceLockImageURI> + <HasLarge> + </HasLarge> + </TemplateFlip> + </PrimaryToken> + </Tokens> + <ScreenResolutions> + <ScreenResolution Name="ID_RESOLUTION_WVGA" /> + <ScreenResolution Name="ID_RESOLUTION_WXGA" /> + <ScreenResolution Name="ID_RESOLUTION_HD720P" /> + </ScreenResolutions> + </App> +</Deployment> +\ No newline at end of file diff --git a/File360/README_FIRST.txt b/File360/README_FIRST.txt @@ -0,0 +1,3 @@ +For the Windows Phone toolkit make sure that you have +marked the icons in the "Toolkit.Content" folder as content. That way they +can be used as the icons for the ApplicationBar control. +\ No newline at end of file diff --git a/File360/Resources/AppResources.Designer.cs b/File360/Resources/AppResources.Designer.cs @@ -0,0 +1,153 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace File360.Resources { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class AppResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal AppResources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("File360.Resources.AppResources", typeof(AppResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to add. + /// </summary> + public static string AppBarButtonText { + get { + return ResourceManager.GetString("AppBarButtonText", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Menu Item. + /// </summary> + public static string AppBarMenuItemText { + get { + return ResourceManager.GetString("AppBarMenuItemText", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to FILE360°. + /// </summary> + public static string ApplicationTitle { + get { + return ResourceManager.GetString("ApplicationTitle", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to flase. + /// </summary> + public static string False { + get { + return ResourceManager.GetString("False", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to 1234. + /// </summary> + public static string Password { + get { + return ResourceManager.GetString("Password", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to LeftToRight. + /// </summary> + public static string ResourceFlowDirection { + get { + return ResourceManager.GetString("ResourceFlowDirection", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to en-US. + /// </summary> + public static string ResourceLanguage { + get { + return ResourceManager.GetString("ResourceLanguage", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Sample Runtime Property Value. + /// </summary> + public static string SampleProperty { + get { + return ResourceManager.GetString("SampleProperty", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to G. + /// </summary> + public static string tamil { + get { + return ResourceManager.GetString("tamil", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to true. + /// </summary> + public static string True { + get { + return ResourceManager.GetString("True", resourceCulture); + } + } + } +} diff --git a/File360/Resources/AppResources.resx b/File360/Resources/AppResources.resx @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="ResourceFlowDirection" xml:space="preserve"> + <value>LeftToRight</value> + <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment> + </data> + <data name="ResourceLanguage" xml:space="preserve"> + <value>en-US</value> + <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment> + </data> + <data name="ApplicationTitle" xml:space="preserve"> + <value>FILE360°</value> + </data> + <data name="SampleProperty" xml:space="preserve"> + <value>Sample Runtime Property Value</value> + </data> + <data name="AppBarButtonText" xml:space="preserve"> + <value>add</value> + </data> + <data name="AppBarMenuItemText" xml:space="preserve"> + <value>Menu Item</value> + </data> + <data name="Password" xml:space="preserve"> + <value>1234</value> + </data> + <data name="True" xml:space="preserve"> + <value>true</value> + <comment>Use as Boolean to check "shake to hide"</comment> + </data> + <data name="False" xml:space="preserve"> + <value>flase</value> + </data> + <data name="tamil" xml:space="preserve"> + <value>G</value> + </data> +</root> +\ No newline at end of file diff --git a/File360/Resources/AppResources.ta.resx b/File360/Resources/AppResources.ta.resx @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="ResourceFlowDirection" xml:space="preserve"> + <value>LeftToRight</value> + <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment> + </data> + <data name="ResourceLanguage" xml:space="preserve"> + <value>ta</value> + <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment> + </data> + <data name="ApplicationTitle" xml:space="preserve"> + <value>FILE360°</value> + </data> + <data name="SampleProperty" xml:space="preserve"> + <value>Sample Runtime Property Value</value> + </data> + <data name="AppBarButtonText" xml:space="preserve"> + <value>add</value> + </data> + <data name="AppBarMenuItemText" xml:space="preserve"> + <value>Menu Item</value> + </data> + <data name="Password" xml:space="preserve"> + <value>1234</value> + </data> + <data name="True" xml:space="preserve"> + <value>true</value> + <comment>Use as Boolean to check "shake to hide"</comment> + </data> + <data name="False" xml:space="preserve"> + <value>flase</value> + </data> +</root> +\ No newline at end of file diff --git a/File360/Resources/Assets/AlignmentGrid.png b/File360/Resources/Assets/AlignmentGrid.png Binary files differ. diff --git a/File360/Resources/Assets/ApplicationIcon.png b/File360/Resources/Assets/ApplicationIcon.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/7z.png b/File360/Resources/Assets/File_Types/7z.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/avi.png b/File360/Resources/Assets/File_Types/avi.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/csv.png b/File360/Resources/Assets/File_Types/csv.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/mkv.png b/File360/Resources/Assets/File_Types/mkv.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/pdf.png b/File360/Resources/Assets/File_Types/pdf.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/rar.png b/File360/Resources/Assets/File_Types/rar.png Binary files differ. diff --git a/File360/Resources/Assets/File_Types/svg.png b/File360/Resources/Assets/File_Types/svg.png Binary files differ. diff --git a/File360/Resources/Assets/Images/Fine-Halftone-Screen-Small.png b/File360/Resources/Assets/Images/Fine-Halftone-Screen-Small.png Binary files differ. diff --git a/File360/Resources/Assets/Images/MusicBar.png b/File360/Resources/Assets/Images/MusicBar.png Binary files differ. diff --git a/File360/Resources/Assets/Images/Search.png b/File360/Resources/Assets/Images/Search.png Binary files differ. diff --git a/File360/Resources/Assets/Images/back.png b/File360/Resources/Assets/Images/back.png Binary files differ. diff --git a/File360/Resources/Assets/Images/basecircle.png b/File360/Resources/Assets/Images/basecircle.png Binary files differ. diff --git a/File360/Resources/Assets/Images/collage_music.png b/File360/Resources/Assets/Images/collage_music.png Binary files differ. diff --git a/File360/Resources/Assets/Images/coverArt.png b/File360/Resources/Assets/Images/coverArt.png Binary files differ. diff --git a/File360/Resources/Assets/Images/delete.png b/File360/Resources/Assets/Images/delete.png Binary files differ. diff --git a/File360/Resources/Assets/Images/down.png b/File360/Resources/Assets/Images/down.png Binary files differ. diff --git a/File360/Resources/Assets/Images/download.png b/File360/Resources/Assets/Images/download.png Binary files differ. diff --git a/File360/Resources/Assets/Images/edit.png b/File360/Resources/Assets/Images/edit.png Binary files differ. diff --git a/File360/Resources/Assets/Images/favs.png b/File360/Resources/Assets/Images/favs.png Binary files differ. diff --git a/File360/Resources/Assets/Images/feature.settings.png b/File360/Resources/Assets/Images/feature.settings.png Binary files differ. diff --git a/File360/Resources/Assets/Images/folder.png b/File360/Resources/Assets/Images/folder.png Binary files differ. diff --git a/File360/Resources/Assets/Images/go.png b/File360/Resources/Assets/Images/go.png Binary files differ. diff --git a/File360/Resources/Assets/Images/gradient_music.png b/File360/Resources/Assets/Images/gradient_music.png Binary files differ. diff --git a/File360/Resources/Assets/Images/grid.png b/File360/Resources/Assets/Images/grid.png Binary files differ. diff --git a/File360/Resources/Assets/Images/hamburger.png b/File360/Resources/Assets/Images/hamburger.png Binary files differ. diff --git a/File360/Resources/Assets/Images/headphone.png b/File360/Resources/Assets/Images/headphone.png Binary files differ. diff --git a/File360/Resources/Assets/Images/hiddenFolder.png b/File360/Resources/Assets/Images/hiddenFolder.png Binary files differ. diff --git a/File360/Resources/Assets/Images/like.png b/File360/Resources/Assets/Images/like.png Binary files differ. diff --git a/File360/Resources/Assets/Images/list.png b/File360/Resources/Assets/Images/list.png Binary files differ. diff --git a/File360/Resources/Assets/Images/microphone.png b/File360/Resources/Assets/Images/microphone.png Binary files differ. diff --git a/File360/Resources/Assets/Images/mute.png b/File360/Resources/Assets/Images/mute.png Binary files differ. diff --git a/File360/Resources/Assets/Images/next.png b/File360/Resources/Assets/Images/next.png Binary files differ. diff --git a/File360/Resources/Assets/Images/onedrive.png b/File360/Resources/Assets/Images/onedrive.png Binary files differ. diff --git a/File360/Resources/Assets/Images/phone.png b/File360/Resources/Assets/Images/phone.png Binary files differ. diff --git a/File360/Resources/Assets/Images/previous.png b/File360/Resources/Assets/Images/previous.png Binary files differ. diff --git a/File360/Resources/Assets/Images/repeat.png b/File360/Resources/Assets/Images/repeat.png Binary files differ. diff --git a/File360/Resources/Assets/Images/sdcard.png b/File360/Resources/Assets/Images/sdcard.png Binary files differ. diff --git a/File360/Resources/Assets/Images/settings_light.png b/File360/Resources/Assets/Images/settings_light.png Binary files differ. diff --git a/File360/Resources/Assets/Images/share.png b/File360/Resources/Assets/Images/share.png Binary files differ. diff --git a/File360/Resources/Assets/Images/shuffle.png b/File360/Resources/Assets/Images/shuffle.png Binary files differ. diff --git a/File360/Resources/Assets/Images/skydrive.png b/File360/Resources/Assets/Images/skydrive.png Binary files differ. diff --git a/File360/Resources/Assets/Images/slide_circle.png b/File360/Resources/Assets/Images/slide_circle.png Binary files differ. diff --git a/File360/Resources/Assets/Images/transport.ff.png b/File360/Resources/Assets/Images/transport.ff.png Binary files differ. diff --git a/File360/Resources/Assets/Images/transport.pause.png b/File360/Resources/Assets/Images/transport.pause.png Binary files differ. diff --git a/File360/Resources/Assets/Images/transport.play.png b/File360/Resources/Assets/Images/transport.play.png Binary files differ. diff --git a/File360/Resources/Assets/Images/transport.rew.png b/File360/Resources/Assets/Images/transport.rew.png Binary files differ. diff --git a/File360/Resources/Assets/Images/up.png b/File360/Resources/Assets/Images/up.png Binary files differ. diff --git a/File360/Resources/Assets/Images/upload.png b/File360/Resources/Assets/Images/upload.png Binary files differ. diff --git a/File360/Resources/Assets/Images/user.png b/File360/Resources/Assets/Images/user.png Binary files differ. diff --git a/File360/Resources/Assets/Images/vinyl.png b/File360/Resources/Assets/Images/vinyl.png Binary files differ. diff --git a/File360/Resources/Assets/Images/volume_high.png b/File360/Resources/Assets/Images/volume_high.png Binary files differ. diff --git a/File360/Resources/Assets/Images/volume_low.png b/File360/Resources/Assets/Images/volume_low.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/about.png b/File360/Resources/Assets/Settings/about.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/bluetooth.png b/File360/Resources/Assets/Settings/bluetooth.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/ftp.png b/File360/Resources/Assets/Settings/ftp.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/music.png b/File360/Resources/Assets/Settings/music.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/nfc.png b/File360/Resources/Assets/Settings/nfc.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/personalization.png b/File360/Resources/Assets/Settings/personalization.png Binary files differ. diff --git a/File360/Resources/Assets/Settings/security.png b/File360/Resources/Assets/Settings/security.png Binary files differ. diff --git a/File360/Resources/Assets/Tiles/FlipCycleTileLarge.png b/File360/Resources/Assets/Tiles/FlipCycleTileLarge.png Binary files differ. diff --git a/File360/Resources/Assets/Tiles/FlipCycleTileMedium.png b/File360/Resources/Assets/Tiles/FlipCycleTileMedium.png Binary files differ. diff --git a/File360/Resources/Assets/Tiles/FlipCycleTileSmall.png b/File360/Resources/Assets/Tiles/FlipCycleTileSmall.png Binary files differ. diff --git a/File360/Resources/Assets/Tiles/IconicTileMediumLarge.png b/File360/Resources/Assets/Tiles/IconicTileMediumLarge.png Binary files differ. diff --git a/File360/Resources/Assets/Tiles/IconicTileSmall.png b/File360/Resources/Assets/Tiles/IconicTileSmall.png Binary files differ. diff --git a/File360/Resources/Assets/Wallpaper/bg1.jpg b/File360/Resources/Assets/Wallpaper/bg1.jpg Binary files differ. diff --git a/File360/Resources/Assets/Wallpaper/bg2.jpg b/File360/Resources/Assets/Wallpaper/bg2.jpg Binary files differ. diff --git a/File360/SecurityPage.xaml b/File360/SecurityPage.xaml @@ -0,0 +1,32 @@ +<phone:PhoneApplicationPage + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" + x:Class="File360.SecurityPage" + FontFamily="{StaticResource PhoneFontFamilyNormal}" + FontSize="{StaticResource PhoneFontSizeNormal}" + Foreground="{StaticResource PhoneForegroundBrush}" + SupportedOrientations="Portrait" Orientation="Portrait" + mc:Ignorable="d" + shell:SystemTray.IsVisible="True"> + + <!--LayoutRoot is the root grid where all page content is placed--> + <Grid Background="Transparent"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <phone:Pivot HorizontalAlignment="Left" Height="768" Title="FILE360°" VerticalAlignment="Top" Width="480" Grid.RowSpan="2"> + <phone:PivotItem CacheMode="{x:Null}" Header="security"></phone:PivotItem> + </phone:Pivot> + + <toolkit:ToggleSwitch x:Name="passw" Checked="passw_Checked" Unchecked="passw_Unchecked" HorizontalAlignment="Left" Margin="10,157,0,0" Grid.Row="1" VerticalAlignment="Top" Width="460" Content="password"/> + <toolkit:ToggleSwitch x:Name="shake" Checked="shake_Checked" Unchecked="shake_Unchecked" HorizontalAlignment="Left" Margin="10,265,0,0" Grid.Row="1" VerticalAlignment="Top" Width="460" Content="shake to hide"/> + <TextBox x:Name="pb" HorizontalAlignment="Left" Height="84" Margin="10,368,0,0" Grid.RowSpan="2" TextWrapping="Wrap" VerticalAlignment="Top" Width="460" TextChanged="PSetter" Foreground="{StaticResource PhoneBackgroundBrush}" SelectionBackground="{x:Null}" SelectionForeground="{x:Null}"/> + </Grid> + +</phone:PhoneApplicationPage> +\ No newline at end of file diff --git a/File360/SecurityPage.xaml.cs b/File360/SecurityPage.xaml.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using Microsoft.Devices.Sensors; +using File360.Resources; +using System.IO.IsolatedStorage; +using System.Windows.Media; +using System.Windows.Input; + +namespace File360 +{ + public partial class SecurityPage : PhoneApplicationPage + { + IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; + public SecurityPage() + { + InitializeComponent(); + if (!Accelerometer.IsSupported) + { + shake.IsEnabled = false; + } + Settings_Checker(); + } + + #region ToggleSwitcher + + private void shake_Checked(object sender, RoutedEventArgs e) + { + appSettings["Shaker"] = "On"; + appSettings.Save(); + } + + private void shake_Unchecked(object sender, RoutedEventArgs e) + { + appSettings["Shaker"] = "Off"; + appSettings.Save(); + } + + private void passw_Checked(object sender, RoutedEventArgs e) + { + appSettings["Passer"] = "On"; + } + + private void passw_Unchecked(object sender, RoutedEventArgs e) + { + appSettings["Passer"] = "Off"; + } + + + private void PSetter(object sender, TextChangedEventArgs e) + { + + appSettings["PasswordValue"] = pb.Text; + } + + #endregion + #region SettingsUpdater + + public void Settings_Checker() + { + if ((string)appSettings["Shaker"] == "On") + { + shake.IsChecked = true; + } + + if ((string)appSettings["Shaker"] == "Off") + { + shake.IsChecked = false; + } + + if ((string)appSettings["Passer"] == "On") + { + passw.IsChecked = true; + } + + if ((string)appSettings["Passer"] == "Off") + { + passw.IsChecked = false; + } + } + #endregion + } +} diff --git a/File360/SplashScreenImage.jpg b/File360/SplashScreenImage.jpg Binary files differ. diff --git a/File360/TiltEffect.cs b/File360/TiltEffect.cs @@ -0,0 +1,648 @@ +/* + Copyright (c) 2010 Microsoft Corporation. All rights reserved. + Use of this sample source code is subject to the terms of the Microsoft license + agreement under which you licensed this sample source code and is provided AS-IS. + If you did not accept the terms of the license agreement, you are not authorized + to use this sample source code. For the terms of the license, please see the + license agreement between you and Microsoft. +*/ + + +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Collections.Generic; +using System.Windows.Controls.Primitives; + + +#if WINDOWS_PHONE +using Microsoft.Phone.Controls; +#endif + +namespace File360 +{ + /// <summary> + /// This code provides attached properties for adding a 'tilt' effect to all controls within a container. + /// </summary> + public class TiltEffect : DependencyObject + { + + #region Constructor and Static Constructor + /// <summary> + /// This is not a constructable class, but it cannot be static because it derives from DependencyObject. + /// </summary> + private TiltEffect() + { + } + + /// <summary> + /// Initialize the static properties + /// </summary> + static TiltEffect() + { + // The tiltable items list. + TiltableItems = new List<Type>() { typeof(ButtonBase), typeof(ListBoxItem), }; + UseLogarithmicEase = false; + } + + #endregion + + + #region Fields and simple properties + + // These constants are the same as the built-in effects + /// <summary> + /// Maximum amount of tilt, in radians + /// </summary> + const double MaxAngle = 0.3; + + /// <summary> + /// Maximum amount of depression, in pixels + /// </summary> + const double MaxDepression = 25; + + /// <summary> + /// Delay between releasing an element and the tilt release animation playing + /// </summary> + static readonly TimeSpan TiltReturnAnimationDelay = TimeSpan.FromMilliseconds(200); + + /// <summary> + /// Duration of tilt release animation + /// </summary> + static readonly TimeSpan TiltReturnAnimationDuration = TimeSpan.FromMilliseconds(100); + + /// <summary> + /// The control that is currently being tilted + /// </summary> + static FrameworkElement currentTiltElement; + + /// <summary> + /// The single instance of a storyboard used for all tilts + /// </summary> + static Storyboard tiltReturnStoryboard; + + /// <summary> + /// The single instance of an X rotation used for all tilts + /// </summary> + static DoubleAnimation tiltReturnXAnimation; + + /// <summary> + /// The single instance of a Y rotation used for all tilts + /// </summary> + static DoubleAnimation tiltReturnYAnimation; + + /// <summary> + /// The single instance of a Z depression used for all tilts + /// </summary> + static DoubleAnimation tiltReturnZAnimation; + + /// <summary> + /// The center of the tilt element + /// </summary> + static Point currentTiltElementCenter; + + /// <summary> + /// Whether the animation just completed was for a 'pause' or not + /// </summary> + static bool wasPauseAnimation = false; + + /// <summary> + /// Whether to use a slightly more accurate (but slightly slower) tilt animation easing function + /// </summary> + public static bool UseLogarithmicEase { get; set; } + + /// <summary> + /// Default list of items that are tiltable + /// </summary> + public static List<Type> TiltableItems { get; private set; } + + #endregion + + + #region Dependency properties + + /// <summary> + /// Whether the tilt effect is enabled on a container (and all its children) + /// </summary> + public static readonly DependencyProperty IsTiltEnabledProperty = DependencyProperty.RegisterAttached( + "IsTiltEnabled", + typeof(bool), + typeof(TiltEffect), + new PropertyMetadata(OnIsTiltEnabledChanged) + ); + + /// <summary> + /// Gets the IsTiltEnabled dependency property from an object + /// </summary> + /// <param name="source">The object to get the property from</param> + /// <returns>The property's value</returns> + public static bool GetIsTiltEnabled(DependencyObject source) { return (bool)source.GetValue(IsTiltEnabledProperty); } + + /// <summary> + /// Sets the IsTiltEnabled dependency property on an object + /// </summary> + /// <param name="source">The object to set the property on</param> + /// <param name="value">The value to set</param> + public static void SetIsTiltEnabled(DependencyObject source, bool value) { source.SetValue(IsTiltEnabledProperty, value); } + + /// <summary> + /// Suppresses the tilt effect on a single control that would otherwise be tilted + /// </summary> + public static readonly DependencyProperty SuppressTiltProperty = DependencyProperty.RegisterAttached( + "SuppressTilt", + typeof(bool), + typeof(TiltEffect), + null + ); + + /// <summary> + /// Gets the SuppressTilt dependency property from an object + /// </summary> + /// <param name="source">The object to get the property from</param> + /// <returns>The property's value</returns> + public static bool GetSuppressTilt(DependencyObject source) { return (bool)source.GetValue(SuppressTiltProperty); } + + /// <summary> + /// Sets the SuppressTilt dependency property from an object + /// </summary> + /// <param name="source">The object to get the property from</param> + /// <returns>The property's value</returns> + public static void SetSuppressTilt(DependencyObject source, bool value) { source.SetValue(SuppressTiltProperty, value); } + + + /// <summary> + /// Property change handler for the IsTiltEnabled dependency property + /// </summary> + /// <param name="target">The element that the property is atteched to</param> + /// <param name="args">Event args</param> + /// <remarks> + /// Adds or removes event handlers from the element that has been (un)registered for tilting + /// </remarks> + static void OnIsTiltEnabledChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) + { + if (target is FrameworkElement) + { + // Add / remove the event handler if necessary + if ((bool)args.NewValue == true) + { + (target as FrameworkElement).ManipulationStarted += TiltEffect_ManipulationStarted; + } + else + { + (target as FrameworkElement).ManipulationStarted -= TiltEffect_ManipulationStarted; + } + } + } + + #endregion + + + #region Top-level manipulation event handlers + + /// <summary> + /// Event handler for ManipulationStarted + /// </summary> + /// <param name="sender">sender of the event - this will be the tilt container (eg, entire page)</param> + /// <param name="e">event args</param> + static void TiltEffect_ManipulationStarted(object sender, ManipulationStartedEventArgs e) + { + + TryStartTiltEffect(sender as FrameworkElement, e); + } + + /// <summary> + /// Event handler for ManipulationDelta + /// </summary> + /// <param name="sender">sender of the event - this will be the tilting object (eg a button)</param> + /// <param name="e">event args</param> + static void TiltEffect_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) + { + + ContinueTiltEffect(sender as FrameworkElement, e); + } + + /// <summary> + /// Event handler for ManipulationCompleted + /// </summary> + /// <param name="sender">sender of the event - this will be the tilting object (eg a button)</param> + /// <param name="e">event args</param> + static void TiltEffect_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) + { + + EndTiltEffect(currentTiltElement); + } + + #endregion + + + #region Core tilt logic + + /// <summary> + /// Checks if the manipulation should cause a tilt, and if so starts the tilt effect + /// </summary> + /// <param name="source">The source of the manipulation (the tilt container, eg entire page)</param> + /// <param name="e">The args from the ManipulationStarted event</param> + static void TryStartTiltEffect(FrameworkElement source, ManipulationStartedEventArgs e) + { + foreach (FrameworkElement ancestor in (e.OriginalSource as FrameworkElement).GetVisualAncestors()) + { + foreach (Type t in TiltableItems) + { + if (t.IsAssignableFrom(ancestor.GetType())) + { + if ((bool)ancestor.GetValue(SuppressTiltProperty) != true) + { + // Use first child of the control, so that you can add transforms and not + // impact any transforms on the control itself + FrameworkElement element = VisualTreeHelper.GetChild(ancestor, 0) as FrameworkElement; + FrameworkElement container = e.ManipulationContainer as FrameworkElement; + + if (element == null || container == null) + return; + + // Touch point relative to the element being tilted + Point tiltTouchPoint = container.TransformToVisual(element).Transform(e.ManipulationOrigin); + + // Center of the element being tilted + Point elementCenter = new Point(element.ActualWidth / 2, element.ActualHeight / 2); + + // Camera adjustment + Point centerToCenterDelta = GetCenterToCenterDelta(element, source); + + BeginTiltEffect(element, tiltTouchPoint, elementCenter, centerToCenterDelta); + return; + } + } + } + } + } + + /// <summary> + /// Computes the delta between the centre of an element and its container + /// </summary> + /// <param name="element">The element to compare</param> + /// <param name="container">The element to compare against</param> + /// <returns>A point that represents the delta between the two centers</returns> + static Point GetCenterToCenterDelta(FrameworkElement element, FrameworkElement container) + { + Point elementCenter = new Point(element.ActualWidth / 2, element.ActualHeight / 2); + Point containerCenter; + +#if WINDOWS_PHONE + + // Need to special-case the frame to handle different orientations + if (container is PhoneApplicationFrame) + { + PhoneApplicationFrame frame = container as PhoneApplicationFrame; + + // Switch width and height in landscape mode + if ((frame.Orientation & PageOrientation.Landscape) == PageOrientation.Landscape) + { + + containerCenter = new Point(container.ActualHeight / 2, container.ActualWidth / 2); + } + else + containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2); + } + else + containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2); +#else + + containerCenter = new Point(container.ActualWidth / 2, container.ActualHeight / 2); + +#endif + + Point transformedElementCenter = element.TransformToVisual(container).Transform(elementCenter); + Point result = new Point(containerCenter.X - transformedElementCenter.X, containerCenter.Y - transformedElementCenter.Y); + + return result; + } + + /// <summary> + /// Begins the tilt effect by preparing the control and doing the initial animation + /// </summary> + /// <param name="element">The element to tilt </param> + /// <param name="touchPoint">The touch point, in element coordinates</param> + /// <param name="centerPoint">The center point of the element in element coordinates</param> + /// <param name="centerDelta">The delta between the <paramref name="element"/>'s center and + /// the container's center</param> + static void BeginTiltEffect(FrameworkElement element, Point touchPoint, Point centerPoint, Point centerDelta) + { + + + if (tiltReturnStoryboard != null) + StopTiltReturnStoryboardAndCleanup(); + + if (PrepareControlForTilt(element, centerDelta) == false) + return; + + currentTiltElement = element; + currentTiltElementCenter = centerPoint; + PrepareTiltReturnStoryboard(element); + + ApplyTiltEffect(currentTiltElement, touchPoint, currentTiltElementCenter); + } + + /// <summary> + /// Prepares a control to be tilted by setting up a plane projection and some event handlers + /// </summary> + /// <param name="element">The control that is to be tilted</param> + /// <param name="centerDelta">Delta between the element's center and the tilt container's</param> + /// <returns>true if successful; false otherwise</returns> + /// <remarks> + /// This method is conservative; it will fail any attempt to tilt a control that already + /// has a projection on it + /// </remarks> + static bool PrepareControlForTilt(FrameworkElement element, Point centerDelta) + { + // Prevents interference with any existing transforms + if (element.Projection != null || (element.RenderTransform != null && element.RenderTransform.GetType() != typeof(MatrixTransform))) + return false; + + TranslateTransform transform = new TranslateTransform(); + transform.X = centerDelta.X; + transform.Y = centerDelta.Y; + element.RenderTransform = transform; + + PlaneProjection projection = new PlaneProjection(); + projection.GlobalOffsetX = -1 * centerDelta.X; + projection.GlobalOffsetY = -1 * centerDelta.Y; + element.Projection = projection; + + element.ManipulationDelta += TiltEffect_ManipulationDelta; + element.ManipulationCompleted += TiltEffect_ManipulationCompleted; + + return true; + } + + /// <summary> + /// Removes modifications made by PrepareControlForTilt + /// </summary> + /// <param name="element">THe control to be un-prepared</param> + /// <remarks> + /// This method is basic; it does not do anything to detect if the control being un-prepared + /// was previously prepared + /// </remarks> + static void RevertPrepareControlForTilt(FrameworkElement element) + { + element.ManipulationDelta -= TiltEffect_ManipulationDelta; + element.ManipulationCompleted -= TiltEffect_ManipulationCompleted; + element.Projection = null; + element.RenderTransform = null; + } + + /// <summary> + /// Creates the tilt return storyboard (if not already created) and targets it to the projection + /// </summary> + /// <param name="projection">the projection that should be the target of the animation</param> + static void PrepareTiltReturnStoryboard(FrameworkElement element) + { + + if (tiltReturnStoryboard == null) + { + tiltReturnStoryboard = new Storyboard(); + tiltReturnStoryboard.Completed += TiltReturnStoryboard_Completed; + + tiltReturnXAnimation = new DoubleAnimation(); + Storyboard.SetTargetProperty(tiltReturnXAnimation, new PropertyPath(PlaneProjection.RotationXProperty)); + tiltReturnXAnimation.BeginTime = TiltReturnAnimationDelay; + tiltReturnXAnimation.To = 0; + tiltReturnXAnimation.Duration = TiltReturnAnimationDuration; + + tiltReturnYAnimation = new DoubleAnimation(); + Storyboard.SetTargetProperty(tiltReturnYAnimation, new PropertyPath(PlaneProjection.RotationYProperty)); + tiltReturnYAnimation.BeginTime = TiltReturnAnimationDelay; + tiltReturnYAnimation.To = 0; + tiltReturnYAnimation.Duration = TiltReturnAnimationDuration; + + tiltReturnZAnimation = new DoubleAnimation(); + Storyboard.SetTargetProperty(tiltReturnZAnimation, new PropertyPath(PlaneProjection.GlobalOffsetZProperty)); + tiltReturnZAnimation.BeginTime = TiltReturnAnimationDelay; + tiltReturnZAnimation.To = 0; + tiltReturnZAnimation.Duration = TiltReturnAnimationDuration; + + if (UseLogarithmicEase) + { + tiltReturnXAnimation.EasingFunction = new LogarithmicEase(); + tiltReturnYAnimation.EasingFunction = new LogarithmicEase(); + tiltReturnZAnimation.EasingFunction = new LogarithmicEase(); + } + + tiltReturnStoryboard.Children.Add(tiltReturnXAnimation); + tiltReturnStoryboard.Children.Add(tiltReturnYAnimation); + tiltReturnStoryboard.Children.Add(tiltReturnZAnimation); + } + + Storyboard.SetTarget(tiltReturnXAnimation, element.Projection); + Storyboard.SetTarget(tiltReturnYAnimation, element.Projection); + Storyboard.SetTarget(tiltReturnZAnimation, element.Projection); + } + + + /// <summary> + /// Continues a tilt effect that is currently applied to an element, presumably because + /// the user moved their finger + /// </summary> + /// <param name="element">The element being tilted</param> + /// <param name="e">The manipulation event args</param> + static void ContinueTiltEffect(FrameworkElement element, ManipulationDeltaEventArgs e) + { + FrameworkElement container = e.ManipulationContainer as FrameworkElement; + if (container == null || element == null) + return; + + Point tiltTouchPoint = container.TransformToVisual(element).Transform(e.ManipulationOrigin); + + // If touch moved outside bounds of element, then pause the tilt (but don't cancel it) + if (new Rect(0, 0, currentTiltElement.ActualWidth, currentTiltElement.ActualHeight).Contains(tiltTouchPoint) != true) + { + + PauseTiltEffect(); + return; + } + + // Apply the updated tilt effect + ApplyTiltEffect(currentTiltElement, e.ManipulationOrigin, currentTiltElementCenter); + } + + /// <summary> + /// Ends the tilt effect by playing the animation + /// </summary> + /// <param name="element">The element being tilted</param> + static void EndTiltEffect(FrameworkElement element) + { + if (element != null) + { + element.ManipulationCompleted -= TiltEffect_ManipulationCompleted; + element.ManipulationDelta -= TiltEffect_ManipulationDelta; + } + + if (tiltReturnStoryboard != null) + { + wasPauseAnimation = false; + if (tiltReturnStoryboard.GetCurrentState() != ClockState.Active) + tiltReturnStoryboard.Begin(); + } + else + StopTiltReturnStoryboardAndCleanup(); + } + + /// <summary> + /// Handler for the storyboard complete event + /// </summary> + /// <param name="sender">sender of the event</param> + /// <param name="e">event args</param> + static void TiltReturnStoryboard_Completed(object sender, EventArgs e) + { + if (wasPauseAnimation) + ResetTiltEffect(currentTiltElement); + else + StopTiltReturnStoryboardAndCleanup(); + } + + /// <summary> + /// Resets the tilt effect on the control, making it appear 'normal' again + /// </summary> + /// <param name="element">The element to reset the tilt on</param> + /// <remarks> + /// This method doesn't turn off the tilt effect or cancel any current + /// manipulation; it just temporarily cancels the effect + /// </remarks> + static void ResetTiltEffect(FrameworkElement element) + { + PlaneProjection projection = element.Projection as PlaneProjection; + projection.RotationY = 0; + projection.RotationX = 0; + projection.GlobalOffsetZ = 0; + } + + /// <summary> + /// Stops the tilt effect and release resources applied to the currently-tilted control + /// </summary> + static void StopTiltReturnStoryboardAndCleanup() + { + if (tiltReturnStoryboard != null) + tiltReturnStoryboard.Stop(); + + RevertPrepareControlForTilt(currentTiltElement); + } + + /// <summary> + /// Pauses the tilt effect so that the control returns to the 'at rest' position, but doesn't + /// stop the tilt effect (handlers are still attached, etc.) + /// </summary> + static void PauseTiltEffect() + { + if ((tiltReturnStoryboard != null) && !wasPauseAnimation) + { + tiltReturnStoryboard.Stop(); + wasPauseAnimation = true; + tiltReturnStoryboard.Begin(); + } + } + + /// <summary> + /// Resets the storyboard to not running + /// </summary> + private static void ResetTiltReturnStoryboard() + { + tiltReturnStoryboard.Stop(); + wasPauseAnimation = false; + } + + /// <summary> + /// Applies the tilt effect to the control + /// </summary> + /// <param name="element">the control to tilt</param> + /// <param name="touchPoint">The touch point, in the container's coordinates</param> + /// <param name="centerPoint">The center point of the container</param> + static void ApplyTiltEffect(FrameworkElement element, Point touchPoint, Point centerPoint) + { + // Stop any active animation + ResetTiltReturnStoryboard(); + + // Get relative point of the touch in percentage of container size + Point normalizedPoint = new Point( + Math.Min(Math.Max(touchPoint.X / (centerPoint.X * 2), 0), 1), + Math.Min(Math.Max(touchPoint.Y / (centerPoint.Y * 2), 0), 1)); + + // Shell values + double xMagnitude = Math.Abs(normalizedPoint.X - 0.5); + double yMagnitude = Math.Abs(normalizedPoint.Y - 0.5); + double xDirection = -Math.Sign(normalizedPoint.X - 0.5); + double yDirection = Math.Sign(normalizedPoint.Y - 0.5); + double angleMagnitude = xMagnitude + yMagnitude; + double xAngleContribution = xMagnitude + yMagnitude > 0 ? xMagnitude / (xMagnitude + yMagnitude) : 0; + + double angle = angleMagnitude * MaxAngle * 180 / Math.PI; + double depression = (1 - angleMagnitude) * MaxDepression; + + // RotationX and RotationY are the angles of rotations about the x- or y-*axis*; + // to achieve a rotation in the x- or y-*direction*, we need to swap the two. + // That is, a rotation to the left about the y-axis is a rotation to the left in the x-direction, + // and a rotation up about the x-axis is a rotation up in the y-direction. + PlaneProjection projection = element.Projection as PlaneProjection; + projection.RotationY = angle * xAngleContribution * xDirection; + projection.RotationX = angle * (1 - xAngleContribution) * yDirection; + projection.GlobalOffsetZ = -depression; + } + + #endregion + + + #region Custom easing function + + /// <summary> + /// Provides an easing function for the tilt return + /// </summary> + private class LogarithmicEase : EasingFunctionBase + { + /// <summary> + /// Computes the easing function + /// </summary> + /// <param name="normalizedTime">The time</param> + /// <returns>The eased value</returns> + protected override double EaseInCore(double normalizedTime) + { + return Math.Log(normalizedTime + 1) / 0.693147181; // ln(t + 1) / ln(2) + } + } + + #endregion + } + + /// <summary> + /// Couple of simple helpers for walking the visual tree + /// </summary> + static class TreeHelpers + { + /// <summary> + /// Gets the ancestors of the element, up to the root + /// </summary> + /// <param name="node">The element to start from</param> + /// <returns>An enumerator of the ancestors</returns> + public static IEnumerable<FrameworkElement> GetVisualAncestors(this FrameworkElement node) + { + FrameworkElement parent = node.GetVisualParent(); + while (parent != null) + { + yield return parent; + parent = parent.GetVisualParent(); + } + } + + /// <summary> + /// Gets the visual parent of the element + /// </summary> + /// <param name="node">The element to check</param> + /// <returns>The visual parent</returns> + public static FrameworkElement GetVisualParent(this FrameworkElement node) + { + return VisualTreeHelper.GetParent(node) as FrameworkElement; + } + } +} + diff --git a/File360/Toolkit.Content/ApplicationBar.Add.png b/File360/Toolkit.Content/ApplicationBar.Add.png Binary files differ. diff --git a/File360/Toolkit.Content/ApplicationBar.Cancel.png b/File360/Toolkit.Content/ApplicationBar.Cancel.png Binary files differ. diff --git a/File360/Toolkit.Content/ApplicationBar.Check.png b/File360/Toolkit.Content/ApplicationBar.Check.png Binary files differ. diff --git a/File360/Toolkit.Content/ApplicationBar.Delete.png b/File360/Toolkit.Content/ApplicationBar.Delete.png Binary files differ. diff --git a/File360/Toolkit.Content/ApplicationBar.Select.png b/File360/Toolkit.Content/ApplicationBar.Select.png Binary files differ. diff --git a/File360/Toolkit.Content/ApplicationBar.Sort.png b/File360/Toolkit.Content/ApplicationBar.Sort.png Binary files differ. diff --git a/File360/Toolkit.Content/home.png b/File360/Toolkit.Content/home.png Binary files differ. diff --git a/File360/VideoPlayer.xaml b/File360/VideoPlayer.xaml @@ -0,0 +1,113 @@ +<phone:PhoneApplicationPage + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" + xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" + x:Class="File360.VideoPlayer" + FontFamily="{StaticResource PhoneFontFamilyNormal}" + FontSize="{StaticResource PhoneFontSizeNormal}" + Foreground="{StaticResource PhoneForegroundBrush}" + SupportedOrientations="Landscape" + mc:Ignorable="d" + shell:SystemTray.IsVisible="False" Orientation="Landscape"> + <phone:PhoneApplicationPage.Resources> + + <Style x:Key="SliderStyle" TargetType="Slider"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="BorderBrush" Value="Transparent"/> + <Setter Property="Maximum" Value="10"/> + <Setter Property="Minimum" Value="0"/> + <Setter Property="Value" Value="0"/> + <Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/> + <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Margin="0,0,0,1"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="MouseOver"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/> + <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="HorizontalTemplate" Margin="10,0,10,10"> + <Rectangle x:Name="HorizontalTrack" IsHitTestVisible="False" Margin="0,15,0,32" Fill="{StaticResource PhoneBorderBrush}" RadiusY="3.5" RadiusX="3.5"/> + <Rectangle x:Name="HorizontalFill" IsHitTestVisible="False" Margin="0,15,0,32" RadiusX="3.5" RadiusY="3.5" StrokeThickness="2"> + <Rectangle.Fill> + <SolidColorBrush Color="White"/> + </Rectangle.Fill> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 6, 12"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="HorizontalCenterElement" HorizontalAlignment="Left" Margin="-2,7,0,24" Width="25" Stroke="{StaticResource PhoneForegroundBrush}" Fill="{StaticResource PhoneChromeBrush}" RadiusY="11" RadiusX="11" StrokeThickness="4.5"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + <Grid x:Name="VerticalTemplate" Margin="{StaticResource PhoneVerticalMargin}"> + <Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"/> + <Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"> + <Rectangle.Clip> + <RectangleGeometry Rect="0, 0, 12, 6"/> + </Rectangle.Clip> + </Rectangle> + <Rectangle x:Name="VerticalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" Height="12" Margin="12,0,12,0" VerticalAlignment="Top" Width="24"> + <Rectangle.RenderTransform> + <TranslateTransform/> + </Rectangle.RenderTransform> + </Rectangle> + </Grid> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </phone:PhoneApplicationPage.Resources> + + <Grid Background="Black"> + <MediaElement x:Name="MediaPlayer" + Tap="MediaPlayer_Tap" + AutoPlay="True" + MediaOpened="VideoPlayer_MediaOpened" + MediaEnded="VideoPlayer_MediaEnded" + MediaFailed="Media_MediaFailed"/> + <Grid x:Name="ControlsContainer" HorizontalAlignment="Left" Height="221" Margin="0,259,0,0" VerticalAlignment="Top" Width="800" Background="{StaticResource PhoneSemitransparentBrush}"> + <RepeatButton x:Name="Forward" Content="" HorizontalAlignment="Right" Margin="0,95,66,36" VerticalAlignment="Center" Width="120" Height="90" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="Forward_Click" Background="{StaticResource PhoneForegroundBrush}"> + <RepeatButton.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/transport.ff.png"/> + </RepeatButton.OpacityMask> + </RepeatButton> + <Button x:Name="Play" Opacity="1" Click="Play_Click" Margin="317,95,303,12" BorderBrush="{x:Null}" Background="{StaticResource PhoneForegroundBrush}" Foreground="{x:Null}"> + <Button.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/transport.play.png"/> + </Button.OpacityMask> + </Button> + <RepeatButton x:Name="Reverse" Content="" HorizontalAlignment="Left" Margin="66,95,0,36" VerticalAlignment="Center" Width="120" Height="90" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="Reverse_Click" Background="{StaticResource PhoneForegroundBrush}"> + <RepeatButton.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="/Resources/Assets/Images/transport.rew.png"/> + </RepeatButton.OpacityMask> + </RepeatButton> + <Slider x:Name="timelineSlider" Style="{StaticResource SliderStyle}" Margin="66,27,66,126" ValueChanged="timelineSlider_ValueChanged" VerticalAlignment="Center" Height="68"/> + </Grid> + <Rectangle x:Name="MuteAudio" Tap="MuteAudio_Tap" Opacity="0.5" Margin="686,29,38,396" Fill="{StaticResource PhoneForegroundBrush}"> + <Rectangle.OpacityMask> + <ImageBrush Stretch="Uniform" ImageSource="Resources/Assets/Images/mute.png"/> + </Rectangle.OpacityMask> + </Rectangle> + </Grid> + +</phone:PhoneApplicationPage> +\ No newline at end of file diff --git a/File360/VideoPlayer.xaml.cs b/File360/VideoPlayer.xaml.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace File360 +{ + public partial class VideoPlayer : PhoneApplicationPage + { + double volume; + public VideoPlayer() + { + InitializeComponent(); + } + + + private void Reverse_Click(object sender, RoutedEventArgs e) + { + if (MediaPlayer.CanSeek) + { + int SliderValue = (int)timelineSlider.Value; + timelineSlider.Value = SliderValue - 0.3; + } + } + + private void Play_Click(object sender, RoutedEventArgs e) + { + if (MediaPlayer.CanPause) + { + MediaPlayer.Pause(); + } + else + { + MediaPlayer.Play(); + } + } + + private void Forward_Click(object sender, RoutedEventArgs e) + { + if (MediaPlayer.CanSeek) + { + int SliderValue = (int)timelineSlider.Value; + timelineSlider.Value = SliderValue + 0.3; + } + } + + void Media_MediaFailed(object sender, RoutedEventArgs e) + { + NavigationService.GoBack(); + } + + private void MediaPlayer_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + if (ControlsContainer.Visibility == System.Windows.Visibility.Visible) + { + ControlsContainer.Visibility = System.Windows.Visibility.Collapsed; + } + else + { + ControlsContainer.Visibility = System.Windows.Visibility.Visible; + } + } + + private void timelineSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + int SliderValue = (int)timelineSlider.Value; + TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); + MediaPlayer.Position = ts; + } + + private void VideoPlayer_MediaOpened(object sender, RoutedEventArgs e) + { + timelineSlider.Maximum = MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds; + } + + private void VideoPlayer_MediaEnded(object sender, RoutedEventArgs e) + { + MediaPlayer.Stop(); + } + + private void MuteAudio_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + if (MediaPlayer.Volume == 0) + { + MediaPlayer.Volume = volume; + } + + if(MediaPlayer.Volume != 0) + { + volume = MediaPlayer.Volume; + MediaPlayer.Volume = 0; + } + } + + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/DataReceivedEventArgs.cs b/File360/WinPhoneFtp.FtpService/DataReceivedEventArgs.cs @@ -0,0 +1,19 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class DataReceivedEventArgs : EventArgs + { + private Byte[] data = null; + + internal DataReceivedEventArgs(Byte[] data) + { + this.data = data; + } + + public Byte[] GetData() + { + return data; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/ErrorOccuredEventArgs.cs b/File360/WinPhoneFtp.FtpService/ErrorOccuredEventArgs.cs @@ -0,0 +1,18 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class ErrorOccuredEventArgs : EventArgs + { + public Exception ExceptionObject + { + get; + private set; + } + + internal ErrorOccuredEventArgs(Exception ExceptionObject) + { + this.ExceptionObject = ExceptionObject; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpClient.cs b/File360/WinPhoneFtp.FtpService/FtpClient.cs @@ -0,0 +1,518 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Threading.Tasks; +using WinPhoneFtp.FtpService; +using Windows.Networking.Sockets; +using Windows.Storage.Streams; +using System.Windows.Threading; + +namespace WinPhoneFtp.FtpService +{ + public class FtpClient + { + String Username = String.Empty; + String Password = String.Empty; + TcpClientSocket FtpCommandSocket = null; + FtpCommand ftpCommand = FtpCommand.None; + FtpPassiveOperation ftpPassiveOperation = FtpPassiveOperation.None; + FtpFileOperationInfo ftpFileInfo = null; + StreamSocket FtpDataChannel = null; + List<byte> fileListingData = null; + String RemoteDirectory = String.Empty; + Logger logger = null; + Dispatcher UIDispatcher = null; + + public event EventHandler FtpConnected; + public event EventHandler FtpAuthenticationSucceeded; + public event EventHandler FtpAuthenticationFailed; + public event EventHandler<FtpDirectoryChangedEventArgs> FtpDirectoryChangedSucceded; + public event EventHandler<FtpDirectoryChangedEventArgs> FtpDirectoryChangedFailed; + public event EventHandler<FtpDisconnectedEventArgs> FtpDisconnected; + public event EventHandler<FtpPresentWorkingDirectoryEventArgs> FtpPresentWorkingDirectoryReceived; + public event EventHandler<FtpFileTransferEventArgs> FtpFileUploadSucceeded; + public event EventHandler<FtpFileTransferFailedEventArgs> FtpFileUploadFailed; + public event EventHandler<FtpFileTransferEventArgs> FtpFileDownloadSucceeded; + public event EventHandler<FtpFileTransferFailedEventArgs> FtpFileDownloadFailed; + public event EventHandler<FtpDirectoryListedEventArgs> FtpDirectoryListed; + public event EventHandler<FtpFileTransferProgressedEventArgs> FtpFileTransferProgressed; + + public FtpClient(String FtpServerIpAddress, Dispatcher UIDispatcher) + : this(FtpServerIpAddress, "21", UIDispatcher) + { + } + + public FtpClient(String FtpServerIpAddress, String PortNumber, Dispatcher UIDispatcher) + { + this.UIDispatcher = UIDispatcher; + logger = Logger.GetDefault(UIDispatcher); + logger.AddLog(String.Format("FTP Server IP Address: {0} with port {1}", FtpServerIpAddress, PortNumber)); + FtpCommandSocket = new TcpClientSocket(FtpServerIpAddress, PortNumber, 512, "FTP Command Channel", UIDispatcher); + FtpCommandSocket.DataReceived += FtpClientSocket_DataReceived; + FtpCommandSocket.ErrorOccured += FtpClientSocket_ErrorOccured; + FtpCommandSocket.SocketClosed += FtpClientSocket_SocketClosed; + FtpCommandSocket.SocketConnected += FtpCommandSocket_SocketConnected; + IsConnected = false; + } + + public Boolean IsConnected + { + get; + private set; + } + + public Boolean IsBusy + { + get; + private set; + } + + public async Task ConnectAsync() + { + if (!IsConnected) + { + logger.AddLog("FTP Command Channel Initailized"); + await FtpCommandSocket.PrepareSocketAsync(); + } + } + + async void FtpClientSocket_DataReceived(object sender, DataReceivedEventArgs e) + { + String Response = System.Text.Encoding.UTF8.GetString(e.GetData(), 0, e.GetData().Length); + logger.AddLog(String.Format("FTPServer -> {0}", Response)); + switch (ftpPassiveOperation) + { + case FtpPassiveOperation.FileDownload: + ftpCommand = FtpCommand.None; + if (Response.StartsWith("150") || Response.StartsWith("125")) + { + IsBusy = true; + DataReader dataReader = new DataReader(FtpDataChannel.InputStream); + dataReader.InputStreamOptions = InputStreamOptions.Partial; + while (!(await dataReader.LoadAsync(32768)).Equals(0)) + { + IBuffer databuffer = dataReader.DetachBuffer(); + RaiseFtpFileTransferProgressedEvent(databuffer.Length, false); + await ftpFileInfo.LocalFileStream.WriteAsync(databuffer.ToArray(), 0, Convert.ToInt32(databuffer.Length)); + } + await ftpFileInfo.LocalFileStream.FlushAsync(); + dataReader.Dispose(); + dataReader = null; + //FtpDataChannel.Dispose(); + //FtpDataChannel = null; + RaiseFtpFileDownloadSucceededEvent(ftpFileInfo.LocalFileStream, ftpFileInfo.RemoteFile); + } + else if (Response.StartsWith("226")) + { + IsBusy = false; + ftpPassiveOperation = FtpPassiveOperation.None; + } + else + { + IsBusy = false; + ftpPassiveOperation = FtpPassiveOperation.None; + RaiseFtpFileDownloadFailedEvent(ftpFileInfo.LocalFileStream, ftpFileInfo.RemoteFile, FtpFileTransferFailureReason.FileDoesNotExist); + } + break; + + case FtpPassiveOperation.FileUpload: + ftpCommand = FtpCommand.None; + if (Response.StartsWith("150") || Response.StartsWith("125")) + { + IsBusy = true; + DataWriter dataWriter = new DataWriter(FtpDataChannel.OutputStream); + byte[] data = new byte[32768]; + while (!(await ftpFileInfo.LocalFileStream.ReadAsync(data, 0, data.Length)).Equals(0)) + { + dataWriter.WriteBytes(data); + await dataWriter.StoreAsync(); + RaiseFtpFileTransferProgressedEvent(Convert.ToUInt32(data.Length), true); + } + await dataWriter.FlushAsync(); + dataWriter.Dispose(); + dataWriter = null; + FtpDataChannel.Dispose(); + FtpDataChannel = null; + } + else if (Response.StartsWith("226")) + { + IsBusy = false; + ftpPassiveOperation = FtpPassiveOperation.None; + RaiseFtpFileUploadSucceededEvent(ftpFileInfo.LocalFileStream, ftpFileInfo.RemoteFile); + ftpFileInfo = null; + } + else + { + IsBusy = false; + ftpPassiveOperation = FtpPassiveOperation.None; + RaiseFtpFileUploadFailedEvent(ftpFileInfo.LocalFileStream, ftpFileInfo.RemoteFile, FtpFileTransferFailureReason.FileDoesNotExist); + ftpFileInfo = null; + } + break; + + case FtpPassiveOperation.ListDirectory: + ftpCommand = FtpCommand.None; + if (Response.StartsWith("150") || Response.StartsWith("125")) + { + IsBusy = true; + DataReader dataReader = new DataReader(FtpDataChannel.InputStream); + dataReader.InputStreamOptions = InputStreamOptions.Partial; + fileListingData = new List<byte>(); + while (!(await dataReader.LoadAsync(1024)).Equals(0)) + { + fileListingData.AddRange(dataReader.DetachBuffer().ToArray()); + } + dataReader.Dispose(); + dataReader = null; + FtpDataChannel.Dispose(); + FtpDataChannel = null; + String listingData = System.Text.Encoding.UTF8.GetString(fileListingData.ToArray(), 0, fileListingData.ToArray().Length); + String[] listings = listingData.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + List<String> Filenames = new List<String>(); + List<String> Directories = new List<String>(); + foreach (String listing in listings) + { + if (listing.StartsWith("drwx") || listing.Contains("<DIR>")) + { + Directories.Add(listing.Split(new char[] { ' ' }).Last()); + } + else + { + Filenames.Add(listing.Split(new char[] { ' ' }).Last()); + } + } + RaiseFtpDirectoryListedEvent(Directories.ToArray(), Filenames.ToArray()); + } + else if (Response.StartsWith("226")) + { + IsBusy = false; + ftpFileInfo = null; + ftpPassiveOperation = FtpPassiveOperation.None; + } + break; + + case FtpPassiveOperation.None: + switch (ftpCommand) + { + case FtpCommand.Username: + if (Response.StartsWith("501")) + { + IsBusy = false; + RaiseFtpAuthenticationFailedEvent(); + break; + } + this.ftpCommand = FtpCommand.Password; + logger.AddLog(String.Format("FTPClient -> PASS {0}\r\n", this.Password)); + await FtpCommandSocket.SendDataAsync(String.Format("PASS {0}\r\n", this.Password)); + break; + + case FtpCommand.Password: + this.ftpCommand = FtpCommand.None; + IsBusy = false; + if (Response.Contains("530")) + { + RaiseFtpAuthenticationFailedEvent(); + } + else + { + RaiseFtpAuthenticationSucceededEvent(); + } + break; + + case FtpCommand.ChangeWorkingDirectory: + IsBusy = false; + if (Response.StartsWith("550")) + { + RaiseFtpDirectoryChangedFailedEvent(this.RemoteDirectory); + } + else + { + RaiseFtpDirectoryChangedSuccededEvent(this.RemoteDirectory); + } + break; + + case FtpCommand.PresentWorkingDirectory: + if (Response.StartsWith("257")) + { + IsBusy = false; + RaiseFtpPresentWorkingDirectoryReceivedEvent(Response.Split(new Char[] { ' ', '"' }, StringSplitOptions.RemoveEmptyEntries)[1]); + } + break; + + case FtpCommand.Type: + ftpCommand = FtpCommand.Passive; + logger.AddLog("FTPClient -> PASV\r\n"); + await FtpCommandSocket.SendDataAsync("PASV\r\n"); + break; + + case FtpCommand.Passive: + if (Response.StartsWith("227")) + { + await PrepareDataChannelAsync(Response); + if (ftpFileInfo != null) + { + if (ftpFileInfo.IsUpload) + { + ftpPassiveOperation = FtpPassiveOperation.FileUpload; + logger.AddLog(String.Format("FTPClient -> STOR {0}\r\n", ftpFileInfo.RemoteFile)); + await FtpCommandSocket.SendDataAsync(String.Format("STOR {0}\r\n", ftpFileInfo.RemoteFile)); + } + else + { + ftpPassiveOperation = FtpPassiveOperation.FileDownload; + logger.AddLog(String.Format("FTPClient -> RETR {0}\r\n", ftpFileInfo.RemoteFile)); + await FtpCommandSocket.SendDataAsync(String.Format("RETR {0}\r\n", ftpFileInfo.RemoteFile)); + } + } + else + { + fileListingData = new List<byte>(); + ftpPassiveOperation = FtpPassiveOperation.ListDirectory; + logger.AddLog("FTPClient -> LIST\r\n"); + await FtpCommandSocket.SendDataAsync("LIST\r\n"); + } + } + break; + + case FtpCommand.Logout: + ftpCommand = FtpCommand.None; + break; + + case FtpCommand.None: + break; + } + break; + } + + } + + void FtpCommandSocket_SocketConnected(object sender, EventArgs e) + { + IsConnected = true; + RaiseFtpConnectedEvent(); + } + + void FtpClientSocket_ErrorOccured(object sender, ErrorOccuredEventArgs e) + { + logger.AddLog(e.ExceptionObject.Message); + IsConnected = false; + RaiseFtpDisconnectedEvent(FtpDisconnectReason.SocketError); + } + + void FtpClientSocket_SocketClosed(object sender, SocketClosedEventArgs e) + { + IsConnected = false; + if (!ftpCommand.Equals(FtpCommand.Logout)) + { + RaiseFtpDisconnectedEvent(FtpDisconnectReason.SocketClosed); + } + else + { + RaiseFtpDisconnectedEvent(FtpDisconnectReason.QuitCommand); + } + } + + //public async Task AuthenticateAsync() + //{ + // await AuthenticateAsync("anonymous", "m@m.com"); //TODO: test value only + //} + + public async Task AuthenticateAsync(String Username, String Password) + { + ftpCommand = FtpCommand.Username; + this.Username = Username; + this.Password = Password; + logger.AddLog(String.Format("FTPClient -> USER {0}\r\n", Username)); + await FtpCommandSocket.SendDataAsync(String.Format("USER {0}\r\n", Username)); + } + + public async Task ChangeWorkingDirectoryAsync(String RemoteDirectory) + { + if (!IsBusy) + { + this.RemoteDirectory = RemoteDirectory; + ftpCommand = FtpCommand.ChangeWorkingDirectory; + logger.AddLog(String.Format("FTPClient -> CWD {0}\r\n", RemoteDirectory)); + await FtpCommandSocket.SendDataAsync(String.Format("CWD {0}\r\n", RemoteDirectory)); + } + } + + public async Task GetPresentWorkingDirectoryAsync() + { + if (!IsBusy) + { + ftpCommand = FtpCommand.PresentWorkingDirectory; + logger.AddLog("FTPClient -> PWD\r\n"); + await FtpCommandSocket.SendDataAsync("PWD\r\n"); + } + } + + public async Task GetDirectoryListingAsync() + { + if (!IsBusy) + { + fileListingData = null; + ftpFileInfo = null; + IsBusy = true; + ftpCommand = FtpCommand.Passive; + logger.AddLog("FTPClient -> PASV\r\n"); + await FtpCommandSocket.SendDataAsync("PASV\r\n"); + } + } + + public async Task UploadFileAsync(System.IO.Stream LocalFileStream, String RemoteFilename) + { + if (!IsBusy) + { + ftpFileInfo = null; + IsBusy = true; + ftpFileInfo = new FtpFileOperationInfo(LocalFileStream, RemoteFilename, true); + ftpCommand = FtpCommand.Type; + logger.AddLog("FTPClient -> TYPE I\r\n"); + await FtpCommandSocket.SendDataAsync("TYPE I\r\n"); + } + } + + public async Task DownloadFileAsync(System.IO.Stream LocalFileStream, String RemoteFilename) + { + if (!IsBusy) + { + ftpFileInfo = null; + IsBusy = true; + ftpFileInfo = new FtpFileOperationInfo(LocalFileStream, RemoteFilename, false); + ftpCommand = FtpCommand.Type; + logger.AddLog("FTPClient -> TYPE I\r\n"); + await FtpCommandSocket.SendDataAsync("TYPE I\r\n"); + } + } + + public async Task DisconnectAsync() + { + ftpCommand = FtpCommand.Logout; + logger.AddLog("FTPClient -> QUIT\r\n"); + await FtpCommandSocket.SendDataAsync("QUIT\r\n"); + } + + private async Task PrepareDataChannelAsync(String ChannelInfo) + { + ChannelInfo = ChannelInfo.Remove(0, "227 Entering Passive Mode".Length); //TODO: test value only + //Configure the IP Address + String[] Splits = ChannelInfo.Substring(ChannelInfo.IndexOf("(") + 1, ChannelInfo.Length - ChannelInfo.IndexOf("(") - 5).Split(new char[] { ',', ' ', }, StringSplitOptions.RemoveEmptyEntries); + String Ipaddr = String.Join(".", Splits, 0, 4); + + //Calculate the Data Port + Int32 port = Convert.ToInt32(Splits[4]); + port = ((port << 8) | Convert.ToInt32(Splits[5])); + logger.AddLog(String.Format("FTP Data Channel IPAddress: {0}, Port: {1}", Ipaddr, port)); + FtpDataChannel = new StreamSocket(); + await FtpDataChannel.ConnectAsync(new Windows.Networking.HostName(Ipaddr), port.ToString()); + logger.AddLog("FTP Data Channel connected"); + } + + private void RaiseFtpAuthenticationSucceededEvent() + { + if (FtpAuthenticationSucceeded != null) + { + FtpAuthenticationSucceeded(this, EventArgs.Empty); + } + } + + private void RaiseFtpAuthenticationFailedEvent() + { + if (FtpAuthenticationFailed != null) + { + FtpAuthenticationFailed(this, EventArgs.Empty); + } + } + + private void RaiseFtpDirectoryChangedSuccededEvent(String RemoteDirectory) + { + if (FtpDirectoryChangedSucceded != null) + { + FtpDirectoryChangedSucceded(this, new FtpDirectoryChangedEventArgs(RemoteDirectory)); + } + } + + private void RaiseFtpDirectoryChangedFailedEvent(String RemoteDirectory) + { + if (FtpDirectoryChangedFailed != null) + { + FtpDirectoryChangedFailed(this, new FtpDirectoryChangedEventArgs(RemoteDirectory)); + } + } + + private void RaiseFtpPresentWorkingDirectoryReceivedEvent(String PresentWorkingDirectory) + { + if (FtpPresentWorkingDirectoryReceived != null) + { + FtpPresentWorkingDirectoryReceived(this, new FtpPresentWorkingDirectoryEventArgs(PresentWorkingDirectory)); + } + } + + private void RaiseFtpFileUploadSucceededEvent(Stream LocalFileStream, String RemoteFile) + { + if (FtpFileUploadSucceeded != null) + { + FtpFileUploadSucceeded(this, new FtpFileTransferEventArgs(LocalFileStream, RemoteFile)); + } + } + + private void RaiseFtpFileUploadFailedEvent(Stream LocalFileStream, String RemoteFile, FtpFileTransferFailureReason FileTransferFailReason) + { + if (FtpFileUploadFailed != null) + { + FtpFileUploadFailed(this, new FtpFileTransferFailedEventArgs(LocalFileStream, RemoteFile, FileTransferFailReason)); + } + } + + private void RaiseFtpFileDownloadSucceededEvent(Stream LocalFileStream, String RemoteFile) + { + if (FtpFileDownloadSucceeded != null) + { + FtpFileDownloadSucceeded(this, new FtpFileTransferEventArgs(LocalFileStream, RemoteFile)); + } + } + + private void RaiseFtpFileDownloadFailedEvent(Stream LocalFileStream, String RemoteFile, FtpFileTransferFailureReason FileTransferFailReason) + { + if (FtpFileDownloadFailed != null) + { + FtpFileDownloadFailed(this, new FtpFileTransferFailedEventArgs(LocalFileStream, RemoteFile, FileTransferFailReason)); + } + } + + private void RaiseFtpConnectedEvent() + { + if (FtpConnected != null) + { + FtpConnected(this, EventArgs.Empty); + } + } + + private void RaiseFtpDisconnectedEvent(FtpDisconnectReason DisconnectReason) + { + if (FtpDisconnected != null) + { + FtpDisconnected(this, new FtpDisconnectedEventArgs(DisconnectReason)); + } + } + + private void RaiseFtpDirectoryListedEvent(String[] Directories, String[] Filenames) + { + if (FtpDirectoryListed != null) + { + FtpDirectoryListed(this, new FtpDirectoryListedEventArgs(Directories, Filenames)); + } + } + + private void RaiseFtpFileTransferProgressedEvent(UInt32 BytesTransfered, Boolean IsUpload) + { + if (FtpFileTransferProgressed != null) + { + FtpFileTransferProgressed(this, new FtpFileTransferProgressedEventArgs(BytesTransfered, IsUpload)); + } + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpCommand.cs b/File360/WinPhoneFtp.FtpService/FtpCommand.cs @@ -0,0 +1,14 @@ +namespace WinPhoneFtp.FtpService +{ + internal enum FtpCommand : byte + { + None = 0, + Username = 1, + Password = 2, + ChangeWorkingDirectory = 3, + PresentWorkingDirectory = 4, + Type = 5, + Passive = 6, + Logout = 7 + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpDirectoryChangedEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpDirectoryChangedEventArgs.cs @@ -0,0 +1,18 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class FtpDirectoryChangedEventArgs + { + internal FtpDirectoryChangedEventArgs(String RemoteDirectory) + { + this.RemoteDirectory = RemoteDirectory; + } + + public String RemoteDirectory + { + get; + private set; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpDirectoryListedEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpDirectoryListedEventArgs.cs @@ -0,0 +1,26 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class FtpDirectoryListedEventArgs : EventArgs + { + private String[] Filenames = null; + private String[] Directories = null; + + internal FtpDirectoryListedEventArgs(String[] Directories, String[] Filenames) + { + this.Directories = Directories; + this.Filenames = Filenames; + } + + public String[] GetDirectories() + { + return this.Directories; + } + + public String[] GetFilenames() + { + return this.Filenames; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpDisconnectReason.cs b/File360/WinPhoneFtp.FtpService/FtpDisconnectReason.cs @@ -0,0 +1,10 @@ +namespace WinPhoneFtp.FtpService +{ + public enum FtpDisconnectReason : byte + { + None = 0, + QuitCommand = 1, + SocketClosed = 2, + SocketError = 3 + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpDisconnectedEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpDisconnectedEventArgs.cs @@ -0,0 +1,16 @@ +namespace WinPhoneFtp.FtpService +{ + public class FtpDisconnectedEventArgs + { + internal FtpDisconnectedEventArgs(FtpDisconnectReason DisconnectReason) + { + this.DisconnectReason = DisconnectReason; + } + + public FtpDisconnectReason DisconnectReason + { + get; + private set; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpFileOperationInfo.cs b/File360/WinPhoneFtp.FtpService/FtpFileOperationInfo.cs @@ -0,0 +1,33 @@ +using System; +using System.IO; + +namespace WinPhoneFtp.FtpService +{ + internal class FtpFileOperationInfo + { + internal FtpFileOperationInfo(Stream LocalFileStream, String RemoteFile, Boolean IsUpload) + { + this.LocalFileStream = LocalFileStream; + this.RemoteFile = RemoteFile; + this.IsUpload = IsUpload; + } + + public Stream LocalFileStream + { + get; + private set; + } + + public String RemoteFile + { + get; + private set; + } + + public Boolean IsUpload + { + get; + private set; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpFileTransferEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpFileTransferEventArgs.cs @@ -0,0 +1,26 @@ +using System; +using System.IO; + +namespace WinPhoneFtp.FtpService +{ + public class FtpFileTransferEventArgs : EventArgs + { + internal FtpFileTransferEventArgs(Stream LocalFileStream, String RemoteFile) + { + this.LocalFileStream = LocalFileStream; + this.RemoteFile = RemoteFile; + } + + public Stream LocalFileStream + { + get; + private set; + } + + public String RemoteFile + { + get; + private set; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpFileTransferFailedEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpFileTransferFailedEventArgs.cs @@ -0,0 +1,33 @@ +using System; +using System.IO; + +namespace WinPhoneFtp.FtpService +{ + public class FtpFileTransferFailedEventArgs : EventArgs + { + internal FtpFileTransferFailedEventArgs(Stream LocalFileStream, String RemoteFile, FtpFileTransferFailureReason FileTransferFailReason) + { + this.LocalFileStream = LocalFileStream; + this.RemoteFile = RemoteFile; + this.FileTransferFailReason = FileTransferFailReason; + } + + public Stream LocalFileStream + { + get; + private set; + } + + public String RemoteFile + { + get; + private set; + } + + public FtpFileTransferFailureReason FileTransferFailReason + { + get; + private set; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpFileTransferFailureReason.cs b/File360/WinPhoneFtp.FtpService/FtpFileTransferFailureReason.cs @@ -0,0 +1,10 @@ +namespace WinPhoneFtp.FtpService +{ + public enum FtpFileTransferFailureReason: byte + { + None, + MemoryCardNotFound, + FileDoesNotExist, + InputOutputError + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpFileTransferProgressedEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpFileTransferProgressedEventArgs.cs @@ -0,0 +1,25 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class FtpFileTransferProgressedEventArgs : EventArgs + { + public UInt32 BytesTransferred + { + get; + private set; + } + + public Boolean IsUpload + { + get; + private set; + } + + internal FtpFileTransferProgressedEventArgs(UInt32 BytesTransferred, Boolean IsUpload) + { + this.BytesTransferred = BytesTransferred; + this.IsUpload = IsUpload; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpPassiveOperation.cs b/File360/WinPhoneFtp.FtpService/FtpPassiveOperation.cs @@ -0,0 +1,10 @@ +namespace WinPhoneFtp.FtpService +{ + public enum FtpPassiveOperation: byte + { + None, + FileUpload, + FileDownload, + ListDirectory + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/FtpPresentWorkingDirectoryEventArgs.cs b/File360/WinPhoneFtp.FtpService/FtpPresentWorkingDirectoryEventArgs.cs @@ -0,0 +1,18 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class FtpPresentWorkingDirectoryEventArgs : EventArgs + { + public String PresentWorkingDirectory + { + get; + private set; + } + + internal FtpPresentWorkingDirectoryEventArgs(String PresentWorkingDirectory) + { + this.PresentWorkingDirectory = PresentWorkingDirectory; + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/Logger.cs b/File360/WinPhoneFtp.FtpService/Logger.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.ObjectModel; +using System.IO; +using System.IO.IsolatedStorage; +using System.Threading.Tasks; +using System.Windows; +using Windows.Storage; +using System.Text; +using Windows.Storage.Streams; +using System.Windows.Threading; + +namespace WinPhoneFtp.FtpService +{ + public sealed class Logger + { + private static Logger s_Logger = null; + public static Logger GetDefault(Dispatcher UIDispatcher) + { + if (s_Logger == null) + { + s_Logger = new Logger(UIDispatcher); + } + return s_Logger; + } + + private Dispatcher UIDispatcher = null; + + private Logger(Dispatcher UIDispatcher) + { + Logs = new ObservableCollection<String>(); + this.UIDispatcher = UIDispatcher != null ? UIDispatcher : Deployment.Current.Dispatcher; + } + + public ObservableCollection<String> Logs + { + get; + private set; + } + + public void AddLog(String LogInfo) + { + UIDispatcher.BeginInvoke(() => + { + System.Diagnostics.Debug.WriteLine(LogInfo); + Logs.Add(LogInfo); + }); + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/SocketCloseReason.cs b/File360/WinPhoneFtp.FtpService/SocketCloseReason.cs @@ -0,0 +1,10 @@ +namespace WinPhoneFtp.FtpService +{ + public enum SocketCloseReason : byte + { + None = 0, + ClosedFromLocalHost = 1, + ClosedByRemoteHost = 2, + UnknownReason = 3 + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/SocketClosedEventArgs.cs b/File360/WinPhoneFtp.FtpService/SocketClosedEventArgs.cs @@ -0,0 +1,23 @@ +using System; + +namespace WinPhoneFtp.FtpService +{ + public class SocketClosedEventArgs : EventArgs + { + private SocketCloseReason closeReason = SocketCloseReason.None; + + internal SocketClosedEventArgs(SocketCloseReason closeReason) + : base() + { + this.closeReason = closeReason; + } + + public SocketCloseReason CloseReason + { + get + { + return closeReason; + } + } + } +} +\ No newline at end of file diff --git a/File360/WinPhoneFtp.FtpService/TcpClientSocket.cs b/File360/WinPhoneFtp.FtpService/TcpClientSocket.cs @@ -0,0 +1,243 @@ +using System; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; +using Windows.Networking.Sockets; +using Windows.Storage.Streams; + +namespace WinPhoneFtp.FtpService +{ + public sealed class TcpClientSocket : IDisposable + { + String IpAddress = String.Empty; + String Port = String.Empty; + StreamSocket streamSocket = null; + String SocketName = String.Empty; + DataWriter TcpStreamWriter = null; + Boolean IsConnectionClosedByRemoteHost = false; + UInt32 ReadBufferLength = 0; + Boolean IsSocketConnected = false; + Logger logger = null; + Dispatcher UIDispatcher = null; + DataReader TcpStreamReader = null; + + public event EventHandler<DataReceivedEventArgs> DataReceived; + public event EventHandler<SocketClosedEventArgs> SocketClosed; + public event EventHandler<ErrorOccuredEventArgs> ErrorOccured; + public event EventHandler SocketConnected; + + public TcpClientSocket(String IpAddress, String Port, Dispatcher UIDispatcher) + : this(IpAddress, Port, 512, "NoName", UIDispatcher) + { + } + + public TcpClientSocket(String IpAddress, String Port, UInt32 ReadBufferLength, Dispatcher UIDispatcher) + : this(IpAddress, Port, ReadBufferLength, "NoName", UIDispatcher) + { + } + + public TcpClientSocket(String IpAddress, String Port, String SocketName, Dispatcher UIDispatcher) + : this(IpAddress, Port, 512, SocketName, UIDispatcher) + { + } + + public TcpClientSocket(String IpAddress, String Port, UInt32 ReadBufferLength, String SocketName, Dispatcher UIDispatcher) + { + this.UIDispatcher = UIDispatcher != null ? UIDispatcher : Deployment.Current.Dispatcher; + logger = Logger.GetDefault(UIDispatcher); + this.IpAddress = IpAddress; + this.Port = Port; + this.SocketName = SocketName; + this.ReadBufferLength = ReadBufferLength; + //logger.AddLog(String.Format("Creating new TCP Socket {0}. IPAddress: {1}, Port: {2}", SocketName, IpAddress, Port)); + } + + public async Task PrepareSocketAsync() + { + streamSocket = new StreamSocket(); + + //logger.AddLog(String.Format("Connecting {0} socket at IPAddress: {1}, Port: {2}", SocketName, IpAddress, Port)); + try + { + await streamSocket.ConnectAsync(new Windows.Networking.HostName(IpAddress), Port); + } + catch (Exception ex) + { + //logger.AddLog("Unable to connect to remote connection"); + RaiseErrorOccuredEvent(ex); + return; + } + //logger.AddLog("Connected"); + TcpStreamWriter = new DataWriter(streamSocket.OutputStream); + IsSocketConnected = true; + try + { + await Task.Factory.StartNew(stream => + { + TcpStreamReader = new DataReader((IInputStream)stream); + TcpStreamReader.InputStreamOptions = InputStreamOptions.Partial; + try + { + DataReaderLoadOperation loadOperation = TcpStreamReader.LoadAsync(ReadBufferLength); + loadOperation.Completed = new Windows.Foundation.AsyncOperationCompletedHandler<UInt32>(LoadCompleted); + } + catch (Exception ex) + { + RaiseErrorOccuredEvent(ex); + } + }, streamSocket.InputStream); + } + catch + { + //logger.AddLog("Asynchronous Read Operation Canceled"); + } + RaiseSocketConnectedEvent(); + } + + private void LoadCompleted(Windows.Foundation.IAsyncOperation<uint> asyncInfo, Windows.Foundation.AsyncStatus asyncStatus) + { + switch (asyncStatus) + { + case Windows.Foundation.AsyncStatus.Canceled: + //logger.AddLog("Data load operation canceled"); + break; + + case Windows.Foundation.AsyncStatus.Completed: + //logger.AddLog("Data load operation completed"); + if (TcpStreamReader.UnconsumedBufferLength.Equals(0)) + { + if (IsSocketConnected) + { + //logger.AddLog("Connection closed by remote host. Exiting"); + IsSocketConnected = false; + IsConnectionClosedByRemoteHost = true; + CloseSocket(); + } + } + else + { + IBuffer buffer = TcpStreamReader.DetachBuffer(); + RaiseDataReceivedEvent(buffer.ToArray()); + DataReaderLoadOperation loadOperation = TcpStreamReader.LoadAsync(ReadBufferLength); + loadOperation.Completed = new Windows.Foundation.AsyncOperationCompletedHandler<UInt32>(LoadCompleted); + } + break; + + case Windows.Foundation.AsyncStatus.Error: + //logger.AddLog("Exception in data load operation"); + IsSocketConnected = false; + if (asyncInfo.ErrorCode.HResult.Equals(-2147014842)) + { + IsConnectionClosedByRemoteHost = true; + } + else + { + RaiseErrorOccuredEvent(asyncInfo.ErrorCode); + } + CloseSocket(); + break; + + case Windows.Foundation.AsyncStatus.Started: + //logger.AddLog("Data load operation started"); + break; + } + } + + public async Task SendDataAsync(byte[] data) + { + if (TcpStreamWriter != null) + { + TcpStreamWriter.WriteBytes(data); + await TcpStreamWriter.StoreAsync(); + } + } + + public async Task SendDataAsync(String data) + { + if (TcpStreamWriter != null) + { + TcpStreamWriter.WriteString(data); + await TcpStreamWriter.StoreAsync(); + } + } + + [System.Security.SecuritySafeCritical()] + public void CloseSocket() + { + IsSocketConnected = false; + //logger.AddLog(String.Format("Closing {0} socket", SocketName)); + if (TcpStreamWriter != null) + { + //loadOperation.Close(); + TcpStreamWriter.Dispose(); + TcpStreamWriter = null; + } + + if (streamSocket != null) + { + DataReceived = null; + ErrorOccured = null; + if (!IsConnectionClosedByRemoteHost) + { + //loadOperation.Cancel(); + RaiseSocketClosedEvent(SocketCloseReason.ClosedFromLocalHost); + } + else + { + RaiseSocketClosedEvent(SocketCloseReason.ClosedByRemoteHost); + } + SocketClosed = null; + streamSocket.Dispose(); + streamSocket = null; + } + } + + private void RaiseDataReceivedEvent(Byte[] data) + { + if (DataReceived != null) + { + DataReceived(this, new DataReceivedEventArgs(data)); + } + } + + private void RaiseSocketClosedEvent(SocketCloseReason CloseReason) + { + if (SocketClosed != null) + { + SocketClosed(this, new SocketClosedEventArgs(CloseReason)); + } + } + + private void RaiseErrorOccuredEvent(Exception ExceptionObject) + { + if (ErrorOccured != null) + { + ErrorOccured(this, new ErrorOccuredEventArgs(ExceptionObject)); + } + } + + private void RaiseSocketConnectedEvent() + { + if (SocketConnected != null) + { + SocketConnected(this, EventArgs.Empty); + } + } + + public async void Dispose() + { + if (TcpStreamWriter != null) + { + await TcpStreamWriter.FlushAsync(); + TcpStreamWriter.Dispose(); + } + + if (streamSocket != null) + { + streamSocket.Dispose(); + } + } + } +} +\ No newline at end of file diff --git a/File360/packages.config b/File360/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp80" /> +</packages> +\ No newline at end of file diff --git a/File360/picturelist.cs b/File360/picturelist.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace File360 +{ + class picturelist<T> + { + } +} diff --git a/File360/sdlist.cs b/File360/sdlist.cs @@ -0,0 +1,24 @@ +using System.Text; +using Microsoft.Phone.Storage; + +namespace File360 +{ + class sdlist + { + + public string Name + { + set; + get; + } + public string Name2 { set; get; } + + public sdlist(string name, string FImage) + { + this.Name = name; + this.Name2 = FImage; + } + } +} + + diff --git a/File360/settinglist.cs b/File360/settinglist.cs @@ -0,0 +1,21 @@ +using System.Text; +using Microsoft.Phone.Storage; + +namespace File360 +{ + class settinglist + { + public string SettingName { set; get; } + public string SettingDescription { set; get; } + public string SettingPicture { set; get; } + + public settinglist(string name, string description, string picture) + { + this.SettingName = name; + this.SettingDescription = description; + this.SettingPicture = picture; + } + } +} + + diff --git a/File360/slider_alpha.png b/File360/slider_alpha.png Binary files differ.