-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Clouz/TestGui
Test gui
- Loading branch information
Showing
18 changed files
with
852 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Excel = Microsoft.Office.Interop.Excel; | ||
|
||
|
||
|
||
namespace ClassiDiScambio.Celle | ||
{ | ||
public class CellID | ||
{ | ||
public int Row { get; set; } | ||
public int Column { get; set; } | ||
|
||
|
||
private Excel.Application application; | ||
private Excel.Workbook workbook; | ||
|
||
public CellID(Excel.Application application) | ||
{ | ||
this.application = application; | ||
this.workbook = application.ActiveWorkbook; | ||
Excel.Worksheet worksheet = workbook.ActiveSheet; | ||
|
||
Row = application.ActiveCell.Row; | ||
Column = application.ActiveCell.Column; | ||
|
||
Excel.Range range = worksheet.UsedRange.Columns[Column]; | ||
|
||
object[,] colonna = range.get_Value(Excel.XlRangeValueDataType.xlRangeValueDefault); | ||
|
||
int conteggio = 0; | ||
|
||
for (int i = 1; i <= colonna.Length; i++) | ||
{ | ||
if (colonna[i,1] is double) | ||
{ | ||
if (conteggio < (double)colonna[i, 1]) | ||
{ | ||
conteggio = int.Parse(colonna[i, 1].ToString()); | ||
} | ||
} | ||
} | ||
|
||
worksheet.Cells[Row, Column] = conteggio+1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{430E6707-F233-4091-8B93-2C2A95BDF03E}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>ClassiDiScambio</RootNamespace> | ||
<AssemblyName>ClassiDiScambio</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<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|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> | ||
<EmbedInteropTypes>True</EmbedInteropTypes> | ||
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<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.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Celle\CreaID.cs" /> | ||
<Compile Include="NumeraFogli\Sheet.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Excel = Microsoft.Office.Interop.Excel; | ||
|
||
|
||
|
||
namespace ClassiDiScambio.NumeraFogli | ||
{ | ||
public class ContenutoFogli | ||
{ | ||
public int Id { get; set; } | ||
public string Description { get; set; } | ||
public string Value { get; set; } | ||
} | ||
|
||
public class Sheet | ||
{ | ||
|
||
public string Cell { get; set; } | ||
|
||
private int _FromSheet; | ||
public int FromSheet | ||
{ | ||
get { return this._FromSheet; } | ||
set | ||
{ | ||
if (this._FromSheet != value && value <= ToSheet && value > 0) | ||
this._FromSheet = value; | ||
} | ||
} | ||
|
||
private int _ToSheet; | ||
public int ToSheet | ||
{ | ||
get { return _ToSheet; } | ||
set { | ||
if (_ToSheet != value && value <= TotalSheet && value >= FromSheet) | ||
_ToSheet = value; | ||
} | ||
} | ||
|
||
public int TotalSheet { get; set; } | ||
|
||
private int _StartingNumber; | ||
public int StartingNumber | ||
{ | ||
get { return _StartingNumber; } | ||
set { _StartingNumber = value; } | ||
} | ||
|
||
public int Row { get; set; } | ||
public int Column { get; set; } | ||
|
||
public List<ContenutoFogli> contenuto { get; set; } = new List<ContenutoFogli>(); | ||
|
||
private Excel.Application application; | ||
private Excel.Workbook workbook; | ||
|
||
|
||
public Sheet(Excel.Application application) | ||
{ | ||
this.application = application; | ||
this.workbook = application.ActiveWorkbook; | ||
Excel.Worksheet worksheets = workbook.ActiveSheet; | ||
|
||
Cell = application.ActiveCell.Address; | ||
Row = application.ActiveCell.Row; | ||
Column = application.ActiveCell.Column; | ||
TotalSheet = workbook.Worksheets.Count; | ||
ToSheet = TotalSheet; | ||
FromSheet = worksheets.Index; | ||
StartingNumber = FromSheet; | ||
|
||
ReloadList(); | ||
} | ||
|
||
public void ReloadList() | ||
{ | ||
contenuto.Clear(); | ||
|
||
for (int i = 1; i <= ToSheet; i++) | ||
{ | ||
Excel.Worksheet worksheets = workbook.Worksheets[i]; | ||
contenuto.Add(new ContenutoFogli() | ||
{ | ||
Id = worksheets.Index, | ||
Description = worksheets.Name, | ||
Value = Convert.ToString((worksheets.Cells[Row, Column] as Excel.Range).Value) | ||
}); | ||
} | ||
} | ||
|
||
public void Write() | ||
{ | ||
Excel.Workbook workbook = application.ActiveWorkbook; | ||
int num = StartingNumber; | ||
for (int i = FromSheet; i <= ToSheet; i++) | ||
{ | ||
Excel.Worksheet worksheets = workbook.Worksheets[i]; | ||
worksheets.Cells[Row, Column] = num++; | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// Le informazioni generali relative a un assembly sono controllate dal seguente | ||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni | ||
// associate a un assembly. | ||
[assembly: AssemblyTitle("ClassiDiScambio")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ClassiDiScambio")] | ||
[assembly: AssemblyCopyright("Copyright © 2017")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili | ||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da | ||
// COM, impostare su true l'attributo ComVisible per tale tipo. | ||
[assembly: ComVisible(false)] | ||
|
||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi | ||
[assembly: Guid("430e6707-f233-4091-8b93-2c2a95bdf03e")] | ||
|
||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: | ||
// | ||
// Versione principale | ||
// Versione secondaria | ||
// Numero di build | ||
// Revisione | ||
// | ||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build | ||
// usando l'asterisco '*' come illustrato di seguito: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net452" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.