Skip to content

Commit 301ee85

Browse files
committed
VT8_9
Gráfica usada en el videotutorial 8 del Curso de Visual C# 20112 y archivos de prácticas usados en el videotutorial 9
1 parent af2299c commit 301ee85

25 files changed

+1141
-0
lines changed
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Comparaciones", "Comparaciones\Comparaciones.csproj", "{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application x:Class="Comparaciones.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
StartupUri="MainWindow.xaml">
5+
<Application.Resources>
6+
7+
</Application.Resources>
8+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace Comparaciones
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{5954EC94-FDA7-4A82-8DFA-F26A8B1DE42A}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Comparaciones</RootNamespace>
11+
<AssemblyName>Comparaciones</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15+
<WarningLevel>4</WarningLevel>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Data" />
39+
<Reference Include="System.Xml" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Core" />
42+
<Reference Include="System.Xml.Linq" />
43+
<Reference Include="System.Data.DataSetExtensions" />
44+
<Reference Include="System.Xaml">
45+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
46+
</Reference>
47+
<Reference Include="WindowsBase" />
48+
<Reference Include="PresentationCore" />
49+
<Reference Include="PresentationFramework" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<ApplicationDefinition Include="App.xaml">
53+
<Generator>MSBuild:Compile</Generator>
54+
<SubType>Designer</SubType>
55+
</ApplicationDefinition>
56+
<Page Include="MainWindow.xaml">
57+
<Generator>MSBuild:Compile</Generator>
58+
<SubType>Designer</SubType>
59+
</Page>
60+
<Compile Include="App.xaml.cs">
61+
<DependentUpon>App.xaml</DependentUpon>
62+
<SubType>Code</SubType>
63+
</Compile>
64+
<Compile Include="MainWindow.xaml.cs">
65+
<DependentUpon>MainWindow.xaml</DependentUpon>
66+
<SubType>Code</SubType>
67+
</Compile>
68+
</ItemGroup>
69+
<ItemGroup>
70+
<Compile Include="Properties\AssemblyInfo.cs">
71+
<SubType>Code</SubType>
72+
</Compile>
73+
<Compile Include="Properties\Resources.Designer.cs">
74+
<AutoGen>True</AutoGen>
75+
<DesignTime>True</DesignTime>
76+
<DependentUpon>Resources.resx</DependentUpon>
77+
</Compile>
78+
<Compile Include="Properties\Settings.Designer.cs">
79+
<AutoGen>True</AutoGen>
80+
<DependentUpon>Settings.settings</DependentUpon>
81+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
82+
</Compile>
83+
<EmbeddedResource Include="Properties\Resources.resx">
84+
<Generator>ResXFileCodeGenerator</Generator>
85+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
86+
</EmbeddedResource>
87+
<None Include="Properties\Settings.settings">
88+
<Generator>SettingsSingleFileGenerator</Generator>
89+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
90+
</None>
91+
<AppDesigner Include="Properties\" />
92+
</ItemGroup>
93+
<ItemGroup>
94+
<None Include="App.config" />
95+
</ItemGroup>
96+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
97+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
98+
Other similar extension points exist, see Microsoft.Common.targets.
99+
<Target Name="BeforeBuild">
100+
</Target>
101+
<Target Name="AfterBuild">
102+
</Target>
103+
-->
104+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Window x:Class="Comparaciones.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="Fechas" Height="380" Width="500">
5+
<Grid>
6+
<Grid Margin="12,0,12,0">
7+
<Grid.RowDefinitions>
8+
<RowDefinition Height="*"/>
9+
<RowDefinition Height="2*"/>
10+
<RowDefinition Height="*"/>
11+
<RowDefinition Height="2*"/>
12+
<RowDefinition Height="*"/>
13+
<RowDefinition Height="2*"/>
14+
<RowDefinition Height="*"/>
15+
<RowDefinition Height="7*"/>
16+
<RowDefinition Height="*"/>
17+
</Grid.RowDefinitions>
18+
<Grid.ColumnDefinitions>
19+
<ColumnDefinition Width="*"/>
20+
<ColumnDefinition Width="3*"/>
21+
<ColumnDefinition Width="3*"/>
22+
<ColumnDefinition Width="3*"/>
23+
<ColumnDefinition Width="*"/>
24+
</Grid.ColumnDefinitions>
25+
<TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="14" Margin="0,10" Width="91" ><Run Language="es-es" Text="Primero"/><Run Text=":"/></TextBlock>
26+
<TextBlock x:Name="fechaPrimera" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="14" Text="" />
27+
<Slider x:Name="primerAjustadorFecha" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14" Minimum="-50" Maximum="50" ValueChanged="firstDateAdjusterValueChanged" />
28+
<TextBlock Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="14" Margin="0,10" Width="91" ><Run Text="Se"/><Run Language="es-es" Text="gundo"/><Run Text=":"/></TextBlock>
29+
<TextBlock x:Name="fechaSegunda" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="14" Text="" />
30+
<Slider x:Name="segundoAjustadorFecha" Grid.Row="3" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14" Minimum="-50" Maximum="50" ValueChanged="secondDateAdjusterValueChanged" />
31+
<Button x:Name="comparar" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" FontSize="14" Content="Comparar" Click="compareClick" Width="81" />
32+
<TextBox x:Name="info" Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" AcceptsReturn="True" IsReadOnly="True" FontSize="14" ScrollViewer.VerticalScrollBarVisibility="Auto" />
33+
</Grid>
34+
</Grid>
35+
</Window>
36+
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Data;
8+
using System.Windows.Documents;
9+
using System.Windows.Input;
10+
using System.Windows.Media;
11+
using System.Windows.Media.Imaging;
12+
using System.Windows.Navigation;
13+
using System.Windows.Shapes;
14+
15+
namespace Comparaciones
16+
{
17+
/// <summary>
18+
/// Interaction logic for Window.xaml
19+
/// </summary>
20+
public partial class MainWindow : Window
21+
{
22+
private DateTime primero;
23+
private DateTime segundo;
24+
25+
public MainWindow()
26+
{
27+
InitializeComponent();
28+
29+
primero = DateTime.Now;
30+
segundo = DateTime.Now;
31+
32+
fechaPrimera.Text = primero.ToString("d MMMM yyyy");
33+
fechaSegunda.Text = segundo.ToString("d MMMM yyyy");
34+
}
35+
36+
private void firstDateAdjusterValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
37+
{
38+
primero = DateTime.Now.AddDays(e.NewValue);
39+
fechaPrimera.Text = primero.ToString("d MMMM yyyy");
40+
}
41+
42+
private void secondDateAdjusterValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
43+
{
44+
segundo = DateTime.Now.AddDays(e.NewValue);
45+
fechaSegunda.Text = segundo.ToString("d MMMM yyyy");
46+
}
47+
48+
private void compareClick(object sender, RoutedEventArgs e)
49+
{
50+
int diff = dateCompare(primero, segundo);
51+
info.Text = "";
52+
show("fechaPrimera == fechaSegunda", diff == 0);
53+
show("fechaPrimera != fechaSegunda", diff != 0);
54+
show("fechaPrimera < fechaSegunda", diff < 0);
55+
show("fechaPrimera <= fechaSegunda", diff <= 0);
56+
show("fechaPrimera > fechaSegunda", diff > 0);
57+
show("fechaPrimera >= fechaSegunda", diff >= 0);
58+
}
59+
60+
private void show(string exp, bool result)
61+
{
62+
info.Text += exp;
63+
info.Text += " : " + result.ToString();
64+
info.Text += "\n";
65+
}
66+
67+
private int dateCompare(DateTime ladoIzquierdo, DateTime ladoDerecho)
68+
{
69+
int result;
70+
71+
if (ladoIzquierdo.Year < ladoDerecho.Year)
72+
{
73+
result = -1;
74+
}
75+
else if (ladoIzquierdo.Year > ladoDerecho.Year)
76+
{
77+
result = 1;
78+
}
79+
80+
else if (ladoIzquierdo.Month < ladoDerecho.Month)
81+
{
82+
result = -1;
83+
}
84+
else if (ladoIzquierdo.Month > ladoDerecho.Month)
85+
{
86+
result = 1;
87+
}
88+
89+
else if (ladoIzquierdo.Day < ladoDerecho.Day)
90+
{
91+
result = -1;
92+
}
93+
else if (ladoIzquierdo.Day > ladoDerecho.Day)
94+
{
95+
result = 1;
96+
}
97+
else
98+
{
99+
result = 0;
100+
}
101+
102+
return result;
103+
}
104+
}
105+
}
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[assembly: AssemblyTitle("Comparaciones")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("Comparaciones")]
15+
[assembly: AssemblyCopyright("Copyright © 2013")]
16+
[assembly: AssemblyTrademark("")]
17+
[assembly: AssemblyCulture("")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
//In order to begin building localizable applications, set
25+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
26+
//inside a <PropertyGroup>. For example, if you are using US english
27+
//in your source files, set the <UICulture> to en-US. Then uncomment
28+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
29+
//the line below to match the UICulture setting in the project file.
30+
31+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32+
33+
34+
[assembly: ThemeInfo(
35+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36+
//(used if a resource is not found in the page,
37+
// or application resource dictionaries)
38+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39+
//(used if a resource is not found in the page,
40+
// app, or any theme specific resource dictionaries)
41+
)]
42+
43+
44+
// Version information for an assembly consists of the following four values:
45+
//
46+
// Major Version
47+
// Minor Version
48+
// Build Number
49+
// Revision
50+
//
51+
// You can specify all the values or you can default the Build and Revision Numbers
52+
// by using the '*' as shown below:
53+
// [assembly: AssemblyVersion("1.0.*")]
54+
[assembly: AssemblyVersion("1.0.0.0")]
55+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)