Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xivSolutions committed Aug 19, 2012
0 parents commit bb84b87
Show file tree
Hide file tree
Showing 17 changed files with 828 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ConditionalMethodsExample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConditionalMethodsExample", "ConditionalMethodsExample\ConditionalMethodsExample.csproj", "{8148AD1C-0BA0-456B-8F12-901A5EB870F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
LIVE|x86 = LIVE|x86
Release|x86 = Release|x86
TEST|x86 = TEST|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.Debug|x86.ActiveCfg = Debug|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.Debug|x86.Build.0 = Debug|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.LIVE|x86.ActiveCfg = LIVE|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.LIVE|x86.Build.0 = LIVE|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.Release|x86.ActiveCfg = Release|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.Release|x86.Build.0 = Release|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.TEST|x86.ActiveCfg = TEST|x86
{8148AD1C-0BA0-456B-8F12-901A5EB870F3}.TEST|x86.Build.0 = TEST|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
124 changes: 124 additions & 0 deletions ConditionalMethodsExample/ConditionalMethodsExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?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)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8148AD1C-0BA0-456B-8F12-901A5EB870F3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConditionalMethodsExample</RootNamespace>
<AssemblyName>ConditionalMethodsExample</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'LIVE|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\LIVE\</OutputPath>
<DefineConstants>TRACE;DEBUG;LIVE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'TEST|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\TEST\</OutputPath>
<DefineConstants>TRACE;DEBUG;TEST</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Resources\LiveVersionMessage.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\TestVersionMessage.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\LiveOutputFolderPath.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\TestOutputFolderPath.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.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>
-->
</Project>
75 changes: 75 additions & 0 deletions ConditionalMethodsExample/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions ConditionalMethodsExample/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ConditionalMethodsExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.btnCopyFile.Click += new System.EventHandler(this.btnCopyFile_Click);

}


private void Form1_Load(object sender, EventArgs e)
{
// The BuildVersionMessage setting will be set at compile time:
this.lblHeader.Text = Properties.Settings.Default.BuildVersionMessage;
}


private void btnCopyFile_Click(object sender, EventArgs e)
{
this.CopyFile();
}


private void CopyFile()
{
// The correct output file path will be defined at compile time,
// and made available through the settings file:
string outputDirectory = Properties.Settings.Default.OutputFolderPath;

// Make sure the directory exists:
if (!Directory.Exists(outputDirectory))
{
Directory.CreateDirectory(outputDirectory);
}

using (var fileDialog = new OpenFileDialog())
{
fileDialog.InitialDirectory =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
fileDialog.Multiselect = false;

if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string oldFullFileName = fileDialog.FileName;
string safeFileName = fileDialog.SafeFileName;

// Create a new File Name using the output directory
// defined at compile time:
string newFullFileName = outputDirectory + safeFileName;

// Check to see if a file with the same name already exists:
if (File.Exists(newFullFileName))
{
// File.Copy won't let us overwrite. Since the user has no knowledge
// of this directory, we just delete the old, and save the new:
File.Delete(newFullFileName);
}

// Copy the file into our secret hidden directory:
File.Copy(oldFullFileName, newFullFileName);

// ...
// Add code here to persist the file path and other information
// to the data store for access within the application . . .
// ...
}
}
}
}
}
Loading

0 comments on commit bb84b87

Please sign in to comment.