Primo rilascio.

This commit is contained in:
Nicola Pievani
2020-08-18 15:20:19 +00:00
parent 2a2fa727b6
commit ab4f471b83
40 changed files with 5145 additions and 0 deletions
@@ -0,0 +1,73 @@
Imports System.ComponentModel
Imports System.Collections.Specialized
Imports System.Windows
Imports System.Windows.Controls.Primitives
Public Class ScrollToTopOnItemsSourceChange
Public Shared ReadOnly ScrollToTopOnItemsSourceChangeProperty As DependencyProperty =
DependencyProperty.RegisterAttached("ScrollToTopOnItemsSourceChange",
GetType(Boolean),
GetType(ScrollToTopOnItemsSourceChange),
New UIPropertyMetadata(False, AddressOf OnScrollToTopOnItemsSourceChangePropertyChanged))
Public Shared Function GetScrollToTopOnItemsSourceChange(ByVal obj As DependencyObject) As Boolean
Return CBool(obj.GetValue(ScrollToTopOnItemsSourceChangeProperty))
End Function
Public Shared Sub SetScrollToTopOnItemsSourceChange(ByVal obj As DependencyObject, ByVal value As Boolean)
obj.SetValue(ScrollToTopOnItemsSourceChangeProperty, value)
End Sub
Private Shared Sub OnScrollToTopOnItemsSourceChangePropertyChanged(ByVal obj As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
Dim itemsControl = TryCast(obj, ItemsControl)
If itemsControl Is Nothing Then
Throw New Exception("ScrollToTopOnItemsSourceChange Property must be attached to an ItemsControl based control.")
End If
Dim descriptor As DependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(itemsControl.ItemsSourceProperty, GetType(ItemsControl))
If descriptor IsNot Nothing Then
If CBool(e.NewValue) Then
descriptor.AddValueChanged(itemsControl, AddressOf ItemsSourceChanged)
Else
descriptor.RemoveValueChanged(itemsControl, AddressOf ItemsSourceChanged)
End If
End If
End Sub
Private Shared Sub ItemsSourceChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim itemsControl = TryCast(sender, ItemsControl)
DoScrollToTop(itemsControl)
Dim collection = TryCast(itemsControl.ItemsSource, INotifyCollectionChanged)
If collection IsNot Nothing Then
AddHandler collection.CollectionChanged, Sub(o, args) DoScrollToTop(itemsControl)
End If
End Sub
Private Shared Sub DoScrollToTop(itemsControl As ItemsControl)
Dim eventHandler As EventHandler = Nothing
eventHandler = New EventHandler(Sub()
If (itemsControl.ItemContainerGenerator.Status = GeneratorStatus.ContainersGenerated) Then
Dim scrollViewer As ScrollViewer = GetVisualChild(Of ScrollViewer)(itemsControl)
scrollViewer.ScrollToTop()
RemoveHandler itemsControl.ItemContainerGenerator.StatusChanged, eventHandler
End If
End Sub)
AddHandler itemsControl.ItemContainerGenerator.StatusChanged, eventHandler
End Sub
Private Shared Function GetVisualChild(Of T As Visual)(ByVal parent As DependencyObject) As T
Dim child As T = Nothing
Dim numVisuals As Integer = VisualTreeHelper.GetChildrenCount(parent)
For i = 0 To numVisuals - 1
Dim v = CType(VisualTreeHelper.GetChild(parent, i), Visual)
child = If(TryCast(v, T), GetVisualChild(Of T)(v))
If child IsNot Nothing Then
Exit For
End If
Next
Return child
End Function
End Class
+60
View File
@@ -0,0 +1,60 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2017
'----------------------------------------------------------------------------
' File : ConstGen.vb Data : 10.04.17 Versione : 1.8d1
' Contenuto : Modulo costanti generali.
'
'
'
' Modifiche : 10.04.17 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstGenSlab
' File con direttorio radice dei dati
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
Public Const S_DATA As String = "Data"
Public Const K_DATAROOT As String = "DataRoot"
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "OmagPHOTO.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_KEY As String = "Key"
' Abilitazioni licenza
Friend Enum KEY_OPT As UInteger
CUT_BASE = 1 ' Prodotto OmagCUT
MAN_MANIP = 2
AUTO_MANIP = 4
MAN_PHOTO = 8
AUTO_PHOTO = 16
AUTO_NESTING = 32
ENABLE_MILL = 64
PROCUCTION_LINE = 128 ' Linea produzione e prodotto OmagVIEW
OFFICE_BASE = 256 ' Prodotto OmagOFFICE
VM_MULTI = 512
UNDER_CUT = 1024
CSV_SIMPLE = 2048
PHOTO_BASE = 4096 ' Prodotto OmagPHOTO
TRF_IMPORT = 8192
End Enum
' File di log generale
Public Const GENLOG_FILE_NAME As String = "OmagPHOTOLog#.txt"
' Sottodirettorio di configurazione
Public Const CONF_DIR As String = "Config"
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
' Sottodirettorio per Img automatico
Public Const IMGAUTO_DIR As String = "ImgAuto"
' Sottodirettorio per BackUp
Public Const BACKUP_DIR As String = "BackUp"
' Costanti per lavorazioni
Public Const PHOTO_GRP As String = "Photos"
Public Const PHOTO_NAME As String = "Raw"
End Module
+107
View File
@@ -0,0 +1,107 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstIniSlab
Public Const INI_FILE_NAME As String = "OmagPHOTO.ini"
Public Const S_GENERAL As String = "General"
Public Const K_DEBUG As String = "Debug"
Public Const K_LICENCE As String = "Licence"
Public Const K_USERLEVEL As String = "UserLevel"
Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
Public Const K_COMMANDLOG As String = "CommandLog"
Public Const K_MESSAGESDIR As String = "MessagesDir"
Public Const K_MESSAGES As String = "Messages"
Public Const K_WINPLACE As String = "WinPlace"
Public Const K_CSVWINPLACE As String = "CsvWinPlace"
Public Const K_MMUNITS As String = "MmUnits"
Public Const K_LASTPROJ As String = "LastProj"
Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
Public Const K_IMAGEDIR As String = "ImageDir"
Public Const K_EXPORTDIR As String = "ExportDir"
Public Const K_CONTOURFROMCAMERA As String = "ContourFromCamera"
Public Const K_SUPPORT As String = "Support"
Public Const K_PHOTODIR As String = "PhotoDir"
Public Const K_CAMERALINK As String = "CameraLink"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
Public Const S_LUA As String = "Lua"
Public Const K_LIBSDIR As String = "LibsDir"
Public Const K_BASELIB As String = "BaseLib"
Public Const S_GEOMDB As String = "GeomDB"
Public Const K_DEFAULTFONT As String = "DefaultFont"
Public Const K_NFEFONTDIR As String = "NfeFontDir"
Public Const K_DEFAULTCOLOR As String = "DefaultColor"
Public Const K_SAVETYPE As String = "SaveType"
Public Const S_OPENGL As String = "OpenGL"
Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
Public Const K_COLORBITS As String = "ColorBits"
Public Const K_DEPTHBITS As String = "DepthBits"
Public Const K_DRIVER As String = "Driver"
Public Const S_SCENE As String = "Scene"
Public Const K_BACKTOP As String = "BackTop"
Public Const K_BACKBOTTOM As String = "BackBottom"
Public Const K_SHOWGFRAME As String = "ShowGFrame"
Public Const K_MARK As String = "Mark"
Public Const K_SELSURF As String = "SelSurf"
Public Const K_SHOWMODE As String = "ShowMode"
Public Const K_CURVEDIR As String = "CurveDir"
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
Public Const K_SHOWZStoneMap As String = "ShowZStoneMap"
Public Const K_TEXMAXLINPIX As String = "TextureMaxLinPixels"
Public Const K_ZOOMWIN As String = "ZoomWin"
Public Const K_DISTLINE As String = "DistLine"
Public Const S_GRID As String = "Grid"
Public Const K_SHOWGRID As String = "ShowGrid"
Public Const K_SHOWFRAME As String = "ShowFrame"
Public Const K_SNAPSTEP As String = "SnapStep"
Public Const K_SNAPSTEPINCH As String = "SnapStepInch"
Public Const K_MINLINESSTEP As String = "MinLineSStep"
Public Const K_MAJLINESSTEP As String = "MajLineSStep"
Public Const K_EXTSSTEP As String = "ExtSStep"
Public Const K_MINLNCOLOR As String = "MinLnColor"
Public Const K_MAJLNCOLOR As String = "MajLnColor"
Public Const S_CAMERA As String = "Camera"
Public Const K_CAM_COUNT As String = "Count"
Public Const K_CAM_EXEPATH As String = "ExePath"
Public Const K_CAM_IMAGE As String = "Image"
Public Const K_CAM_INFO As String = "Info"
Public Const K_CAM_RESULT As String = "Result"
Public Const K_CAM_CONTOUR As String = "Contour"
Public Const K_CAM_EXEPATH2 As String = "ExePath2"
Public Const K_CAM_IMAGE2 As String = "Image2"
Public Const K_CAM_INFO2 As String = "Info2"
Public Const K_CAM_RESULT2 As String = "Result2"
Public Const K_CAM_CONTOUR2 As String = "Contour2"
Public Const K_CAM_THRESHOLD As String = "Threshold"
Public Const K_CAM_TOLERANCE As String = "Tolerance"
Public Const K_CAM_TIMEOUT As String = "Timeout"
Public Const K_CAM_TABLEDIMX As String = "TableDimX"
Public Const K_CAM_TABLEDIMY As String = "TableDimY"
Public Const S_MATERIALS As String = "Materials"
Public Const K_MATERIAL As String = "Material"
Public Const S_SEARCH As String = "Search"
Public Const K_THICKNESSTOLERANCE As String = "ThicknessTolerance"
End Module
+57
View File
@@ -0,0 +1,57 @@
Module ConstMsgSlab
Public Const MSG_SETUPERRORS As Integer = 5000 + 1470
Public Const MSG_MISSINGKEYWD As Integer = 10100
Public Const MSG_NUMERICKEYBOARDWD As Integer = 10200
Public Const MSG_MESSAGEBOX As Integer = 15000
Public Const MSG_OMAGCUT As Integer = 90000
Public Const MSG_GENERAL As Integer = MSG_OMAGCUT
Public Const MSG_WORKINPROGRESSPAGEUC As Integer = MSG_OMAGCUT + 100
Public Const MSG_DIRECTCUTPAGEUC As Integer = MSG_OMAGCUT + 200
Public Const MSG_MANUALAXESMOVEPAGEUC As Integer = MSG_OMAGCUT + 220
Public Const MSG_CADCUTPAGEUC As Integer = MSG_OMAGCUT + 300
Public Const MSG_NESTPAGEUC As Integer = MSG_OMAGCUT + 330
Public Const MSG_SPLITPAGEUC As Integer = MSG_OMAGCUT + 340
Public Const MSG_MOVERAWPAGEUC As Integer = MSG_OMAGCUT + 360
Public Const MSG_DRAWPAGEUC As Integer = MSG_OMAGCUT + 380
Public Const MSG_COMPONENTPAGEUC As Integer = MSG_OMAGCUT + 400
Public Const MSG_IMPORTPAGEUC As Integer = MSG_OMAGCUT + 450
Public Const MSG_OPENPAGEUC As Integer = MSG_OMAGCUT + 490
Public Const MSG_RAWPARTPAGEUC As Integer = MSG_OMAGCUT + 500
Public Const MSG_CHOOSEMACHININGPAGEUC As Integer = MSG_OMAGCUT + 535
Public Const MSG_SIMULATIONPAGEUC As Integer = MSG_OMAGCUT + 550
Public Const MSG_FRAMECUTPAGEUC As Integer = MSG_OMAGCUT + 600
Public Const MSG_MACHINEPAGEUC As Integer = MSG_OMAGCUT + 700
Public Const MSG_TOOLSDBPAGEUC As Integer = MSG_OMAGCUT + 720
Public Const MSG_MACHININGSDBPAGEUC As Integer = MSG_OMAGCUT + 760
Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800
Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900
Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 950
Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980
Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100
Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200
Public Const MSG_OMAGOFFICE As Integer = 91400
'Public Const MSG_OPTIONPANEL As Integer = MSG_OMAGOFFICE
'Public Const MSG_MYMACHININGDBWINDOW As Integer = MSG_OMAGOFFICE + 50
'Public Const MSG_TOPCMDBAR As Integer = MSG_OMAGOFFICE + 100
Public Const MSG_RAWPARTTAB As Integer = MSG_OMAGOFFICE + 150
'Public Const MSG_VEINMATCHING As Integer = MSG_OMAGOFFICE + 200
Public Const MSG_OMAGPHOTO As Integer = 92000
Public Const MSG_OPTIONPANEL As Integer = MSG_OMAGPHOTO + 50
Public Const MSG_SLAB As Integer = MSG_OMAGPHOTO + 70
Public Const MSG_SEARCHPANEL As Integer = MSG_OMAGPHOTO + 150
Public Const MSG_EGTWPFLIB5 As Integer = 30000
Public Const MSG_TOPCOMMANDBAR As Integer = MSG_EGTWPFLIB5 + 500
Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTWPFLIB5 + 800
Public Const MSG_TOOLDB As Integer = MSG_EGTWPFLIB5 + 1000
Public Const MSG_TOOLDBERRORS As Integer = MSG_EGTWPFLIB5 + 1100
Public Const MSG_MACHININGDB As Integer = MSG_EGTWPFLIB5 + 1200
Public Const MSG_MACHININGDBERRORS As Integer = MSG_EGTWPFLIB5 + 1400
Public Const MSG_SIMULATION As Integer = MSG_EGTWPFLIB5 + 1600
End Module
+22
View File
@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtSTONELib", "EgtSTONELib.vbproj", "{2FC41E14-D703-43A1-8AF1-4954AD02A703}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2FC41E14-D703-43A1-8AF1-4954AD02A703}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FC41E14-D703-43A1-8AF1-4954AD02A703}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FC41E14-D703-43A1-8AF1-4954AD02A703}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FC41E14-D703-43A1-8AF1-4954AD02A703}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+200
View File
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<RootNamespace>EgtSTONELib</RootNamespace>
<AssemblyName>EgtSTONELib</AssemblyName>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MyType>Custom</MyType>
<ProjectGuid>{2FC41E14-D703-43A1-8AF1-4954AD02A703}</ProjectGuid>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>true</IncrementalBuild>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>EgtSTONELib.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugSymbols>false</DebugSymbols>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>false</IncrementalBuild>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>EgtSTONELib.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib">
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\..\EgtProg\DllD32\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="InstrumentPanelSlab\InstrumentPanelSlabV.xaml.vb">
<DependentUpon>InstrumentPanelSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="InstrumentPanelSlab\MyInstrumentPanelSlabVM.vb" />
<Compile Include="ProjectSlab\DetailPage\DetailPageSlabV.xaml.vb">
<DependentUpon>DetailPageSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectSlab\DetailPage\DetailPageSlabVM.vb" />
<Compile Include="ProjectSlab\ListPage\ListPageSlabV.xaml.vb">
<DependentUpon>ListPageSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectSlab\ListPage\ListPageSlabVM.vb" />
<Compile Include="ProjectSlab\ProjectSlabV.xaml.vb">
<DependentUpon>ProjectSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectSlab\ProjectSlabVM.vb" />
<Compile Include="ProjectSlab\Slab.vb" />
<Compile Include="SearchPanelSlab\SearchPanelSlabV.xaml.vb">
<DependentUpon>SearchPanelSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="SearchPanelSlab\SearchPanelSlabVM.vb" />
<Compile Include="UtilitySlab\MainData.vb" />
<Compile Include="SceneHostSlab\MySceneHostSlabVM.vb" />
<Compile Include="OptionPanelSlab\OptionPaneSlabV.xaml.vb">
<DependentUpon>OptionPaneSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanelSlab\OptionPanelSlabVM.vb" />
<Compile Include="SceneHostSlab\SceneHostSlabV.xaml.vb">
<DependentUpon>SceneHostSlabV.xaml</DependentUpon>
</Compile>
<Compile Include="UtilitySlab\Camera.vb" />
<Compile Include="UtilitySlab\Dictionary.xaml.vb">
<DependentUpon>Dictionary.xaml</DependentUpon>
</Compile>
<Compile Include="UtilitySlab\ManageDb.vb" />
<Compile Include="UtilitySlab\StoneMap.vb" />
<Compile Include="UtilitySlab\VirtualizingTilePanel.vb" />
<Page Include="InstrumentPanelSlab\InstrumentPanelSlabV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="OptionPanelSlab\OptionPaneSlabV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProjectSlab\DetailPage\DetailPageSlabV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectSlab\ListPage\ListPageSlabV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectSlab\ProjectSlabV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SceneHostSlab\SceneHostSlabV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="AttachedBehaviour\ScrollToTopOnItemsSourceChange.vb" />
<Compile Include="ConstantsSlab\ConstGenSlab.vb" />
<Compile Include="ConstantsSlab\ConstIniSlab.vb" />
<Compile Include="ConstantsSlab\ConstMsgSlab.vb" />
<Page Include="SearchPanelSlab\SearchPanelSlabV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UtilitySlab\Dictionary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Shapes" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
</ItemGroup>
<ItemGroup>
<Compile Include="My Project\AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
</EmbeddedResource>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<AppDesigner Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Dll32\EgtSTONELib.dll
IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Dll64\EgtSTONELib.dll
IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\DllD32\EgtSTONELib.dll
IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\DllD64\EgtSTONELib.dll</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -0,0 +1,14 @@
<EgtFloating:EgtFloatingPanel x:Class="InstrumentPanelSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
IsRightDockable="False" Style="{StaticResource ToolBar_EgtFloatingPanel}">
<ToggleButton ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding GetDistIsChecked}">
<Image Source="/Resources/InstrumentPanel/GetDist.png" Stretch="Uniform"/>
</ToggleButton>
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class InstrumentPanelSlabV
End Class
@@ -0,0 +1,11 @@
Imports EgtWPFLib5
Public Class MyInstrumentPanelSlabVM
Inherits InstrumentPanelVM
Public Overrides Function OnPostGetDistIsChecked() As Boolean
StoneMap.refSceneHostVM.MainScene.SetStatusNull()
Return True
End Function
End Class
+59
View File
@@ -0,0 +1,59 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Globalization
Imports System.Resources
Imports System.Windows
' 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.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("EgtSTONELib")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("EgtSTONELib")>
<Assembly: AssemblyCopyright("Copyright @ 2020")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> to "en-US". Then uncomment the
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
'below to match the UICulture setting in the project file.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
'1st parameter: where theme specific resource dictionaries are located
'(used if a resource is not found in the page,
' or application resource dictionaries)
'2nd parameter: where the generic resource dictionary is located
'(used if a resource is not found in the page,
'app, and any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("7bb25f47-7583-4ffa-a74a-f2d1232c8919")>
' 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 Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
+63
View File
@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'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.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EgtSTONELib.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<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)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
+117
View File
@@ -0,0 +1,117 @@
<?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="BitStoneMap1" 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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+71
View File
@@ -0,0 +1,71 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.EgtSTONELib.MySettings
Get
Return Global.EgtSTONELib.MySettings.Default
End Get
End Property
End Module
End Namespace
+7
View File
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+99
View File
@@ -0,0 +1,99 @@
<EgtFloating:EgtFloatingPanel x:Class="OptionPanelSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWpfLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtSTONELib="clr-namespace:EgtSTONELib"
Width="268" TitleBarOrientation="Vertical" IsToolBar="True"
IsTopDockable="False" IsBottomDockable="False" IsLeftDockable="True"
IsRightDockable="False" Style="{StaticResource Option_EgtFloatingPanel}">
<EgtFloating:EgtFloatingPanel.Resources>
<EgtSTONELib:StateIndexConverter x:Key="StateIndexConverter"/>
</EgtFloating:EgtFloatingPanel.Resources>
<Button Command="{Binding PhotoCommand}"
Grid.Column="1"
Margin="5,0,5,5"
Visibility="{Binding PhotoCommand_Visibility}">
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource OptionPanel_Button}">
<EventSetter Event="MouseRightButtonDown" Handler="Photo_RightClick"/>
</Style>
</Button.Style>
<Image Source="/Resources/DetailPage/Photo.png" Stretch="Uniform"/>
</Button>
<UniformGrid Columns="2" Margin="5,0,5,0" IsEnabled="{Binding EnableParameters}">
<TextBlock Text="{Binding IdMsg}"/>
<EgtWpfLib5:EgtTextBox Text="{Binding SelSlab.Id}"
Margin="13,0,0,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding StateMsg}"/>
<ComboBox Name="ComboState"
ItemsSource="{Binding StateList}"
DisplayMemberPath="Name"
SelectedItem="{Binding SelState}"
Margin="13,0,0,5">
</ComboBox>
<!--<ComboBox.SelectedIndex>
<MultiBinding Converter="{StaticResource StateIndexConverter}">
<Binding Path="SelSlab.State" />
<Binding Path="StateList"/>
</MultiBinding>
</ComboBox.SelectedIndex>-->
<TextBlock Text="{Binding ProjectAssignedToMsg}"/>
<EgtWpfLib5:EgtTextBox Text="{Binding SelSlab.ProjectAssignedTo}"
Margin="13,0,0,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding MaterialMsg}"/>
<ComboBox ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelSlab.Material}"
Margin="13,0,0,5"/>
<TextBlock Text="{Binding ThicknessMsg}"/>
<EgtWpfLib5:EgtTextBox Text="{Binding SelSlab.Thickness}"
Margin="13,0,0,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding WarehousePositionMsg}"/>
<EgtWpfLib5:EgtTextBox Text="{Binding SelSlab.WarehousePosition}"
Margin="13,0,0,5"
TextAlignment="Right"/>
</UniformGrid>
<Button Command="{Binding Remove_Command}"
Content="{Binding RemoveMsg}"
Visibility="{Binding Remove_Visibility}"
Style="{StaticResource OptionPanel_TextButton}"
Margin="5,0,5,5"/>
<UniformGrid Columns="2" Margin="5,0,5,0">
<Button Command="{Binding Cancel_Command}"
Content="{Binding CancelMsg}"
Margin="0,0,2.5,5"
Style="{StaticResource OptionPanel_TextButton}"/>
<Button Command="{Binding Ok_Command}"
Content="{Binding OkMsg}"
Visibility="{Binding OkMsg_Visibility}"
IsEnabled="{Binding Ok_IsEnabled}"
Margin="2.5,0,0,5"
Style="{StaticResource OptionPanel_TextButton}"/>
<Button Command="{Binding Selected_Command}"
Content="{Binding SelectMsg}"
Visibility="{Binding Select_Visibility}"
IsEnabled="{Binding Select_IsEnabled}"
Margin="2.5,0,0,5"
Style="{StaticResource OptionPanel_TextButton}"/>
</UniformGrid>
</EgtFloating:EgtFloatingPanel>
+11
View File
@@ -0,0 +1,11 @@
Public Class OptionPanelSlabV
#Region "EVENTS"
Private Sub Photo_RightClick(sender As Object, e As RoutedEventArgs)
StoneMap.refOptionPanelVM.PhotoFromFile()
End Sub
#End Region ' EVENTS
End Class
+639
View File
@@ -0,0 +1,639 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class OptionPanelSlabVM
Inherits VMBase
Public Event SlabIsSelectedOFFICE(ByRef sender As Object, ByVal e As EventArgs)
Public sSlabId As String
Public sProjectAssigned As String
#Region "FIELDS & PROPERTIES"
Public ReadOnly Property SelSlab As Slab
Get
If IsNothing(StoneMap.refProjectVM) Then Return Nothing
Return StoneMap.refProjectVM.SelSlab
End Get
End Property
Private m_StateList As New List(Of IdNameStruct)
Public Property StateList As List(Of IdNameStruct)
Get
If IsNothing(StoneMap.refProjectVM) Then Return Nothing
m_StateList = StoneMap.refProjectVM.StateList
Return StoneMap.refProjectVM.StateList
End Get
Set(value As List(Of IdNameStruct))
m_StateList = value
End Set
End Property
Private m_LastState As IdNameStruct
Private m_SelState As New IdNameStruct
Public Property SelState As IdNameStruct
Get
Return m_SelState
End Get
Set(value As IdNameStruct)
If Not SelSlab.SetStatus(value.Id) Then
Application.Current.Dispatcher.BeginInvoke(New Action(Sub()
m_SelState = m_LastState
NotifyPropertyChanged("SelState")
End Sub), System.Windows.Threading.DispatcherPriority.ContextIdle, Nothing)
Else
m_SelState = value
NotifyPropertyChanged("SelState")
End If
End Set
End Property
Public Sub SetSelState(CurrState As IdNameStruct)
m_SelState = CurrState
m_LastState = m_SelState
NotifyPropertyChanged("SelState")
End Sub
Public ReadOnly Property MaterialList As List(Of String)
Get
If IsNothing(StoneMap.refProjectVM) Then Return Nothing
Return StoneMap.refProjectVM.MaterialList
End Get
End Property
Public ReadOnly Property PhotoCommand_Visibility As Visibility
Get
If Not IsNothing(StoneMap.refProjectVM) Then
Select Case StoneMap.refProjectVM.SelProjectMode
Case ProjectSlabVM.ProjectModeOpt.DETAIL
Return Visibility.Collapsed
Case ProjectSlabVM.ProjectModeOpt.NEWSLAB
Return Visibility.Visible
End Select
End If
Return Visibility.Collapsed
End Get
End Property
Public ReadOnly Property Remove_Visibility As Visibility
Get
' se OmgaOFFICE nascondo il bottone
If MainData.bIsOmagOFFICE then
Return Visibility.Collapsed
End If
' se OmagPHOTO
If Not IsNothing(StoneMap.refProjectVM) Then
Select Case StoneMap.refProjectVM.SelProjectMode
Case ProjectSlabVM.ProjectModeOpt.DETAIL
Return Visibility.Visible
Case ProjectSlabVM.ProjectModeOpt.NEWSLAB
Return Visibility.Collapsed
End Select
End If
Return Visibility.Collapsed
End Get
End Property
Public ReadOnly Property OkMsg_Visibility As Visibility
Get
' se OmgaOFFICE nascondo il bottone
If MainData.bIsOmagOFFICE then
Return Visibility.Collapsed
End If
' se OmagPHOTO
Return Visibility.Visible
End Get
End Property
Public ReadOnly Property Select_Visibility As Visibility
Get
' se OmgaOFFICE nascondo il bottone
If MainData.bIsOmagOFFICE Then
Return Visibility.Visible
End If
' se OmagPHOTO
Return Visibility.Collapsed
End Get
End Property
Private m_Ok_IsEnabled As Boolean = True
Public Property Ok_IsEnabled As Boolean
Get
Return m_Ok_IsEnabled
End Get
Set(value As Boolean)
m_Ok_IsEnabled = value
NotifyPropertyChanged("Ok_IsEnabled")
End Set
End Property
Private m_Select_IsEnabled As Boolean = True
Public Property Select_IsEnabled As Boolean
Get
Return m_Select_IsEnabled
End Get
Set(value As Boolean)
m_Select_IsEnabled = value
NotifyPropertyChanged("Select_IsEnabled")
End Set
End Property
Private m_EnableParameters As Boolean = Not MainData.bIsOmagOFFICE
Public ReadOnly Property EnableParameters As Boolean
Get
Return m_EnableParameters
End Get
End Property
#Region "Messages"
Public ReadOnly Property IdMsg As String
Get
Return EgtMsg(MSG_SLAB + 1)
End Get
End Property
Public ReadOnly Property ImagePathMsg As String
Get
Return EgtMsg(MSG_SLAB + 2)
End Get
End Property
Public ReadOnly Property StateMsg As String
Get
Return EgtMsg(MSG_SLAB + 3)
End Get
End Property
Public ReadOnly Property ProjectAssignedToMsg As String
Get
Return EgtMsg(MSG_SLAB + 4)
End Get
End Property
Public ReadOnly Property MaterialMsg As String
Get
Return EgtMsg(MSG_RAWPARTPAGEUC + 9)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(MSG_RAWPARTPAGEUC + 5)
End Get
End Property
Public ReadOnly Property WarehousePositionMsg As String
Get
Return EgtMsg(MSG_SLAB + 5)
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
If Not IsNothing(StoneMap.refProjectVM) Then
Select Case StoneMap.refProjectVM.SelProjectMode
Case ProjectSlabVM.ProjectModeOpt.DETAIL
Return EgtMsg(MSG_OPTIONPANEL + 1)
Case ProjectSlabVM.ProjectModeOpt.NEWSLAB
Return EgtMsg(MSG_OPTIONPANEL + 2)
End Select
End If
Return "OkMsg"
End Get
End Property
Public ReadOnly Property CancelMsg As String
Get
Return EgtMsg(MSG_OPTIONPANEL + 3)
End Get
End Property
Public ReadOnly Property RemoveMsg As String
Get
Return EgtMsg(MSG_OPTIONPANEL + 4)
End Get
End Property
Public ReadOnly Property SelectMsg As String
Get
Return "Select"
End Get
End Property
#End Region ' Messages
#Region "ToolTip"
Public ReadOnly Property PhotoToolTip As String
Get
Return EgtMsg(MSG_RAWPARTTAB + 2)
End Get
End Property
#End Region ' ToolTip
' Definizione comandi
Private m_cmdPhoto As ICommand
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Private m_cmdRemove As ICommand
Private m_cmdSelected As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in StoneMap
StoneMap.SetRefOptionPanelVM(Me)
' Assegno funzione per disabilitare bottone di conferma alla lista
Slab.m_IsEnabledBtn = AddressOf IsEnabledBtn
' Funzioni per creare nuovo file Db con tabella
''CreateDbFile()
''CreateTable()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub InitOptionPanel()
Select Case StoneMap.refProjectVM.SelProjectMode
Case ProjectSlabVM.ProjectModeOpt.DETAIL
SelSlab.SetOrigValues()
SelSlab.ResetIsModified()
If MainData.bIsOmagOFFICE AndAlso SelSlab.State <> 1 Then
Select_IsEnabled = False
Else
Select_IsEnabled = True
End If
Case ProjectSlabVM.ProjectModeOpt.NEWSLAB
' Creo nuova lastra corrente con valori di default
StoneMap.refProjectVM.SelSlab = New Slab(String.Empty, String.Empty, Slab.StateOpt.AVAILABLE, String.Empty, String.Empty, 0, String.Empty)
' Creo nuovo progetto
EgtNewFile()
EgtZoom(ZM.ALL)
End Select
' Aggiorno visualizzazione bottone foto perchè potrei essere passato da mod detail a newslab
NotifyPropertyChanged("PhotoCommand_Visibility")
NotifyPropertyChanged("Remove_Visibility")
NotifyPropertyChanged("OkMsg")
NotifyPropertyChanged("SelSlab")
' Aggiorno stato bottone di conferma
IsEnabledBtn(SelSlab.IsValid)
End Sub
Private Sub IsEnabledBtn(IsEnabled As Boolean)
Ok_IsEnabled = IsEnabled
End Sub
' restituisce la lastra con l'identificativo indicato, altrimenti "nothing"
Private Function GetSlabById(ByVal sIdSlab As String) As Slab
Dim CurrSlab As Slab = Nothing
If Not String.IsNullOrEmpty(sIdSlab) Then
For Each ItemSlab In StoneMap.refListPageVM.SlabList
If ItemSlab.Id = sIdSlab Then
CurrSlab = ItemSlab
Exit For
End If
Next
End If
Return CurrSlab
End Function
Public Function GetProjectAssigned(Optional ByVal sLocal_SlabId As String = "") As String
Dim ProjectSlab As String = String.Empty
Dim PreviousSlabOFFICE As Slab
' Aggiorno la precedente lastra selezionata
PreviousSlabOFFICE = GetSlabById(sLocal_SlabId)
If IsNothing(PreviousSlabOFFICE) Then
PreviousSlabOFFICE = GetSlabById(sSlabId)
End If
If Not IsNothing(PreviousSlabOFFICE) Then
ProjectSlab = PreviousSlabOFFICE.ProjectAssignedTo
End If
Return ProjectSlab
End Function
Public Sub SetMaterialFromDB()
Dim MatList As List(Of String) = ManageDb.FindAllMaterialInDB()
StoneMap.refProjectVM.MaterialList.Clear()
For Each Item In MatList
StoneMap.refProjectVM.MaterialList.Add(Item)
Next
StoneMap.refOptionPanelVM.NotifyPropertyChanged("MaterialList")
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "PhotoCommand"
Public ReadOnly Property PhotoCommand As ICommand
Get
If m_cmdPhoto Is Nothing Then
m_cmdPhoto = New Command(AddressOf Photo)
End If
Return m_cmdPhoto
End Get
End Property
Public Sub Photo(ByVal param As Object)
' Se macchina fotografica collegata, faccio una foto
If StoneMap.refProjectVM.m_Camera.GetCameraLink() Then
If StoneMap.refProjectVM.m_Camera.CameraClick() Then
SelSlab.ImagePath = "*"
Else
LibMap.refStatusBarVM.SetOutputMessage(EgtMsg(90313), 5, MSG_TYPE.ERROR_) 'Fotografia non riuscita
End If
' Altrimenti lancio browser di immagini
Else
PhotoFromFile()
End If
End Sub
Friend Sub PostPhoto(sPath As String, sContour As String)
' Carico la foto
StoneMap.refDetailPageVM.LoadPhoto(sPath)
' Se richiesto il riconoscimento del contorno
'If Not String.IsNullOrEmpty(sContour) Then
' If Not m_MainWindow.m_CurrentProjectPageUC.LoadContour(sContour) Then
' m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90324)) 'Riconoscimento contorno non riuscito
' End If
'End If
' Aggiorno visualizzazione
EgtZoom(ZM.ALL)
End Sub
Friend Sub PhotoFromFile()
' Apro dialogo per scelta immagine
Dim PhotoDlg As New Microsoft.Win32.OpenFileDialog
PhotoDlg.Title = "Open"
PhotoDlg.Filter = "Image file(*.jpg;*.png;*.bmp)|*.jpg;*.png;*.bmp"
PhotoDlg.FilterIndex = 1
GetMainPrivateProfileString(S_GENERAL, K_IMAGEDIR, "", PhotoDlg.InitialDirectory)
If Not PhotoDlg.ShowDialog Then Return
Dim sPhoto As String = PhotoDlg.FileName
' Assegno la path dell'immagine selezionata
SelSlab.ImagePath = sPhoto
' Altri dati foto
' Carico immagine
If Not StoneMap.refDetailPageVM.LoadPhoto(sPhoto) Then
' Errore nel caricamento della fotografia
MessageBox.Show(EgtMsg(MSG_RAWPARTTAB + 1), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' Aggiorno visualizzazione
EgtZoom(ZM.ALL)
End Sub
Private Function CopyPhoto(OrigPath As String) As String
Dim OrigTxtPath As String = Path.ChangeExtension(OrigPath, "txt")
Dim ImgName As String = ValidateFileName(SelSlab.Id)
Dim ImgExt As String = Path.GetExtension(OrigPath)
Dim nI As Integer = 0
Dim NewImgPath As String = Path.Combine(MainData.sPhotoDir, ImgName & ImgExt)
While File.Exists(NewImgPath)
nI += 1
NewImgPath = Path.Combine(MainData.sPhotoDir, ImgName & "_" & nI.ToString() & ImgExt)
End While
Dim NewTxtPath As String = Path.ChangeExtension(NewImgPath, "txt")
Try
File.Copy(OrigPath, NewImgPath, True)
File.Copy(OrigTxtPath, NewTxtPath, True)
Catch ex As Exception
Return String.Empty
End Try
Return Path.GetFileName(NewImgPath)
End Function
Private Function ValidateFileName(sFileName As String) As String
Dim sTemp As String = sFileName
For Each badChar As Char In Path.GetInvalidFileNameChars()
sTemp = sTemp.Replace(badChar, "_")
Next
Return sTemp
End Function
#End Region ' PhotoCommand
#Region "Select"
Public ReadOnly Property Selected_Command As ICommand
Get
If m_cmdSelected Is Nothing Then
m_cmdSelected = New Command(AddressOf Selected)
End If
Return m_cmdSelected
End Get
End Property
Public Sub SetAvailableSlab(Optional ByVal sLocal_SlabId As String = "")
Dim Query As String
Dim PreviousSlabOFFICE As Slab
' Aggiorno la precedente lastra selezionata
PreviousSlabOFFICE = GetSlabById(sLocal_SlabId)
If IsNothing(PreviousSlabOFFICE) Then
PreviousSlabOFFICE = GetSlabById(sSlabId)
End If
If Not IsNothing(PreviousSlabOFFICE) Then
' Assegno lo stato AVAILABLE
If PreviousSlabOFFICE.State <> Slab.StateOpt.TAKEN Then
PreviousSlabOFFICE.SetStatus(Slab.StateOpt.AVAILABLE)
End If
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_STATE & " = '" & PreviousSlabOFFICE.State & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & PreviousSlabOFFICE.Id & "'"
ManageDb.ExecuteQuery(Query)
Query = String.Empty
' Cancello il Progetto
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_PROJASSIGNEDTO & " = '" & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & PreviousSlabOFFICE.Id & "'"
ManageDb.ExecuteQuery(Query)
Query = String.Empty
End If
End Sub
Public Sub SetAssignedSlab(Optional ByVal sLocal_SlabId As String = "")
Dim Query As String
Dim PreviousSlabOFFICE As Slab
' Aggiorno la precedente lastra selezionata
PreviousSlabOFFICE = GetSlabById(sLocal_SlabId)
If IsNothing(PreviousSlabOFFICE) Then
PreviousSlabOFFICE = GetSlabById(sSlabId)
End If
If Not IsNothing(PreviousSlabOFFICE) Then
' Assegno lo stato ASSIGNED
If PreviousSlabOFFICE.State <> Slab.StateOpt.TAKEN Then
PreviousSlabOFFICE.SetStatus(Slab.StateOpt.AVAILABLE)
End If
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_STATE & " = '" & PreviousSlabOFFICE.State & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & PreviousSlabOFFICE.Id & "'"
ManageDb.ExecuteQuery(Query)
Query = String.Empty
' Assegno il Progetto
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_PROJASSIGNEDTO & " = '" & sProjectAssigned & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & PreviousSlabOFFICE.Id & "'"
ManageDb.ExecuteQuery(Query)
Query = String.Empty
End If
End Sub
Public Sub Selected(ByVal param As Object)
StoneMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.LIST
Dim Query As String
' Aggiorno la lastra con le modifiche
' Assegno lo stato ASSIGNED
StoneMap.refProjectVM.SelSlab.SetStatus(Slab.StateOpt.ASSIGNED)
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_STATE & " = '" & SelSlab.State & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & SelSlab.OrigId & "'"
ManageDb.ExecuteQuery(Query)
Query = String.Empty
' Assegno il Progetto
If Not String.IsNullOrEmpty(sProjectAssigned) Then
SelSlab.ProjectAssignedTo = sProjectAssigned
Query = "UPDATE " & Slab.DB_SLABS & " SET " & Slab.DB_PROJASSIGNEDTO & " = '" & sProjectAssigned & "', "
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & SelSlab.Id & "'"
ManageDb.ExecuteQuery(Query)
End If
' comunico l'evento di modifica della pagina
RaiseEvent SlabIsSelectedOFFICE(Me, EventArgs.Empty)
End Sub
#end region ' SelectCommand
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok(ByVal param As Object)
Select Case StoneMap.refProjectVM.SelProjectMode
Case ProjectSlabVM.ProjectModeOpt.DETAIL
If SelSlab.IsModified Then
' Aggiorno la lastra con le modifiche
Dim Query As String = "UPDATE " & Slab.DB_SLABS & " SET " &
If(SelSlab.IsModifiedId, Slab.DB_ID & " = '" & SelSlab.Id & "', ", "") &
If(SelSlab.IsModifiedState, Slab.DB_STATE & " = '" & SelSlab.State & "', ", "") &
If(SelSlab.IsModifiedProjectAssignedTo, Slab.DB_PROJASSIGNEDTO & " = '" & SelSlab.ProjectAssignedTo & "', ", "") &
If(SelSlab.IsModifiedMaterial, Slab.DB_MATERIAL & " = '" & SelSlab.Material & "', ", "") &
If(SelSlab.IsModifiedThickness, Slab.DB_THICKNESS & " = '" & SelSlab.Thickness & "', ", "") &
If(SelSlab.IsModifiedWarehousePosition, Slab.DB_WAREHOUSEPOS & " = '" & SelSlab.WarehousePosition & "'", "")
Query = Query.TrimEnd(","c, " "c)
Query &= "WHERE Id = '" & SelSlab.OrigId & "'"
ManageDb.ExecuteQuery(Query)
End If
Case ProjectSlabVM.ProjectModeOpt.NEWSLAB
' Copio immagine
Dim sImgSource As String
If SelSlab.ImagePath = "*" Then
sImgSource = StoneMap.refProjectVM.m_Camera.ImageDir & "\" & Camera.FINAL_IMAGE
Else
sImgSource = SelSlab.ImagePath
End If
Dim sCopyImagePath As String = CopyPhoto(sImgSource)
If Not String.IsNullOrEmpty(sCopyImagePath) Then
SelSlab.ImagePath = sCopyImagePath
Else
Dim sMsg As String = "Error copying image or auxiliary info"
LibMap.refStatusBarVM.SetOutputMessage(sMsg, 5, MSG_TYPE.ERROR_)
Return
End If
' Aggiungo la nuova lastra al Db
Dim Query As String = "INSERT INTO " & Slab.DB_SLABS & " (" & Slab.DB_ID & ", " & Slab.DB_IMAGEPATH & ", " & Slab.DB_STATE & ", " & Slab.DB_PROJASSIGNEDTO & ", " & Slab.DB_MATERIAL & ", " & Slab.DB_THICKNESS & ", " & Slab.DB_WAREHOUSEPOS & ", " & Slab.DB_ADDEDDATE & ")" &
" VALUES ('" & SelSlab.Id & "', " &
"'" & SelSlab.ImagePath & "', " &
SelSlab.State & ", " &
"'" & SelSlab.ProjectAssignedTo & "', " &
"'" & SelSlab.Material & "', " &
SelSlab.Thickness & ", " &
"'" & SelSlab.WarehousePosition & "', " &
"Date('" & (String.Format("{0:yyyy-MM-dd}", SelSlab.AddedDate)) & "'))"
ManageDb.ExecuteQuery(Query)
End Select
StoneMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.LIST
End Sub
#End Region ' Ok
#Region "Cancel"
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Cancel(ByVal param As Object)
StoneMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.LIST
End Sub
#End Region ' Cancel
#Region "Remove"
Public ReadOnly Property Remove_Command As ICommand
Get
If m_cmdRemove Is Nothing Then
m_cmdRemove = New Command(AddressOf Remove)
End If
Return m_cmdRemove
End Get
End Property
Public Sub Remove(ByVal param As Object)
' chiedo conferma
If MessageBox.Show(EgtMsg(MSG_OPTIONPANEL + 5), "", MessageBoxButton.YesNo, MessageBoxImage.Question) <>
MessageBoxResult.Yes Then Return
Dim sImagePath As String = SelSlab.ImagePath
' elimino dal Db
Dim Query As String = "DELETE FROM " & Slab.DB_SLABS & " WHERE " &
Slab.DB_ID & " = '" & SelSlab.Id & "'"
If ManageDb.ExecuteQuery(Query) <> 0 Then
' elimino anche la relativa foto
Try
If Not File.Exists(sImagePath) Then
sImagePath = MainData.sPhotoDir & "\" & sImagePath
End If
File.Delete(sImagePath)
File.Delete(Path.ChangeExtension(sImagePath, "txt"))
Catch ex As FileNotFoundException
' non è un problema
Catch ex As Exception
' non è un problema
End Try
End If
' elimino dalla lista
StoneMap.refProjectVM.SlabList.Remove(SelSlab)
' torno alla lista
StoneMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.LIST
End Sub
#End Region ' Remove
#End Region ' COMMANDS
End Class
@@ -0,0 +1,21 @@
<EgtFloating:EgtFloatingManager x:Class="DetailPageSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtSTONELib="clr-namespace:EgtSTONELib"
DataContext="{StaticResource DetailPageSlabVM}">
<EgtFloating:EgtFloatingTray x:Name="LEFTTRAY" DockPanel.Dock="Left">
<EgtSTONELib:OptionPanelSlabV DataContext="{StaticResource OptionPanelSlabVM}"
Height="{Binding ActualHeight,ElementName=LEFTTRAY}"/>
</EgtFloating:EgtFloatingTray>
<EgtFloating:EgtFloatingTray x:Name="TOPTRAY" DockPanel.Dock="Top">
<EgtSTONELib:InstrumentPanelSlabV DataContext="{StaticResource MyInstrumentPanelSlabVM}"/>
</EgtFloating:EgtFloatingTray>
<!--Scena restituita sotto forma di WindowsFormsHost-->
<EgtSTONELib:SceneHostSlabV/>
</EgtFloating:EgtFloatingManager>
@@ -0,0 +1,6 @@
Imports System.ComponentModel
Public Class DetailPageSlabV
Sub New
InitializeComponent()
End Sub
End Class
+124
View File
@@ -0,0 +1,124 @@
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class DetailPageSlabVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Dimensioni tavola per fotografie lette da file ini
Private m_TableDimX As Double = 0
Private m_TableDimY As Double = 0
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in StoneMap
StoneMap.SetRefDetailPageVM(Me)
' Recupero dimensioni tavola per fotografia da file ini
m_TableDimX = GetMainPrivateProfileDouble(S_CAMERA, K_CAM_TABLEDIMX, 6000)
m_TableDimY = GetMainPrivateProfileDouble(S_CAMERA, K_CAM_TABLEDIMX, 6000)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Sub InitDetailPage()
LoadPhoto(StoneMap.refProjectVM.SelSlab.ImagePath)
EgtZoom(ZM.ALL)
' notifico lo stato della lastra
For Each Item In StoneMap.refOptionPanelVM.StateList
If Item.Id = StoneMap.refOptionPanelVM.SelSlab.State Then
StoneMap.refOptionPanelVM.SetSelState(Item)
Exit For
End If
Next
For Each ItemMaterial In StoneMap.refProjectVM.MaterialList
If ItemMaterial = StoneMap.refProjectVM.SelSlab.Material Then
StoneMap.refProjectVM.SelSlab.SetMaterial(ItemMaterial)
Exit For
End If
Next
End Sub
Friend Function LoadPhoto(sPath As String) As Boolean
' Verifico esistenza file immagine
If Not File.Exists(sPath) Then Return False
' Leggo eventuale file dati aggiuntivi
Dim ptOri As New Point3d(0, 0, 0)
Dim ptCen As New Point3d(0, 0, INFINITO)
Dim dMMxPixel As Double = 1
ReadAuxData(sPath, ptOri, ptCen, dMMxPixel)
' Aggiusto dati per spessore grezzo
If Math.Abs(StoneMap.refProjectVM.SelSlab.GetThickness) > EPS_SMALL Then
' Coefficiente di scalatura
Dim dFsca As Double = (ptCen.z - StoneMap.refProjectVM.SelSlab.GetThickness) / (ptCen.z - ptOri.z)
dMMxPixel *= dFsca
ptOri.x = ptCen.x + (ptOri.x - ptCen.x) * dFsca
ptOri.y = ptCen.y + (ptOri.y - ptCen.y) * dFsca
ptOri.z = StoneMap.refProjectVM.SelSlab.GetThickness
End If
' Elimino eventuale precedente foto
Dim nOldPhotoId = GetPhoto()
If nOldPhotoId <> GDB_ID.NULL Then EgtErase(nOldPhotoId)
' Se non esiste il gruppo per le foto, lo creo
Dim nPhGrpId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)
If nPhGrpId = GDB_ID.NULL Then
nPhGrpId = EgtCreateGroup(GDB_ID.ROOT)
If nPhGrpId = GDB_ID.NULL Then Return False
EgtSetName(nPhGrpId, PHOTO_GRP)
End If
EgtSetLevel(nPhGrpId, GDB_LV.SYSTEM)
' Carico la fotografia
Return EgtAddPhoto(PHOTO_NAME, sPath, ptOri, ptCen, dMMxPixel, nPhGrpId, New Point3d(0, 0, 0), New Point3d(m_TableDimX, m_TableDimY, 0)) <> GDB_ID.NULL
End Function
Private Function ReadAuxData(sPath As String,
ByRef ptOri As Point3d, ByRef ptCen As Point3d, ByRef dMMxPixel As Double) As Boolean
Dim sAuxPath As String = Path.ChangeExtension(sPath, ".txt")
Try
Dim sLine As String = String.Empty
Dim sr As StreamReader = New StreamReader(sAuxPath)
Do While sr.Peek() > -1
sLine = sr.ReadLine()
sLine = sLine.Replace(" ", "")
If sLine.StartsWith("X=") Then
StringToDouble(sLine.Substring(2), ptOri.x)
ElseIf sLine.StartsWith("Y=") Then
StringToDouble(sLine.Substring(2), ptOri.y)
ElseIf sLine.StartsWith("Z_Lastra=") Then
StringToDouble(sLine.Substring(9), ptOri.z)
ElseIf sLine.StartsWith("X_ScaleCenter=") Then
StringToDouble(sLine.Substring(14), ptCen.x)
ElseIf sLine.StartsWith("Y_ScaleCenter=") Then
StringToDouble(sLine.Substring(14), ptCen.y)
ElseIf sLine.StartsWith("Z_ScaleCenter=") Then
StringToDouble(sLine.Substring(14), ptCen.z)
ElseIf sLine.StartsWith("Pixelxmm=") Then
Dim dTmp As Double
StringToDouble(sLine.Substring(9), dTmp)
If dTmp > EPS_SMALL Then
dMMxPixel = 1 / dTmp
End If
End If
Loop
sr.Close()
Return True
Catch ex As Exception
EgtOutLog("LoadPhoto Error on auxfile : " & sAuxPath)
Return False
End Try
End Function
Private Function GetPhoto() As Integer
Dim nPhGrpId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)
Return EgtGetFirstNameInGroup(nPhGrpId, PHOTO_NAME)
End Function
#End Region ' METHODS
End Class
+68
View File
@@ -0,0 +1,68 @@
<EgtFloating:EgtFloatingManager x:Class="ListPageSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtSTONELib="clr-namespace:EgtSTONELib"
DataContext="{StaticResource ListPageSlabVM}">
<EgtFloating:EgtFloatingManager.Resources>
<Style x:Key="SlabListStyle" TargetType="{x:Type ItemsControl}">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<ScrollViewer CanContentScroll="True">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</EgtFloating:EgtFloatingManager.Resources>
<EgtFloating:EgtFloatingTray x:Name="LEFTTRAY" DockPanel.Dock="Left">
<EgtSTONELib:SearchPanelSlabV DataContext="{StaticResource SearchPanelSlabVM}"
Height="{Binding MaxHeight,ElementName=LEFTTRAY}"/>
</EgtFloating:EgtFloatingTray>
<ItemsControl Style="{StaticResource SlabListStyle}"
x:Name="SlabItemsControl"
ItemsSource="{Binding SlabList}"
EgtSTONELib:ScrollToTopOnItemsSourceChange.ScrollToTopOnItemsSourceChange="True">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Button Command="{Binding DataContext.SlabBtn_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtFloating:EgtFloatingManager}}}"
CommandParameter="{Binding}"
ToolTip="{Binding Slab_Tooltip}"
Focusable="False"
Padding="5"
VerticalContentAlignment="Stretch">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Id}"
Grid.Row="0"
Margin="0,0,0,5"/>
<Image Source="{Binding GraphicalImagePath}"
Grid.Row="1"
Stretch="Uniform"/>
</Grid>
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<EgtSTONELib:VirtualizingTilePanel ChildSize="{Binding ChildSize,
RelativeSource={RelativeSource AncestorType={x:Type EgtFloating:EgtFloatingManager}}}"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</EgtFloating:EgtFloatingManager>
@@ -0,0 +1,31 @@
Imports System.ComponentModel
Public Class ListPageSlabV
Implements INotifyPropertyChanged
Sub new
InitializeComponent()
End Sub
Public ReadOnly Property ChildSize As Double
Get
If Not IsNumeric(SlabItemsControl.ActualWidth) Then Return 200.0
If StoneMap.refSearchPanelVM.Search_IsChecked Then
Return (SlabItemsControl.ActualWidth - 22) / 4
Else
Return (SlabItemsControl.ActualWidth - 22) / 6
End If
End Get
End Property
Private Sub SlabItemsControl_SizeChanged(sender As Object, e As SizeChangedEventArgs) Handles SlabItemsControl.SizeChanged
NotifyPropertyChanged("ChildSize")
End Sub
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
+69
View File
@@ -0,0 +1,69 @@
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Public Class ListPageSlabVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Public ReadOnly Property SlabList As ObservableCollection(Of Slab)
Get
If IsNothing(StoneMap.refProjectVM) Then Return Nothing
Return StoneMap.refProjectVM.SlabList
End Get
End Property
' definizione comandi
Private m_cmdSlabBtn As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in StoneMap
StoneMap.SetRefListPageVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Sub InitListPage()
If StoneMap.refSearchPanelVM.Search_IsChecked Then
StoneMap.refSearchPanelVM.Search()
Else
StoneMap.refProjectVM.SlabList = New ObservableCollection(Of Slab)(ManageDb.ExecuteSlabReaderQuery("SELECT * FROM " & Slab.DB_SLABS & " ORDER BY " & Slab.DB_MATERIAL & ", " & Slab.DB_STATE))
End If
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "SlabBtn"
'Public Event SlabIsSelected(ByRef sender As Object, ByVal e As EventArgs)
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property SlabBtn_Command() As ICommand
Get
If m_cmdSlabBtn Is Nothing Then
m_cmdSlabBtn = New Command(AddressOf SlabBtn)
End If
Return m_cmdSlabBtn
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub SlabBtn(ByVal param As Object)
StoneMap.refProjectVM.SelSlab = param
StoneMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.DETAIL
'RaiseEvent SlabIsSelected(Me, EventArgs.Empty)
End Sub
#End Region ' SlabBtn
#End Region ' COMMANDS
End Class
+7
View File
@@ -0,0 +1,7 @@
<UserControl x:Class="ProjectSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ContentControl Content="{Binding ProjectContent}"/>
</UserControl>
+5
View File
@@ -0,0 +1,5 @@
Public Class ProjectSlabV
Sub New()
InitializeComponent()
End Sub
End Class
+144
View File
@@ -0,0 +1,144 @@
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Imports EgtUILib
Public Class ProjectSlabVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' definisco l'evento per gestire la selezione della lastra
Public Event SlabIsSelected(ByRef sender As Object, ByVal e As EventArgs)
' Oggetto di gestione della macchina fotografica
Friend m_Camera As New Camera
Public Enum ProjectModeOpt As Integer
LIST = 1
DETAIL = 2
NEWSLAB = 3
End Enum
Private m_SelProjectMode As ProjectModeOpt = ProjectModeOpt.LIST
Public Property SelProjectMode As ProjectModeOpt
Get
Return m_SelProjectMode
End Get
Set(value As ProjectModeOpt)
' Esco dallo stato corrente
Select Case m_SelProjectMode
Case ProjectModeOpt.LIST
StoneMap.refSearchPanelVM.Search_IsEnabled = False
Case ProjectModeOpt.DETAIL, ProjectModeOpt.NEWSLAB
EgtNewFile()
End Select
' Entro nel nuovo stato
m_SelProjectMode = value
Select Case m_SelProjectMode
Case ProjectModeOpt.LIST
StoneMap.refSearchPanelVM.Search_IsEnabled = True
StoneMap.refListPageVM.InitListPage()
Case ProjectModeOpt.DETAIL
StoneMap.refDetailPageVM.InitDetailPage()
StoneMap.refOptionPanelVM.InitOptionPanel()
Case ProjectModeOpt.NEWSLAB
StoneMap.refOptionPanelVM.InitOptionPanel()
End Select
' comunico l'evento di modifica della pagina
RaiseEvent SlabIsSelected(Me, EventArgs.Empty)
NotifyPropertyChanged("ProjectContent")
NotifyPropertyChanged("OptionContent")
End Set
End Property
Private m_DetailPageV As New DetailPageSlabV
Private m_ListPageV As New ListPageSlabV
Public ReadOnly Property ProjectContent As FrameworkElement
Get
Select Case m_SelProjectMode
Case ProjectModeOpt.LIST
Return m_ListPageV
Case ProjectModeOpt.DETAIL
Return m_DetailPageV
Case ProjectModeOpt.NEWSLAB
Return m_DetailPageV
Case Else
Return m_ListPageV
End Select
End Get
End Property
Private m_SlabList As New ObservableCollection(Of Slab)
Public Property SlabList As ObservableCollection(Of Slab)
Get
Return m_SlabList
End Get
Set(value As ObservableCollection(Of Slab))
m_SlabList = value
StoneMap.refListPageVM.NotifyPropertyChanged("SlabList")
End Set
End Property
Private m_SelSlab As Slab
Public Property SelSlab As Slab
Get
Return m_SelSlab
End Get
Set(value As Slab)
m_SelSlab = value
NotifyPropertyChanged("SelSlab")
End Set
End Property
Private m_StateList As New List(Of IdNameStruct)({New IdNameStruct(Slab.StateOpt.AVAILABLE, "AVAILABLE"),
New IdNameStruct(Slab.StateOpt.ASSIGNED, "ASSIGNED"),
New IdNameStruct(Slab.StateOpt.TAKEN, "TAKEN")})
Public ReadOnly Property StateList As List(Of IdNameStruct)
Get
Return m_StateList
End Get
End Property
Private m_MaterialList As New List(Of String)
Public Property MaterialList As List(Of String)
Get
Return m_MaterialList
End Get
Set(value As List(Of String))
m_MaterialList = value
StoneMap.refOptionPanelVM.NotifyPropertyChanged("MaterialList")
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
'If Not OmagOFFICEMap.refMainWindowVM.MainWindowM.m_SlabDB Then Return
' Creo riferimento a questa classe in StoneMap
StoneMap.SetRefProjectVM(Me)
' Setto la ricerca come non attiva
StoneMap.refSearchPanelVM.SetSearch_IsChecked(False)
EgtSTONELib.StoneMap.refSearchPanelVM.Search_IsEnabled = True
EgtSTONELib.StoneMap.refListPageVM.InitListPage()
' Leggo lista materiali da file ini
Dim Index As Integer = 1
Dim sMaterial As String = String.Empty
While GetMainPrivateProfileString(S_MATERIALS, K_MATERIAL & Index, "", sMaterial) > 0
If Not String.IsNullOrWhiteSpace(sMaterial) Then
MaterialList.Add(sMaterial)
End If
Index += 1
End While
' Creo lista stati per SearchPanel
Dim SearchStateList As New List(Of IdNameStruct)(StateList)
SearchStateList.Insert(0, New IdNameStruct(0, String.Empty))
StoneMap.refSearchPanelVM.SetStateList(SearchStateList)
End Sub
#End Region ' CONSTRUCTOR
End Class
+504
View File
@@ -0,0 +1,504 @@
Imports System.Collections.ObjectModel
Imports System.Data.SQLite
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports System.Text.RegularExpressions
Public Class Slab
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Public Const DB_SLABS As String = "Slabs"
Public Const DB_ID As String = "Id"
Public Const DB_IMAGEPATH As String = "ImagePath"
Public Const DB_STATE As String = "State"
Public Const DB_PROJASSIGNEDTO As String = "ProjectAssignedTo"
Public Const DB_MATERIAL As String = "Material"
Public Const DB_THICKNESS As String = "Thickness"
Public Const DB_WAREHOUSEPOS As String = "WarehousePosition"
Public Const DB_ADDEDDATE As String = "AddedDate"
Friend Shared m_IsEnabledBtn As Action(Of Boolean)
Public Enum StateOpt As Integer
AVAILABLE = 1
ASSIGNED = 2
TAKEN = 3
End Enum
Private m_IsModifiedId As Boolean = False
Friend ReadOnly Property IsModifiedId As Boolean
Get
Return m_IsModifiedId
End Get
End Property
Private m_OrigId As String
Friend ReadOnly Property OrigId As String
Get
Return m_OrigId
End Get
End Property
Private m_Id As String
Public Property Id As String
Get
Return m_Id
End Get
Set(value As String)
If Not String.IsNullOrWhiteSpace(value) Then
m_Id = value
m_IsModifiedId = m_Id <> m_OrigId
Else
NotifyPropertyChanged("Id")
End If
m_IsEnabledBtn(IsValid And IsModified)
If Not String.IsNullOrWhiteSpace(m_IdError) Then
LibMap.refStatusBarVM.SetOutputMessage(m_IdError, 5, MSG_TYPE.ERROR_)
End If
End Set
End Property
Public ReadOnly Property GraphicalImagePath As BitMapImage
Get
Dim src As BitMapImage = New BitMapImage()
src.BeginInit()
src.DecodePixelWidth = 256
src.CacheOption = BitMapCacheOption.OnLoad
src.UriSource = New Uri(m_ImagePath, UriKind.Absolute)
src.EndInit()
Return src
End Get
End Property
Private m_IsModifiedImagePath As Boolean = False
Friend ReadOnly Property IsModifiedImagePath As Boolean
Get
Return m_IsModifiedImagePath
End Get
End Property
Private m_OrigImagePath As String
Private m_ImagePath As String
Public Property ImagePath As String
Get
Return m_ImagePath
End Get
Set(value As String)
If Not String.IsNullOrWhiteSpace(value) Then
m_ImagePath = value
m_IsModifiedImagePath = m_ImagePath <> m_OrigImagePath
Else
NotifyPropertyChanged("ImagePath")
End If
m_IsEnabledBtn(IsValid And IsModified)
If Not String.IsNullOrWhiteSpace(m_ImagePathError) Then
LibMap.refStatusBarVM.SetOutputMessage(m_ImagePathError, 5, MSG_TYPE.ERROR_)
End If
End Set
End Property
Private m_IsModifiedState As Boolean = False
Friend ReadOnly Property IsModifiedState As Boolean
Get
Return m_IsModifiedState
End Get
End Property
Private m_OrigState As StateOpt
Private m_State As StateOpt
Private m_LastState As StateOpt
Public Property State As StateOpt
Get
Return m_State
End Get
Set(value As StateOpt)
m_LastState = m_State
End Set
End Property
Public Function SetStatus(nStatus As StateOpt) As Boolean
Select Case nStatus
Case StateOpt.TAKEN
If String.IsNullOrEmpty(Me.ProjectAssignedTo) Then Return False
If MessageBox.Show("Stai prelevando una lastra assegnata al progetto: " & Me.ProjectAssignedTo & vbCrLf & "Vuoi procedere?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then
Return False
End If
Case StateOpt.ASSIGNED
If Not MainData.bIsOmagOFFICE AndAlso String.IsNullOrEmpty(Me.ProjectAssignedTo) Then
If MessageBox.Show("Stai assegnado una lastra senza progetto: " & Me.ProjectAssignedTo & vbCrLf & "Vuoi procedere?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then
Return False
End If
End If
Case StateOpt.AVAILABLE
If Not MainData.bIsOmagOFFICE AndAlso Not String.IsNullOrEmpty(Me.ProjectAssignedTo) Then
If MessageBox.Show("Stai liberando una lastra con progetto: " & Me.ProjectAssignedTo & vbCrLf & "Vuoi procedere?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then
Return False
End If
End If
End Select
m_State = nStatus
m_IsModifiedState = m_State <> m_OrigState
m_IsEnabledBtn(IsValid And IsModified)
Return True
End Function
Private m_IsModifiedProjectAssignedTo As Boolean = False
Friend ReadOnly Property IsModifiedProjectAssignedTo As Boolean
Get
Return m_IsModifiedProjectAssignedTo
End Get
End Property
Private m_OrigProjectAssignedTo As String
Private m_ProjectAssignedTo As String
Public Property ProjectAssignedTo As String
Get
Return m_ProjectAssignedTo
End Get
Set(value As String)
m_ProjectAssignedTo = value
m_IsModifiedProjectAssignedTo = m_ProjectAssignedTo <> m_OrigProjectAssignedTo
m_IsEnabledBtn(IsValid And IsModified)
End Set
End Property
Private m_IsModifiedMaterial As Boolean = False
Friend ReadOnly Property IsModifiedMaterial As Boolean
Get
Return m_IsModifiedMaterial
End Get
End Property
Private m_OrigMaterial As String
Private m_Material As String
Public Property Material As String
Get
Return m_Material
End Get
Set(value As String)
m_Material = value
m_IsModifiedMaterial = m_Material <> m_OrigMaterial
m_IsEnabledBtn(IsValid And IsModified)
NotifyPropertyChanged("Material")
End Set
End Property
Public Sub SetMaterial(sMaterial As String)
m_Material = sMaterial
NotifyPropertyChanged("Material")
End Sub
Private m_IsModifiedThickness As Boolean = False
Friend ReadOnly Property IsModifiedThickness As Boolean
Get
Return m_IsModifiedThickness
End Get
End Property
Private m_OrigThickness As Double
Private m_Thickness As Double
Public Property Thickness As String
Get
If m_Thickness < EPS_SMALL Then Return ""
Return LenToString(m_Thickness, -2)
End Get
Set(value As String)
Dim dThickness As Double = 0
If StringToLen(value, dThickness) And dThickness > -EPS_ZERO Then
m_Thickness = dThickness
m_IsModifiedThickness = m_Thickness <> m_OrigThickness
Else
NotifyPropertyChanged("Thickness")
End If
m_IsEnabledBtn(IsValid)
If Not String.IsNullOrWhiteSpace(m_ThicknessError) Then
LibMap.refStatusBarVM.SetOutputMessage(m_ThicknessError, 5, MSG_TYPE.ERROR_)
End If
End Set
End Property
Friend Function GetThickness() As Double
Return m_Thickness
End Function
Private m_IsModifiedWarehousePosition As Boolean = False
Friend ReadOnly Property IsModifiedWarehousePosition As Boolean
Get
Return m_IsModifiedWarehousePosition
End Get
End Property
Private m_OrigWarehousePosition As String
Private m_WarehousePosition As String
Public Property WarehousePosition As String
Get
Return m_WarehousePosition
End Get
Set(value As String)
m_WarehousePosition = value
m_IsModifiedWarehousePosition = m_WarehousePosition <> m_OrigWarehousePosition
m_IsEnabledBtn(IsValid And IsModified)
End Set
End Property
Private m_AddedDate As Date
Public Property AddedDate As Date
Get
Return m_AddedDate
End Get
Set(value As Date)
m_AddedDate = value
End Set
End Property
Private m_IsLoaded As Boolean
Public Property IsLoaded As Boolean
Get
Return m_IsLoaded
End Get
Set(value As Boolean)
m_IsLoaded = value
NotifyPropertyChanged("IsLoaded")
End Set
End Property
Public ReadOnly Property Slab_Tooltip As String
Get
Dim CurrState As String = String.Empty
For Index = 0 To StoneMap.refProjectVM.StateList.Count - 1
If StoneMap.refProjectVM.StateList(Index).Id = m_State Then
CurrState = StoneMap.refProjectVM.StateList(Index).Name
End If
Next
Dim Tooltip As String = EgtMsg(MSG_SLAB + 1) & ": " & m_Id & Environment.NewLine &
EgtMsg(MSG_SLAB + 3) & ": " & CurrState & Environment.NewLine &
EgtMsg(MSG_SLAB + 4) & ": " & m_ProjectAssignedTo & Environment.NewLine &
EgtMsg(MSG_RAWPARTPAGEUC + 9) & ": " & m_Material & Environment.NewLine &
EgtMsg(MSG_RAWPARTPAGEUC + 5) & ": " & Thickness & Environment.NewLine &
EgtMsg(MSG_SLAB + 5) & ": " & m_WarehousePosition & Environment.NewLine &
EgtMsg(MSG_SLAB + 6) & ": " & m_AddedDate
Return Tooltip
End Get
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(sId As String, sPath As String, State As StateOpt, sProjectAssignedTo As String, Material As String, dThickness As Double, sWarehousePosition As String)
m_Id = sId
m_ImagePath = sPath
m_State = State
m_ProjectAssignedTo = sProjectAssignedTo
m_Material = Material
m_Thickness = dThickness
m_WarehousePosition = sWarehousePosition
m_AddedDate = Date.Today
m_IsLoaded = False
End Sub
Sub New(SlabReader As SQLiteDataReader)
m_Id = SlabReader(DB_ID)
Dim TempPath As String = SlabReader(DB_IMAGEPATH)
If Not File.Exists(TempPath) Then TempPath = MainData.sPhotoDir & "\" & CStr(SlabReader(DB_IMAGEPATH))
m_ImagePath = TempPath
m_State = SlabReader(DB_STATE)
m_ProjectAssignedTo = If(SlabReader(DB_PROJASSIGNEDTO) Is DBNull.Value, Nothing, SlabReader(DB_PROJASSIGNEDTO))
Dim MaterialName As String = SlabReader(DB_MATERIAL)
m_Material = If(Not String.IsNullOrWhiteSpace(MaterialName), MaterialName, Nothing)
m_Thickness = SlabReader(DB_THICKNESS)
m_WarehousePosition = SlabReader(DB_WAREHOUSEPOS)
m_AddedDate = Date.Today
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private m_IdError As String
Public ReadOnly Property IdErrorMsg As String
Get
Return m_IdError
End Get
End Property
Private m_ImagePathError As String
Public ReadOnly Property ImagePathErrorMsg As String
Get
Return m_ImagePathError
End Get
End Property
Private m_ThicknessError As String
Public ReadOnly Property ThicknessErrorMsg As String
Get
Return m_ThicknessError
End Get
End Property
Private Function GetValidationError(propertyName As String) As Boolean
Dim bOk As Boolean = True
Select Case propertyName
Case "Id"
bOk = Me.ValidateId()
Case "ImagePath"
bOk = Me.ValidateImagePath()
Case "Thickness"
bOk = Me.ValidateThickness()
End Select
Return bOk
End Function
''' <summary>
''' Returns true if this object has no validation errors.
''' </summary>
Public ReadOnly Property IsValid() As Boolean
Get
For Each [property] As String In ValidatedProperties
If Not GetValidationError([property]) Then
Return False
End If
Next [property]
Return True
End Get
End Property
Private Shared ReadOnly ValidatedProperties() As String = {"Id", "ImagePath", "Thickness"}
Private Function ValidateId() As Boolean
m_IdError = String.Empty
' AndAlso Not m_Id.IndexOfAny("[~`!@#$%^&*()-+=|{}':;.,<>/?]".ToCharArray) <> -1
If Not String.IsNullOrEmpty(m_Id) Then
For Each Slab In StoneMap.refProjectVM.SlabList
If Slab IsNot Me AndAlso Slab.Id = m_Id Then
' Nome già utilizzato
m_IdError = EgtMsg(MSG_SLAB + 1)
'LibMap.refStatusBarVM.SetOutputMessage(sMsg, 3, MSG_TYPE.ERROR_)
Return False
End If
Next
Return True
Else
' Il nome è obbligatorio
m_IdError = EgtMsg(MSG_SLAB + 2)
'LibMap.refStatusBarVM.SetOutputMessage(sMsg, 3, MSG_TYPE.ERROR_)
Return False
End If
End Function
Private Function ValidateImagePath() As Boolean
m_ImagePathError = String.Empty
If Not String.IsNullOrEmpty(m_ImagePath) Then Return True
' Il nome immagine è obbligatorio
m_ImagePathError = EgtMsg(MSG_SLAB + 3)
Return False
End Function
Private Function ValidateThickness() As Boolean
m_ThicknessError = String.Empty
If Not IsNothing(m_Thickness) Then
Dim dThickness As Double = 0
StringToLen(m_Thickness, dThickness)
If dThickness > EPS_SMALL Then Return True
' Non sono ammessi spessori negativi
m_ThicknessError = EgtMsg(MSG_RAWPARTPAGEUC + 18)
'LibMap.refStatusBarVM.SetOutputMessage(sMsg, 3, MSG_TYPE.ERROR_)
Return False
End If
Return False
End Function
Public ReadOnly Property IsModified() As Boolean
Get
Return m_IsModifiedId OrElse m_IsModifiedImagePath OrElse m_IsModifiedState OrElse
m_IsModifiedProjectAssignedTo OrElse m_IsModifiedMaterial OrElse m_IsModifiedThickness OrElse
m_IsModifiedWarehousePosition
End Get
End Property
Friend Sub ResetIsModified()
m_IsModifiedId = False
m_IsModifiedImagePath = False
m_IsModifiedState = False
m_IsModifiedProjectAssignedTo = False
m_IsModifiedMaterial = False
m_IsModifiedThickness = False
m_IsModifiedWarehousePosition = False
End Sub
Friend Sub SetOrigValues()
m_OrigId = m_Id
m_OrigImagePath = m_ImagePath
m_OrigState = m_State
m_OrigProjectAssignedTo = m_ProjectAssignedTo
m_OrigMaterial = m_Material
m_OrigThickness = m_Thickness
m_OrigWarehousePosition = m_WarehousePosition
End Sub
Public Sub UpDateComboBox()
NotifyPropertyChanged("Selected")
End Sub
#End Region ' METHODS
End Class
Public Class Material
Private m_nId As Integer
Private m_sName As String
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Sub New(sName As String, MaterialList As ObservableCollection(Of Material))
Dim nMaxId As Integer = 0
For Each Material In MaterialList
If Material.nId > nMaxId Then
nMaxId = Material.nId
End If
Next
m_nId = nMaxId + 1
m_sName = sName
End Sub
Sub New(nId As Integer, sName As String)
m_nId = nId
m_sName = sName
End Sub
End Class
''' <summary>
''' Class that represent a Converter that convert mm in inch if necessary for the param depth.
''' </summary>
Public Class StateIndexConverter
Implements IMultiValueConverter
Dim StateList As List(Of IdNameStruct)
Public Function Convert(value() As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IMultiValueConverter.Convert
If Not TypeOf value(1) Is List(Of IdNameStruct) Then Return value(0)
StateList = DirectCast(value(1), List(Of IdNameStruct))
Dim SelState As Slab.StateOpt
If Not TypeOf value(0) Is Slab.StateOpt Then Return value(0)
SelState = DirectCast(value(0), Slab.StateOpt)
For Index = 0 To StateList.Count - 1
If StateList(Index).Id = SelState Then
Return Index
End If
Next
Return value
End Function
Public Function ConvertBack(value As Object, targetType() As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Return {StateList(value).Id}
End Function
End Class
+317
View File
@@ -0,0 +1,317 @@
Imports System.Collections.ObjectModel
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MySceneHostSlabVM
Inherits EgtWPFLib5.SceneHostVM
Friend m_MruFiles As New MruList
Public ReadOnly Property MruFileNames As ObservableCollection(Of String)
Get
Return m_MruFiles.FileNames
End Get
End Property
' Titolo
Private m_Title As String
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
NotifyPropertyChanged("Title")
End Set
End Property
#Region "CONSTRUCTOR"
Sub New()
MyBase.New()
'AddHandler MainController.OnNewProject, AddressOf OnNewProject
'AddHandler MainController.OnOpenProject, AddressOf OnOpenProject
'AddHandler MainController.OnSavingProject, AddressOf OnSavingProject
'AddHandler MainController.OnSavedProject, AddressOf OnSavedProject
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Overrides Sub InitScene()
InitSceneEvents()
' Inizializzazione Scena
PreInitializeScene()
If MainScene.Init() And MainData.GetKeyOption(KEY_OPT.MAN_PHOTO) Then
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
' Recupero e imposto handle finestra principale
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
EgtSetMainWindowHandle(hMainWnd)
SetContextSTONELib( EgtGetCurrentContext())
Return
End If
' Se manca la chiave
If MainData.nKeyLevel = -1 Or MainData.nKeyLevel = -2 Then
EgtOutLog("Missing Dongle")
' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
StoneMap.m_ContinueApplication = False
' Altrimenti manca la licenza
Else
EgtOutLog("Problems with Licence")
' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
Dim sKeyInfo As String = "" : EgtGetKeyInfo(sKeyInfo)
Dim sText As String = sKeyInfo & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
' Apro dialogo per richiesta file licenza
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
.DefaultExt = ".lic",
.Filter = "Licences (.lic)|*.lic",
.CheckFileExists = True,
.ValidateNames = True
}
If LicDlg.ShowDialog() = True Then
' Recupero il direttorio del file
Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
' Se il file non è già nel direttorio di configurazione lo copio
If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(MainData.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
Try
File.Copy(LicDlg.FileName, Path.Combine(MainData.sConfigDir, LicDlg.SafeFileName), True)
Catch ex As Exception
End Try
End If
' Imposto il nome del nuovo file di licenza nell'Ini
WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
End If
End If
End If
' Chiudo il programma
StoneMap.m_ContinueApplication = False
End Sub
Public Overrides Sub InitSceneEvents()
AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene
AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene
AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene
AddHandler MainScene.KeyDown, AddressOf OnKeyDownScene
AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos
AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance
AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
MainScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
MainScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
MainScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
MainScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
MainScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
MainScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
MainController.SetScene(MainScene)
' imposto tipo coordinate
MainScene.SetGridCursorPos(True)
' modo di visualizzazione
'Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) 'KK?
'Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' tipo snap point
MainScene.SetSnapPointType(SP.PT_SKETCH)
End Sub
#End Region ' METHODS
#Region "EVENTS"
Private Sub OnNewProject(sender As Object, bOk As Boolean)
Title = " New - OmagOFFICE"
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro)
If EgtGetMachGroupCount() = 0 Then bOk = False
' Procedo a seconda del risultato
If bOk Then
Title = sFile & " - OmagOFFICE"
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
m_MruFiles.Add(sFile)
Else
EgtNewFile()
Title = " New - OmagOFFICE"
m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
MainScene.SetStatusNull()
End Sub
Private Sub OnSavingProject(ByVal sender As Object, sFile As String)
'' Recupero tutti i file di texture associabili ai gruppi di lavoro del progetto
'Dim sDirToSearch As String = Path.GetDirectoryName(sFile)
'Dim sFileToSearch As String = Path.GetFileNameWithoutExtension(sFile) & "." & PHOTO_NAME & "*"
'Dim vsTxrFile As New List(Of String)
'For Each sTxrFile In My.Computer.FileSystem.GetFiles(sDirToSearch, FileIO.SearchOption.SearchTopLevelOnly, sFileToSearch)
' vsTxrFile.Add(sTxrFile)
'Next
'' Rinomino path di eventuali fotografie
'Dim nPhotoId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP))
'While nPhotoId <> GDB_ID.NULL
' ' Path originale
' Dim sPhoto As String = String.Empty
' If EgtGetPhotoPath(nPhotoId, sPhoto) Then
' ' Nome della foto
' Dim sName As String = String.Empty
' EgtGetName(nPhotoId, sName)
' ' Nuova path
' Dim sNewPhoto As String = Path.GetDirectoryName(sFile) & "\" &
' Path.GetFileNameWithoutExtension(sFile) & "." & sName &
' Path.GetExtension(sPhoto)
' ' Se diverse, eseguo copia
' If String.Compare(sPhoto, sNewPhoto, True) <> 0 Then
' Try
' ' Eseguo copia
' File.Copy(sPhoto, sNewPhoto, True)
' ' Notifico a foto il cambio di path
' EgtChangePhotoPath(nPhotoId, sNewPhoto)
' Catch ex As Exception
' End Try
' End If
' ' Tolgo da lista file texture associabili, se presente
' vsTxrFile.Remove(sNewPhoto)
' End If
' ' passo alla successiva
' nPhotoId = EgtGetNext(nPhotoId)
'End While
'' Se rimasti file associabili, li cancello
'For Each sTxrFile In vsTxrFile
' Try
' My.Computer.FileSystem.DeleteFile(sTxrFile)
' Catch
' End Try
'Next
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
' Se salvataggio non riuscito, esco subito
If Not bOk Then
m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Return
End If
' Aggiornamento titolo
Title = sFile & " - OmagOFFICE"
' Inserisco nome in MRU
m_MruFiles.Add(sFile)
' Salvo nome ultimo file
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
End Sub
Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or Not MainScene.IsStatusNull() Then Return
' Chiamo l'opportuno gestore
End Sub
Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Chiamo l'opportuno gestore
End Sub
Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' Chiamo l'opportuno gestore
End Sub
Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs)
' Chiamo l'opportuno gestore
End Sub
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
StoneMap.refStatusBarVM.SetCurrPos(sCursorPos)
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
StoneMap.refStatusBarVM.SetOutputMessage(sDistance)
End Sub
Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean)
Dim BtnColor As Brush
If bUser Then
BtnColor = New SolidColorBrush(SystemColors.ControlColor)
Else
BtnColor = Brushes.Bisque
End If
Select Case nSpType
Case SP.PT_SKETCH
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point
Case SP.PT_GRID
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point
Case SP.PT_END
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point
Case SP.PT_MID
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point
Case SP.CENTER
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center
Case SP.CENTROID
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid
Case SP.PT_NEAR
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point
Case SP.PT_INTERS
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point
Case SP.PT_TANGENT
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point
Case SP.PT_PERPENDICULAR
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point
Case SP.PT_MINDIST
StoneMap.refStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point
Case Else
StoneMap.refStatusBarVM.SetSnapPointType("---", BtnColor)
End Select
End Sub
#End Region ' EVENTS
End Class
+10
View File
@@ -0,0 +1,10 @@
<UserControl x:Class="SceneHostSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtUILib="clr-namespace:EgtUILib;assembly=EgtUILib">
<WindowsFormsHost>
<EgtUILib:Scene x:Name="MainScene"/>
</WindowsFormsHost>
</UserControl>
+19
View File
@@ -0,0 +1,19 @@
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class SceneHostSlabV
Private WithEvents m_SceneHostVM As MySceneHostSlabVM
Sub New()
' This call is required by the designer.
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
Me.DataContext = New MySceneHostSlabVM
m_SceneHostVM = DirectCast(Me.DataContext, MySceneHostSlabVM)
m_SceneHostVM.SetMainScene(MainScene)
End Sub
End Class
+83
View File
@@ -0,0 +1,83 @@
<EgtFloating:EgtFloatingPanel x:Class="SearchPanelSlabV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWpfLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtSTONELib="clr-namespace:EgtSTONELib"
Width="268" TitleBarOrientation="Vertical" IsToolBar="True"
IsTopDockable="False" IsBottomDockable="False" IsLeftDockable="True"
IsRightDockable="False" Style="{StaticResource Option_EgtFloatingPanel}"
Visibility="{Binding SearchPanel_Visibility}">
<EgtFloating:EgtFloatingPanel.Resources>
<EgtSTONELib:StateIndexConverter x:Key="StateIndexConverter"/>
</EgtFloating:EgtFloatingPanel.Resources>
<UniformGrid Columns="2" Margin="0,0,0,0">
<TextBlock Text="{Binding IdMsg}" Margin="5,5,0,5"/>
<EgtWpfLib5:EgtTextBox Text="{Binding Id}"
Margin="13,5,5,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding ImagePathMsg}" Margin="5,0,0,5"/>
<EgtWpfLib5:EgtTextBox Text="{Binding ImagePath}"
Margin="13,0,5,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding StateMsg}" Margin="5,0,0,5"/>
<ComboBox ItemsSource="{Binding StateList}"
DisplayMemberPath="Name"
Margin="13,0,5,5">
<ComboBox.SelectedIndex>
<MultiBinding Converter="{StaticResource StateIndexConverter}">
<Binding Path="State" />
<Binding Path="StateList" Mode="OneWay"/>
</MultiBinding>
</ComboBox.SelectedIndex>
</ComboBox>
<TextBlock Text="{Binding ProjectAssignedToMsg}" Margin="5,0,0,5"/>
<EgtWpfLib5:EgtTextBox Text="{Binding ProjectAssignedTo}"
Margin="13,0,5,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding MaterialMsg}" Margin="5,0,0,5"/>
<ComboBox ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding Material}"
Margin="13,0,5,5"/>
<TextBlock Text="{Binding ThicknessMsg}" Margin="5,0,0,5"/>
<EgtWpfLib5:EgtTextBox Text="{Binding Thickness}"
Margin="13,0,5,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding WarehousePositionMsg}" Margin="5,0,0,5"/>
<EgtWpfLib5:EgtTextBox Text="{Binding WarehousePosition}"
Margin="13,0,5,5"
TextAlignment="Right"/>
<TextBlock Text="{Binding StartAddedDateMsg}" Margin="5,0,0,5"/>
<DatePicker SelectedDate="{Binding StartAddedDate}"
Margin="13,0,5,5"/>
<TextBlock Text="{Binding EndAddedDateMsg}" Margin="5,0,0,5"/>
<DatePicker SelectedDate="{Binding EndAddedDate}"
Margin="13,0,5,5"/>
</UniformGrid>
<UniformGrid Columns="2">
<Button Command="{Binding Reset_Command}"
Content="{Binding ResetMsg}"
Margin="5,0,5,5"
Grid.Column="1"
Style="{StaticResource OptionPanel_TextButton}"/>
<Button Command="{Binding Search_Command}"
Content="{Binding SearchMsg}"
Margin="5,0,5,5"
Grid.Column="1"
Style="{StaticResource OptionPanel_TextButton}"/>
</UniformGrid>
</EgtFloating:EgtFloatingPanel>
+10
View File
@@ -0,0 +1,10 @@
Public Class SearchPanelSlabV
Sub New
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
+401
View File
@@ -0,0 +1,401 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class SearchPanelSlabVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Event ScrollToTop()
Private m_Search_IsEnabled As Boolean
Public Property Search_IsEnabled As Boolean
Get
Return m_Search_IsEnabled
End Get
Set(value As Boolean)
m_Search_IsEnabled = value
NotifyPropertyChanged("Search_IsEnabled")
End Set
End Property
Private m_Search_IsChecked As Boolean
Public Property Search_IsChecked As Boolean
Get
Return m_Search_IsChecked
End Get
Set(value As Boolean)
m_Search_IsChecked = value
End Set
End Property
Private m_Id As String
Public Property Id As String
Get
Return m_Id
End Get
Set(value As String)
m_Id = value
End Set
End Property
Private m_ImagePath As String
Public Property ImagePath As String
Get
Return m_ImagePath
End Get
Set(value As String)
m_ImagePath = value
End Set
End Property
Private m_StateList As List(Of IdNameStruct)
Public ReadOnly Property StateList As List(Of IdNameStruct)
Get
Return m_StateList
End Get
End Property
Friend Sub SetStateList(StateList As List(Of IdNameStruct))
m_StateList = StateList
End Sub
Private m_State As Slab.StateOpt
Public Property State As Integer
Get
Return m_State
End Get
Set(value As Integer)
m_State = value
End Set
End Property
Private m_ProjectAssignedTo As String
Public Property ProjectAssignedTo As String
Get
Return m_ProjectAssignedTo
End Get
Set(value As String)
m_ProjectAssignedTo = value
End Set
End Property
Private m_MaterialList As List(Of String)
Public ReadOnly Property MaterialList As List(Of String)
Get
Return m_MaterialList
End Get
End Property
Private m_Material As String
Public Property Material As String
Get
Return m_Material
End Get
Set(value As String)
m_Material = value
End Set
End Property
Private m_Thickness As Double
Public Property Thickness As String
Get
If m_Thickness < EPS_SMALL Then Return ""
Return LenToString(m_Thickness, -2)
End Get
Set(value As String)
Dim dThickness As Double = 0
If StringToLen(value, dThickness) And dThickness > -EPS_ZERO Then
m_Thickness = dThickness
Else
NotifyPropertyChanged("Thickness")
' Non sono ammessi spessori negativi
Dim sMsg As String = EgtMsg(MSG_RAWPARTPAGEUC + 18)
LibMap.refStatusBarVM.SetOutputMessage(sMsg, 5, MSG_TYPE.ERROR_)
End If
End Set
End Property
Private m_WarehousePosition As String
Public Property WarehousePosition As String
Get
Return m_WarehousePosition
End Get
Set(value As String)
m_WarehousePosition = value
End Set
End Property
Private m_StartAddedDate As Nullable(Of Date)
Public Property StartAddedDate As Nullable(Of Date)
Get
Return m_StartAddedDate
End Get
Set(value As Nullable(Of Date))
m_StartAddedDate = value
End Set
End Property
Private m_EndAddedDate As Nullable(Of Date)
Public Property EndAddedDate As Nullable(Of Date)
Get
Return m_EndAddedDate
End Get
Set(value As Nullable(Of Date))
m_EndAddedDate = value
End Set
End Property
Private m_ThicknessTolerance As Double
Private m_SearchPanel_Visibility As Visibility
Public ReadOnly Property SearchPanel_Visibility As Visibility
Get
Return m_SearchPanel_Visibility
End Get
End Property
Public Sub SetSearchPanel_Visibility(IsVisible As Boolean)
If IsVisible Then
m_SearchPanel_Visibility = Visibility.Visible
Else
m_SearchPanel_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SearchPanel_Visibility")
End Sub
#Region "Messages"
Public ReadOnly Property IdMsg As String
Get
Return EgtMsg(MSG_SLAB + 1)
End Get
End Property
Public ReadOnly Property ImagePathMsg As String
Get
Return EgtMsg(MSG_SLAB + 2)
End Get
End Property
Public ReadOnly Property StateMsg As String
Get
Return EgtMsg(MSG_SLAB + 3)
End Get
End Property
Public ReadOnly Property ProjectAssignedToMsg As String
Get
Return EgtMsg(MSG_SLAB + 4)
End Get
End Property
Public ReadOnly Property MaterialMsg As String
Get
Return EgtMsg(MSG_RAWPARTPAGEUC + 9)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(MSG_RAWPARTPAGEUC + 5)
End Get
End Property
Public ReadOnly Property WarehousePositionMsg As String
Get
Return EgtMsg(MSG_SLAB + 5)
End Get
End Property
Public ReadOnly Property StartAddedDateMsg As String
Get
Return EgtMsg(MSG_SEARCHPANEL + 3)
End Get
End Property
Public ReadOnly Property EndAddedDateMsg As String
Get
Return EgtMsg(MSG_SEARCHPANEL + 4)
End Get
End Property
Public ReadOnly Property ResetMsg As String
Get
Return EgtMsg(MSG_SEARCHPANEL + 5)
End Get
End Property
Public ReadOnly Property SearchMsg As String
Get
Return EgtMsg(MSG_SEARCHPANEL + 1)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdReset As ICommand
Private m_cmdSearch As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in StoneMap
StoneMap.SetRefSearchPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Sub InitSearchPanel()
' Creo lista materiali
If MainData.bIsOmagOFFICE Then
' carico l'elelnco di tutti i materiali presenti nel DB
StoneMap.refOptionPanelVM.SetMaterialFromDB()
m_MaterialList = StoneMap.refOptionPanelVM.MaterialList
Else
m_MaterialList = New List(Of String)(StoneMap.refProjectVM.MaterialList)
m_MaterialList.Insert(0, String.Empty)
End If
NotifyPropertyChanged("MaterialList")
' Leggo tolleranza spessore
m_ThicknessTolerance = GetMainPrivateProfileDouble(S_SEARCH, K_THICKNESSTOLERANCE, 0)
End Sub
Public Sub SetSearch_IsChecked(value As Boolean)
m_Search_IsChecked = value
SetSearchPanel_Visibility(m_Search_IsChecked)
NotifyPropertyChanged("Search_IsChecked")
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Reset"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property Reset_Command As ICommand
Get
If m_cmdReset Is Nothing Then
m_cmdReset = New Command(AddressOf Reset)
End If
Return m_cmdReset
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Friend Sub Reset(Optional bUseDefaults As Boolean = False)
m_Id = String.Empty
NotifyPropertyChanged("Id")
m_ImagePath = String.Empty
NotifyPropertyChanged("ImagePath")
m_State = Nothing
NotifyPropertyChanged("State")
m_ProjectAssignedTo = String.Empty
NotifyPropertyChanged("ProjectAssignedTo")
m_Material = String.Empty
NotifyPropertyChanged("Material")
m_Thickness = 0
NotifyPropertyChanged("Thickness")
m_WarehousePosition = String.Empty
NotifyPropertyChanged("WarehousePosition")
m_StartAddedDate = Nothing
NotifyPropertyChanged("StartAddedDate")
m_EndAddedDate = Nothing
NotifyPropertyChanged("EndAddedDate")
End Sub
#End Region ' Reset
#Region "Search"
''' <summary>
''' Returns a command that do Search.
''' </summary>
Public ReadOnly Property Search_Command As ICommand
Get
If m_cmdSearch Is Nothing Then
m_cmdSearch = New Command(AddressOf Search)
End If
Return m_cmdSearch
End Get
End Property
''' <summary>
''' Execute the Search. This method is invoked by the SearchCommand.
''' </summary>
Friend Sub Search()
Dim Query As String = "SELECT * FROM " & Slab.DB_SLABS & " "
Dim bFirstWhere As Boolean = True
If Not String.IsNullOrWhiteSpace(m_Id) OrElse
Not String.IsNullOrWhiteSpace(m_ImagePath) OrElse
Not m_State = 0 OrElse
Not String.IsNullOrWhiteSpace(m_ProjectAssignedTo) OrElse
Not String.IsNullOrWhiteSpace(m_Material) OrElse
m_Thickness > EPS_SMALL OrElse
Not String.IsNullOrWhiteSpace(m_WarehousePosition) OrElse
Not IsNothing(m_StartAddedDate) Then
Query &= "WHERE "
If Not String.IsNullOrWhiteSpace(m_Id) Then
Query &= Slab.DB_ID & " = '" & m_Id & "' "
bFirstWhere = True
End If
If Not String.IsNullOrWhiteSpace(m_ImagePath) Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_IMAGEPATH & " = '" & m_ImagePath & "' "
End If
If Not m_State = 0 Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_STATE & " = " & m_State & " "
End If
If Not String.IsNullOrWhiteSpace(m_ProjectAssignedTo) Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_PROJASSIGNEDTO & " = '" & m_ProjectAssignedTo & "' "
End If
If Not String.IsNullOrWhiteSpace(m_Material) Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_MATERIAL & " = '" & m_Material & "' "
End If
If m_Thickness > EPS_SMALL Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_THICKNESS & " BETWEEN " & m_Thickness - m_ThicknessTolerance & " AND " & m_Thickness + m_ThicknessTolerance
End If
If Not String.IsNullOrWhiteSpace(m_WarehousePosition) Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_WAREHOUSEPOS & " = '" & m_WarehousePosition & "' "
End If
If Not IsNothing(m_StartAddedDate) Then
If Not IsNothing(m_EndAddedDate) Then
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_ADDEDDATE & " BETWEEN Date('" & (String.Format("{0:yyyy-MM-dd}", m_StartAddedDate)) & "') AND Date('" & (String.Format("{0:yyyy-MM-dd}", m_EndAddedDate)) & "')"
Else
EvalWhere(bFirstWhere, Query)
Query &= Slab.DB_ADDEDDATE & " = Date('" & (String.Format("{0:yyyy-MM-dd}", m_StartAddedDate)) & "')"
End If
End If
Query = Query.TrimEnd(","c, " "c)
End If
StoneMap.refProjectVM.SlabList = New ObservableCollection(Of Slab)(ManageDb.ExecuteSlabReaderQuery(Query))
RaiseEvent ScrollToTop()
End Sub
Private Sub EvalWhere(ByRef bFirst As Boolean, ByRef Query As String)
If bFirst Then
bFirst = False
Else
Query &= " AND "
End If
End Sub
#End Region ' Search
#End Region ' Commands
End Class
+426
View File
@@ -0,0 +1,426 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : Camera.vb Data : 08.10.15 Versione : 1.6j1
' Contenuto : Classe Camera (gestione della macchina fotografica).
'
'
'
' Modifiche : 08.10.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Imports System.Threading
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class Camera
Friend Const FINAL_IMAGE As String = "FinalImage.jpg"
' Dati
Private m_bCameraLink As Boolean = False
Private m_bCalcContour As Boolean = False
Private m_nCameraCount As Integer = 0
Private m_sCameraPath As String = String.Empty
Private m_sCameraPath2 As String = String.Empty
Private m_sCameraProcName As String = String.Empty
Private m_sCameraProcName2 As String = String.Empty
Private m_sImage As String = String.Empty
Private m_sImage2 As String = String.Empty
Private m_sInfo As String = String.Empty
Private m_sInfo2 As String = String.Empty
Private m_sResult As String = String.Empty
Private m_sResult2 As String = String.Empty
Private m_sContour As String = String.Empty
Private m_sContour2 As String = String.Empty
Private m_nThreshold As Integer = 60
Private m_dTolerance As Double = 5
Private m_nTimeout As Integer = 30
Private m_sImageDir As String = String.Empty
' Flag per foto in esecuzione
Friend m_bBusy As Boolean = False
Public Function Init() As Boolean
' Lettura dati di configurazione da file Ini (prevista una sola macchina fotografica)
m_bCameraLink = (GetMainPrivateProfileInt(S_GENERAL, K_CAMERALINK, 0) <> 0)
m_nCameraCount = 1
GetMainPrivateProfileString(S_CAMERA, K_CAM_EXEPATH, "", m_sCameraPath)
GetMainPrivateProfileString(S_CAMERA, K_CAM_IMAGE, "", m_sImage)
GetMainPrivateProfileString(S_CAMERA, K_CAM_INFO, "", m_sInfo)
GetMainPrivateProfileString(S_CAMERA, K_CAM_RESULT, "", m_sResult)
GetMainPrivateProfileString(S_CAMERA, K_CAM_CONTOUR, "", m_sContour)
m_nThreshold = GetMainPrivateProfileInt(S_CAMERA, K_CAM_THRESHOLD, 60)
m_dTolerance = GetMainPrivateProfileDouble(S_CAMERA, K_CAM_TOLERANCE, 5)
m_nTimeout = GetMainPrivateProfileInt(S_CAMERA, K_CAM_TIMEOUT, 30)
GetMainPrivateProfileString(S_GENERAL, K_IMAGEDIR, "", m_sImageDir)
' Verifico abilitazione riconoscimento contorno automatico del grezzo
m_bCalcContour = GetKeyOption(KEY_OPT.AUTO_PHOTO) AndAlso
(GetMainPrivateProfileInt(S_GENERAL, K_CONTOURFROMCAMERA, 0) <> 0)
' Ricavo il nome del processo associato
m_sCameraProcName = Path.GetFileNameWithoutExtension(m_sCameraPath)
m_sCameraProcName2 = Path.GetFileNameWithoutExtension(m_sCameraPath2)
' Se camera abilitata, lancio l'esecuzione in cieco
If m_bCameraLink Then
If m_nCameraCount <> 2 Then
Dim bOk As Boolean = True
If Not CameraHide(1) Then
bOk = False
EgtOutLog("CameraMng not starting")
End If
Return bOk
Else
Dim bOk As Boolean = True
If Not CameraHide(1) Then
bOk = False
EgtOutLog("CameraMng 1 not starting")
End If
If Not CameraHide(2) Then
bOk = False
EgtOutLog("CameraMng 2 not starting")
End If
Return bOk
End If
Else
Return True
End If
End Function
Public Function Close() As Boolean
If m_bBusy Then Return False
If m_bCameraLink Then
If m_nCameraCount <> 2 Then
KillProcess(1)
Else
KillProcess(1)
KillProcess(2)
End If
End If
Return True
End Function
Public Function GetCalcContour() As Boolean
Return m_bCalcContour
End Function
Public Function GetCameraLink() As Boolean
Return m_bCameraLink
End Function
Public Overridable Function GetKeyOption(nKeyOpt As Integer) As Boolean
EgtOutLog("Camera not managed in the software code!")
Return False
End Function
Friend ReadOnly Property ImageDir As String
Get
Return m_sImageDir
End Get
End Property
Friend Property Threshold As Integer
Get
Return m_nThreshold
End Get
Set(value As Integer)
' Porto il valore nel range valido
If value < 10 Then
value = 10
ElseIf value > 90 Then
value = 90
End If
' Se cambiato, aggiorno file INI
If value <> m_nThreshold And
WriteMainPrivateProfileString(S_CAMERA, K_CAM_THRESHOLD, DoubleToString(value, 3)) Then
' Aggiorno il valore corrente
m_nThreshold = value
End If
End Set
End Property
Friend Property Tolerance As Double
Get
Return m_dTolerance
End Get
Set(value As Double)
' Porto il valore nel range valido
If value < 100 * EPS_SMALL Then
value = 100 * EPS_SMALL
End If
' Se cambiato, aggiorno file INI
If value <> m_dTolerance And
WriteMainPrivateProfileString(S_CAMERA, K_CAM_TOLERANCE, DoubleToString(value, 3)) Then
' Aggiorno il valore corrente
m_dTolerance = value
End If
End Set
End Property
Public Function CameraHide(nInd As Integer) As Boolean
' Lancio il programma in cieco, se già attivo lo nascondo
Try
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "0")
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function CameraShow(nInd As Integer) As Boolean
' Lancio il programma in modo visibile, se già attivo lo rendo visibile
Try
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "1")
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function CameraTest(nInd As Integer) As Boolean
' Cancello il risultato
If File.Exists(If(nInd <> 2, m_sResult, m_sResult2)) Then
File.Delete(If(nInd <> 2, m_sResult, m_sResult2))
End If
' Lancio il programma per sapere se macchina fotografica collegata
Try
' Interrogo
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "3")
' Ciclo di attesa risultato
Dim nMaxThick = 10 * 4
For nThick As Integer = 0 To nMaxThick
' Se esiste il file di risultato
Dim nErr = 999
If VerifyResult(nInd, nErr) Then
Return (nErr = 0)
End If
' Aspetto 100 ms
Thread.Sleep(100)
Next
Catch ex As Exception
'
End Try
Return False
End Function
Private Function PrepareCamera() As Integer
' Determino la camera da utilizzare, se più di una
Dim nInd As Integer = 1
'If m_nCameraCount = 2 Then
' Dim sTabName = MAIN_TAB
' EgtGetTableName(sTabName)
' If sTabName = SECOND_TAB Then
' nInd = 2
' End If
'End If
' Se gestore macchina non attivo, lo lancio in modo cieco
If Not ProcessIsRunning(nInd) Then
If Not CameraHide(nInd) Then
Return 0
End If
' Aspetto 5000 ms
Thread.Sleep(5000)
' Altrimenti richiedo verifica di camera connessa
Else
If Not CameraTest(nInd) Then
Return 0
End If
' Aspetto 100 ms
Thread.Sleep(100)
End If
Return nInd
End Function
Public Function CameraBackImage() As Boolean
' Verifiche preliminari
Dim nInd As Integer = PrepareCamera()
If nInd = 0 Then Return False
' Visualizzo progressbar
m_bBusy = True
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(True)
LibMap.refStatusBarVM.SetLoadingProgress(1)
' Cancellazione eventuali vecchi file rimasti
Try
If File.Exists(If(nInd <> 2, m_sResult, m_sResult2)) Then
File.Delete(If(nInd <> 2, m_sResult, m_sResult2))
End If
Catch ex As Exception
End Try
' Scatto una foto come sfondo (il programma deve essere già attivo)
Dim bOk As Boolean = False
Try
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "4")
bOk = WaitBackImage(nInd)
Catch ex As Exception
bOk = False
End Try
' Nascondo progressbar
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(False)
m_bBusy = False
Return bOk
End Function
Private Function WaitBackImage(nInd As Integer) As Boolean
' Ciclo di ricerca foto scattata
Dim nMaxThick = 10 * m_nTimeout
For nThick As Integer = 0 To nMaxThick
' Se esiste il file di risultato
Dim nErr = 999
If VerifyResult(nInd, nErr) Then
If nErr = 0 Then
Return True
Else
EgtOutLog("Camera err=" & nErr.ToString())
Return False
End If
' Altrimenti aspetto
Else
' Imposto ProgressBar
Dim nProgress As Integer = CInt(nThick * 100 / nMaxThick)
LibMap.refStatusBarVM.SetLoadingProgress(nProgress)
' Costringo ad aggiornare UI
UpdateUI()
' Aspetto 100 ms
Thread.Sleep(100)
End If
Next
EgtOutLog("Camera generic error")
' Chiudo il gestore della macchina per resettarlo
KillProcess(nInd)
Return False
End Function
Public Function CameraClick() As Boolean
' Verifiche preliminari
Dim nInd As Integer = PrepareCamera()
If nInd = 0 Then Return False
' Visualizzo progressbar
m_bBusy = True
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(True)
LibMap.refStatusBarVM.SetLoadingProgress(1)
' Cancellazione eventuali vecchi file rimasti
Try
If File.Exists(If(nInd <> 2, m_sResult, m_sResult2)) Then
File.Delete(If(nInd <> 2, m_sResult, m_sResult2))
End If
If File.Exists(If(nInd <> 2, m_sImage, m_sImage2)) Then
File.Delete(If(nInd <> 2, m_sImage, m_sImage2))
End If
If File.Exists(If(nInd <> 2, m_sContour, m_sContour2)) Then
File.Delete(If(nInd <> 2, m_sContour, m_sContour2))
End If
If File.Exists(If(nInd <> 2, m_sInfo, m_sInfo2)) Then
File.Delete(If(nInd <> 2, m_sInfo, m_sInfo2))
End If
Catch ex As Exception
End Try
' Scatto una foto con eventuale riconoscimento del contorno (il programma deve essere già attivo)
Dim bOk As Boolean = False
Dim sArgs As String = "2 0"
If m_bCalcContour Then sArgs = " 5 0 " & m_nThreshold.ToString() & " 0"
Try
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), sArgs)
bOk = WaitPhoto(nInd)
Catch ex As Exception
EgtOutLog(ex.Message())
bOk = False
End Try
' Nascondo progressbar
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(False)
m_bBusy = False
Return bOk
End Function
Private Function WaitPhoto(nInd As Integer) As Boolean
' Ciclo di ricerca foto scattata
Dim nMaxThick = 10 * m_nTimeout
For nThick As Integer = 0 To nMaxThick
' Se esiste il file di risultato
Dim nErr = 999
If VerifyResult(nInd, nErr) Then
If nErr = 0 Then
' Copio i file
Dim sImageDest As String = m_sImageDir & "\" & Path.GetFileName(If(nInd <> 2, m_sImage, m_sImage2))
Dim sInfoDest As String = Path.ChangeExtension(sImageDest, "txt")
File.Copy(If(nInd <> 2, m_sImage, m_sImage2), sImageDest, True)
File.Copy(If(nInd <> 2, m_sInfo, m_sInfo2), sInfoDest, True)
' Se richiesto il riconoscimento del contorno
Dim sContourDest As String = String.Empty
If m_bCalcContour Then
sContourDest = Path.ChangeExtension(sImageDest, "dxf")
File.Copy(If(nInd <> 2, m_sContour, m_sContour2), sContourDest, True)
' altrimenti cancello eventuale contorno presente
Else
'm_MainWindow.m_CurrentProjectPageUC.RemoveContour()
End If
' Lancio caricamento della foto e del contorno
StoneMap.refOptionPanelVM.PostPhoto(sImageDest, sContourDest)
Return True
Else
EgtOutLog("Camera err=" & nErr.ToString())
Return False
End If
' Altrimenti aspetto
Else
' Imposto ProgressBar
Dim nProgress As Integer = CInt(nThick * 100 / nMaxThick)
LibMap.refStatusBarVM.SetLoadingProgress(nProgress)
' Costringo ad aggiornare UI
UpdateUI()
' Aspetto 100 ms
Thread.Sleep(100)
End If
Next
EgtOutLog("Camera generic error")
' Chiudo il gestore della macchina per resettarlo
KillProcess(nInd)
Return False
End Function
Private Function VerifyResult(nInd As Integer, ByRef nErr As Integer) As Boolean
' Se non esiste il file con il risultato
If Not File.Exists(If(nInd <> 2, m_sResult, m_sResult2)) Then
Return False
End If
' Leggo il file
Dim bOk As Boolean = False
Try
' Controllo errori nel file di info
Dim sLine As String = String.Empty
Dim sr As StreamReader = New StreamReader(If(nInd <> 2, m_sResult, m_sResult2))
Do While sr.Peek() > -1
sLine = sr.ReadLine()
sLine = sLine.Replace(" ", "")
If sLine.StartsWith("Err=") Then
If Int32.TryParse(sLine.Substring(4), nErr) Then
bOk = True
Exit Do
End If
End If
Loop
sr.Close()
Catch ex As Exception
bOk = False
End Try
Return bOk
End Function
Private Function ProcessIsRunning(nInd As Integer) As Boolean
Dim Procs() As Process
Procs = Process.GetProcessesByName(If(nInd <> 2, m_sCameraProcName, m_sCameraProcName2))
Return (Procs.Length() > 0)
End Function
Private Sub KillProcess(nInd As Integer)
Dim Procs() As Process
Procs = Process.GetProcessesByName(If(nInd <> 2, m_sCameraProcName, m_sCameraProcName2))
For i As Integer = 0 To Procs.Length() - 1
Procs(i).Kill()
Procs(i).WaitForExit(2000)
Next i
End Sub
End Class
+500
View File
@@ -0,0 +1,500 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtSTONELib="clr-namespace:EgtSTONELib"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5">
<!--
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<EgtWPFLib5:StatusBarVM x:Key="StatusBarVM"/>
<EgtSTONELib:ProjectSlabVM x:Key="ProjectSlabVM"/>
<EgtSTONELib:OptionPanelSlabVM x:Key="OptionPanelSlabVM"/>
<EgtSTONELib:ListPageSlabVM x:Key="ListPageSlabVM"/>
<EgtSTONELib:DetailPageSlabVM x:Key="DetailPageSlabVM"/>
<EgtSTONELib:SearchPanelSlabVM x:Key="SearchPanelSlabVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="Omag_Blue" Color="#FF095CA8" />
<SolidColorBrush x:Key="Omag_Yellow" Color="#FFFFCE5B" />
<SolidColorBrush x:Key="Omag_Red" Color="Red" />
<SolidColorBrush x:Key="Omag_Green" Color="LawnGreen" />
<SolidColorBrush x:Key="Omag_VeryLightGray" Color="#FFF2F2F2" />
<SolidColorBrush x:Key="Omag_LightGray" Color="LightGray" />
<SolidColorBrush x:Key="Omag_Gray" Color="#FF9E9E9E" />
<SolidColorBrush x:Key="Omag_DarkGray" Color="#FF444444" />
<SolidColorBrush x:Key="Omag_White" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="Omag_Black" Color="#FF000000" />
<!--Colori per EgtWPFLib5-->
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
<!--Colori per TabHeader-->
<LinearGradientBrush x:Key="TabItem.Static.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#F0F0F0" Offset="0.0"/>
<GradientStop Color="#E5E5E5" Offset="1.0"/>
</LinearGradientBrush>
<!--Risorsa che toglie le animazioni dai menù popup per evitare che i menù mru di scelta dei file rimangano aperti se il file è grosso -->
<!--o viene eseguito un lua che non aggiorna l'interfaccia-->
<PopupAnimation x:Key="{x:Static SystemParameters.MenuPopupAnimationKey}">None</PopupAnimation>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- FocusVisual standard-->
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- Button Style -->
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
<Setter Property="OpacityMask" Value="#54707070"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Template che permette di andare a capo-->
<DataTemplate x:Key="WrapButton_DataTemplate">
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding}"/>
</DataTemplate>
<Style x:Key="ToolBar_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
</Style>
<Style x:Key="ToolBar_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="80"/>
</Style>
<Style x:Key="OptionPanel_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="OptionPanel_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
</Style>
<Style x:Key="OptionPanel_TextWrapButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="ContentTemplate" Value="{StaticResource WrapButton_DataTemplate}" />
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="Height" Value="45"/>
</Style>
<Style x:Key="OptionPanel_NestingButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="CompoWindow_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="40"/>
</Style>
<Style x:Key="EgtWPFLib5_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="60"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- ToggleButton Style -->
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Omag_Yellow}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
<Setter Property="OpacityMask" Value="#54707070"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolBar_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
</Style>
<Style x:Key="ToolBar_TextToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="70"/>
</Style>
<Style x:Key="OptionPanel_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
</Style>
<Style x:Key="OptionPanel_NestingToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="CompoWindow_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="40"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- TextBlock -->
<Style x:Key="ToolsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
<Style x:Key="MachiningsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
<Style x:Key="MachiningsToolTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Margin" Value="10,5,0,0"/>
</Style>
<Style x:Key="ValidationErrorTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="Red"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="0,1"/>
</Style>
<Style x:Key="OptionTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- TextBox -->
<Style TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
<Setter Property="Height" Value="22"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Right"/>
<Setter Property="ExplicitUpdateSource" Value="EnterKeyPress"/>
</Style>
<Style x:Key="ToolsTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
<Style x:Key="MachiningsTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
<Setter Property="Margin" Value="0,0,0,10"/>
</Style>
<Style x:Key="MachiningsToolTextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtTextBox}}">
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- MachGroup -->
<SolidColorBrush x:Key="ScrollBar.Static.Background" Color="#F0F0F0"/>
<SolidColorBrush x:Key="ScrollBar.Static.Border" Color="#F0F0F0"/>
<SolidColorBrush x:Key="ScrollBar.Pressed.Glyph" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ScrollBar.MouseOver.Glyph" Color="#000000"/>
<SolidColorBrush x:Key="ScrollBar.Disabled.Glyph" Color="#BFBFBF"/>
<SolidColorBrush x:Key="ScrollBar.Static.Glyph" Color="#606060"/>
<SolidColorBrush x:Key="ScrollBar.MouseOver.Background" Color="#DADADA"/>
<SolidColorBrush x:Key="ScrollBar.MouseOver.Border" Color="#DADADA"/>
<SolidColorBrush x:Key="ScrollBar.Pressed.Background" Color="#606060"/>
<SolidColorBrush x:Key="ScrollBar.Pressed.Border" Color="#606060"/>
<SolidColorBrush x:Key="ScrollBar.Disabled.Background" Color="#F0F0F0"/>
<SolidColorBrush x:Key="ScrollBar.Disabled.Border" Color="#F0F0F0"/>
<Style x:Key="CustomScrollBarButton" TargetType="{x:Type RepeatButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border x:Name="border" CornerRadius="3" BorderBrush="{StaticResource ScrollBar.Static.Border}" BorderThickness="1" Background="{StaticResource ScrollBar.Static.Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="contentPresenter" Value="0.56"/>
<Setter Property="Background" TargetName="border" Value="{StaticResource ScrollBar.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollBar.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- Border -->
<Style x:Key="DefaultBorder" TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="#D5DFE5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="Margin" Value="1"/>
</Style>
<Style x:Key="Border" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="3"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- EgtCustomWindow -->
<Style TargetType="{x:Type EgtWPFLib5:EgtCustomWindow}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtCustomWindow}}">
<Setter Property="TitleBarHeight" Value="32"/>
<Setter Property="TitleBarBrush" Value="{StaticResource Omag_LightGray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- EgtFloatingPanel -->
<Style x:Key="ToolBar_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
<Setter Property="IsFloating" Value="False"/>
</Style>
<Style x:Key="Option_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
<Setter Property="TitleBarOrientation" Value="Vertical"/>
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
<Setter Property="IsFloating" Value="False"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- CsvTreeViewItem DA CAMBIARE!! -->
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Fill" Color="#FF595959"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Stroke" Color="#FF262626"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Stroke" Color="#FF1BBBFA"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Fill" Color="Transparent"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Stroke" Color="#FF262626"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Fill" Color="#FF595959"/>
<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Fill" Color="Transparent"/>
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Stroke" Color="#FF989898"/>
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
<Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="{StaticResource TreeViewItem.TreeArrow.Static.Fill}" Stroke="{StaticResource TreeViewItem.TreeArrow.Static.Stroke}">
<Path.RenderTransform>
<RotateTransform Angle="135" CenterY="3" CenterX="3"/>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="RenderTransform" TargetName="ExpandPath">
<Setter.Value>
<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
</Setter.Value>
</Setter>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsChecked" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CsvPartItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="ExpanderBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
</Border>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1"/>
<Setter Property="Background" TargetName="ExpanderBorder" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="ExpanderBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="BorderThickness" TargetName="ExpanderBorder" Value="1,1,0,1"/>
<!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>-->
</Trigger>
<!--<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</MultiTrigger>-->
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- ComboBox -->
<Style x:Key="MachiningsComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Margin" Value="0,0,0,10"/>
</Style>
<Style x:Key="MachiningsToolComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- CheckBox -->
<Style x:Key="OptionCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary>
+30
View File
@@ -0,0 +1,30 @@
Public Class Dictionary
Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
#Region "Colors"
Private m_Omag_Red As SolidColorBrush = Brushes.Red
Public ReadOnly Property Omag_Red As SolidColorBrush
Get
Return m_Omag_Red
End Get
End Property
Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
Get
Return m_Button_Static_Background
End Get
End Property
Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
Get
Return m_TabControl_Header_Background
End Get
End Property
#End Region ' Colors
End Class
+106
View File
@@ -0,0 +1,106 @@
Public Module MainData
' salva il contesto della libreria
Private m_ContextSTONELib As Integer
Public Sub SetContextSTONELib(Context As Integer)
m_ContextSTONELib = Context
End Sub
Public ReadOnly Property ContextSTONELib As Integer
Get
Return m_ContextSTONELib
End Get
End Property
'salva il contesto del programma chiamante
Private m_PreviousContext As Integer
Public Sub SetPreviousContext(PreviousContext As Integer)
m_PreviousContext = PreviousContext
End Sub
Public ReadOnly Property PreviousContext As Integer
Get
Return m_PreviousContext
End Get
End Property
Private m_bIsOmagOFFICE As Boolean = False
Public ReadOnly Property bIsOmagOFFICE As Boolean
Get
Return m_bIsOmagOFFICE
End Get
End Property
Private m_sConfigDir As String = String.Empty
Public ReadOnly Property sConfigDir As String
Get
Return m_sConfigDir
End Get
End Property
Private m_nKeyLevel As Integer
Friend ReadOnly Property nKeyLevel As Integer
Get
Return m_nKeyLevel
End Get
End Property
Private m_nKeyOptions As UInteger
Friend ReadOnly Property nKeyOptions As Integer
Get
Return m_nKeyOptions
End Get
End Property
Private m_sPhotoDir As String
Friend ReadOnly Property sPhotoDir As String
Get
Return m_sPhotoDir
End Get
End Property
Private m_sBackUpDir As String
Friend ReadOnly Property sBackUpDir As String
Get
Return m_sBackUpDir
End Get
End Property
Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
Return ((m_nKeyOptions And nKeyOpt) <> 0)
End Function
Public Sub SetIsOmagOFFICE(bIsOmagOFFICE As Boolean)
m_bIsOmagOFFICE = bIsOmagOFFICE
End Sub
Public Sub SetConfigDir(sConfigDir As String)
m_sConfigDir = sConfigDir
End Sub
Public Sub SetKeyLevel(nKeyLevel As Integer)
m_nKeyLevel = nKeyLevel
End Sub
Public Sub SetKeyOptions(nKeyOptions As Integer)
m_nKeyOptions = nKeyOptions
End Sub
Public Sub SetPhotoDir(sPhotoDir As String)
m_sPhotoDir = sPhotoDir
End Sub
Public Sub SetBackUpDir(sBackUpDir As String)
m_sBackUpDir = sBackUpDir
End Sub
Public Sub SetCamera(objCamera As Camera)
StoneMap.refProjectVM.m_Camera = objCamera
End Sub
'Public Sub SetMaterialFromDB()
' Dim MatList As List(Of String) = ManageDb.FindAllMaterialInDB()
' StoneMap.refProjectVM.MaterialList.Clear()
' For Each Item In MatList
' StoneMap.refProjectVM.MaterialList.Add(Item)
' Next
'End Sub
End Module
+241
View File
@@ -0,0 +1,241 @@
Imports System.IO
Imports System.Data.SQLite
Imports EgtUILib
Imports EgtWPFLib5
Public Module ManageDb
#Region "FIELDS & PROPERTIES"
Public Const DB_FILENAME As String = "OmagPHOTODb.sqlite"
Private m_DbConnection As SQLiteConnection
Public ReadOnly Property DbConnection As SQLiteConnection
Get
Return m_DbConnection
End Get
End Property
Private BackUpDbCallBack As New SQLiteBackupCallback(AddressOf BackUpDbCallBackFunction)
#End Region ' FIELDS & PROPERTIES
#Region "METHODS"
Friend Sub CreateDbFile()
SQLiteConnection.CreateFile(MainData.sPhotoDir & "\" & DB_FILENAME)
End Sub
Friend Function ConnectToDb() As Boolean
Dim DbPath As String = MainData.sPhotoDir & "\" & DB_FILENAME
If Not File.Exists(DbPath) Then Return False
m_DbConnection = New SQLiteConnection("Data Source = " & DbPath & "; Version = 3;")
Return Not IsNothing(m_DbConnection)
End Function
Public Function ConnectToDb(DbPath As String) As Boolean
EgtOutLog("Connecting to DB " & DbPath)
If Not File.Exists(DbPath) Then Return False
Try
m_DbConnection = New SQLiteConnection("Data Source = " & DbPath & "; Version = 3;")
' Verifica integrità del DB
m_DbConnection.Open()
Dim Command As SQLiteCommand = New SQLiteCommand("PRAGMA quick_check;", m_DbConnection)
Dim Reader As SQLiteDataReader = Command.ExecuteReader()
Reader.Read()
Dim sRes As String = Reader(0)
m_DbConnection.Close()
Catch ex As Exception
EgtOutLog(ex.Message)
Return False
End Try
Return Not IsNothing(m_DbConnection)
End Function
Friend Sub CreateTable()
Dim SqlCommand As String = "CREATE TABLE " & Slab.DB_SLABS & " (" & Slab.DB_ID & " TEXT PRIMARY KEY," &
Slab.DB_IMAGEPATH & " TEXT," &
Slab.DB_STATE & " INTEGER," &
Slab.DB_PROJASSIGNEDTO & " TEXT," &
Slab.DB_MATERIAL & " TEXT," &
Slab.DB_THICKNESS & " REAL," &
Slab.DB_WAREHOUSEPOS & " TEXT," &
Slab.DB_ADDEDDATE & " INTEGER)"
ExecuteQuery(SqlCommand)
End Sub
Friend Function ExecuteQuery(SqlQuery As String) As Integer
m_DbConnection.Open()
Dim Command As SQLiteCommand = New SQLiteCommand(SqlQuery, m_DbConnection)
Dim ModifiedRowNumber As Integer = Command.ExecuteNonQuery()
m_DbConnection.Close()
Return ModifiedRowNumber
End Function
Friend Function ExecuteReaderQuery(SqlQuery As String) As SQLiteDataReader
Dim Command As SQLiteCommand = New SQLiteCommand(SqlQuery, m_DbConnection)
Dim Reader As SQLiteDataReader = Command.ExecuteReader()
Return Reader
End Function
Friend Function ExecuteSlabReaderQuery(SqlQuery As String) As List(Of Slab)
Dim SlabList As New List(Of Slab)
ManageDb.DbConnection.Open()
Try
Dim Command As SQLiteCommand = New SQLiteCommand(SqlQuery, m_DbConnection)
Dim Reader As SQLiteDataReader = Command.ExecuteReader()
While Reader.Read()
SlabList.Add(New Slab(Reader))
End While
Catch ex As Exception
End Try
ManageDb.DbConnection.Close()
Return SlabList
End Function
Public Function ManageBackUp() As Boolean
ClearBackUps()
Dim BackUpDbPath As String = MainData.sBackUpDir & "\" & Path.GetFileNameWithoutExtension(DB_FILENAME) & Date.Now.ToString("yyyy-MM-dd_HH-mm-ss") & ".sqlite"
SQLiteConnection.CreateFile(BackUpDbPath)
Using BackUpDbConnection As New SQLiteConnection("Data Source = " & BackUpDbPath & "; Version=3;")
m_DbConnection.Open()
BackUpDbConnection.Open()
m_DbConnection.BackupDatabase(BackUpDbConnection, "main", "main", -1, BackUpDbCallBack, 0)
m_DbConnection.Close()
BackUpDbConnection.Close()
End Using
LibMap.refStatusBarVM.SetLoadingProgress(100)
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(False)
Return True
End Function
Private Sub ClearBackUps()
Try
Dim bMonthMaintain() As Boolean = {False, False, False, False, False, False, False, False, False, False, False, False}
Dim bWeekMaintain() As Boolean = {False, False, False, False}
For Each file As IO.FileInfo In New IO.DirectoryInfo(MainData.sBackUpDir).GetFiles("*.sqlite").OrderBy(Function(f) f.CreationTime)
If (Now - file.CreationTime).Days > 30 Then
For I = 12 To 2 Step -1
If (Now - file.CreationTime).Days <= 30.5 * I AndAlso (Now - file.CreationTime).Days > 30.5 * (I - 1) Then
If Not bMonthMaintain(I - 1) Then
bMonthMaintain(I - 1) = True
Exit For
Else
file.Delete()
Exit For
End If
End If
Next
ElseIf (Now - file.CreationTime).Days > 28 Then
file.Delete()
Continue For
Else
For I = 4 To 2 Step -1
If (Now - file.CreationTime).Days <= 7 * I AndAlso (Now - file.CreationTime).Days > 7 * (I - 1) Then
If Not bWeekMaintain(I - 1) Then
bWeekMaintain(I - 1) = True
Exit For
Else
file.Delete()
Exit For
End If
End If
Next
End If
Next
Catch ex As Exception
EgtOutLog(ex.Message)
End Try
End Sub
Friend Sub CreateFileToClear()
Try
Dim MostRecentFile As IO.FileInfo = Nothing
For Each CurrFile As IO.FileInfo In New IO.DirectoryInfo(MainData.sBackUpDir).GetFiles("*.sqlite")
If Not IsNothing(MostRecentFile) Then
If (MostRecentFile.CreationTime < CurrFile.CreationTime) Then
File.Delete(MostRecentFile.FullName)
MostRecentFile = CurrFile
Else
File.Delete(CurrFile.FullName)
End If
Else
MostRecentFile = CurrFile
End If
Next
If IsNothing(MostRecentFile) Then Return
For I = 0 To 365
Dim CreationDate As Date = Date.Now.AddDays(-I)
Dim NewFilePath As String = MainData.sBackUpDir & "\" & Path.GetFileNameWithoutExtension(DB_FILENAME) & CreationDate.ToString("yyyy-MM-dd_HH-mm-ss") & ".sqlite"
File.Copy(MostRecentFile.FullName, NewFilePath)
File.SetCreationTime(NewFilePath, CreationDate)
File.SetLastAccessTime(NewFilePath, CreationDate)
File.SetLastWriteTime(NewFilePath, CreationDate)
Next
File.Delete(MostRecentFile.FullName)
Catch ex As Exception
EgtOutLog(ex.Message)
End Try
End Sub
Private Function BackUpDbCallBackFunction(source As SQLiteConnection, sourceName As String, destination As SQLiteConnection, destinationName As String, pages As Integer, remainingPages As Integer, totalPages As Integer, retry As Boolean) As Boolean
LibMap.refStatusBarVM.SetLoadingProgress_Visibility(True)
LibMap.refStatusBarVM.SetLoadingProgress(100% * (totalPages - remainingPages) / totalPages)
Return True
End Function
Friend Sub AddRandomRows(nRow As Integer)
Dim ImagePathList() As String = {"c:\EgtData\OmagPHOTO\Data\Lastra15_18.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra18_10.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra313.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra313_b.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra3138bit.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra33-18_234.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra55_33.jpg",
"c:\EgtData\OmagPHOTO\Data\Lastra55-23.jpg",
"c:\EgtData\OmagPHOTO\Data\Prova1.jpg",
"c:\EgtData\OmagPHOTO\Data\Prova2.jpg",
"c:\EgtData\OmagPHOTO\Data\Prova3.jpg",
"c:\EgtData\OmagPHOTO\Data\Prova4.jpg"}
Dim Text As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
For i = 0 To nRow
Dim R As New Random()
Dim Name As String = "Lastra" & i
Dim ImagePath As String = ImagePathList(R.Next(0, ImagePathList.Length))
Dim SlabState As String = StoneMap.refOptionPanelVM.StateList(R.Next(0, StoneMap.refOptionPanelVM.StateList.Count)).Id.ToString
Dim Material As String = StoneMap.refOptionPanelVM.MaterialList(R.Next(0, StoneMap.refOptionPanelVM.MaterialList.Count))
Dim SlabThickness As String = (R.Next(200, 700) / 10).ToString
Dim WarehousePosition As String = Text(R.Next(Text.Length)) & R.Next(1, 100) & "." & R.Next(1, 100)
Dim AddedDate As DateTime = DateTime.Now - New TimeSpan(R.Next(0, 730), R.Next(0, 24), R.Next(0, 60), R.Next(0, 60))
' Aggiungo la nuova lastra al Db
Dim Query As String = "INSERT INTO " & Slab.DB_SLABS & " (" & Slab.DB_ID & ", " & Slab.DB_IMAGEPATH & ", " & Slab.DB_STATE & ", " & Slab.DB_PROJASSIGNEDTO & ", " & Slab.DB_MATERIAL & ", " & Slab.DB_THICKNESS & ", " & Slab.DB_WAREHOUSEPOS & ", " & Slab.DB_ADDEDDATE & ")" &
" VALUES ('" & Name & "', " &
"'" & ImagePath & "', " &
SlabState & ", " &
"'" & "C:\EgtData\OmagOFFICE\Progetto" & i & "', " &
"'" & Material & "', " &
SlabThickness & ", " &
"'" & WarehousePosition & "', " &
"Date('" & (String.Format("{0:yyyy-MM-dd}", AddedDate)) & "'))"
ManageDb.ExecuteQuery(Query)
Next
End Sub
Public Function FindAllMaterialInDB() As List(Of String)
Dim LocalMaterialLIst As New List(Of String)
ManageDb.DbConnection.Open()
Try
Dim SqlCommand As String = "SELECT DISTINCT " & Slab.DB_MATERIAL & " FROM " & Slab.DB_SLABS & " ORDER BY " & Slab.DB_MATERIAL & " ASC"
Dim Reader As SQLiteDataReader = ExecuteReaderQuery(SqlCommand)
While Reader.Read()
LocalMaterialLIst.Add(Reader(Slab.DB_MATERIAL))
End While
Catch ex As Exception
End Try
m_DbConnection.Close()
Return LocalMaterialLIst
End Function
#End Region ' METHODS
End Module
+115
View File
@@ -0,0 +1,115 @@
Imports EgtWPFLib5
Public Module StoneMap
Private m_refSearchPanelVM As SearchPanelSlabVM
Private m_refProjectVM As ProjectSlabVM
Private m_refOptionPanelVM As OptionPanelSlabVM
Private m_refListPageVM As ListPageSlabVM
Private m_refDetailPageVM As DetailPageSlabVM
Friend m_ContinueApplication As Boolean = True
Public ReadOnly Property ContninueApplication As Boolean
Get
Return m_ContinueApplication
End Get
End Property
#Region "Get"
Public ReadOnly Property refSearchPanelVM As SearchPanelSlabVM
Get
Return m_refSearchPanelVM
End Get
End Property
Public ReadOnly Property refStatusBarVM As StatusBarVM
Get
Return LibMap.refStatusBarVM
End Get
End Property
Public ReadOnly Property refProjectVM As ProjectSlabVM
Get
Return m_refProjectVM
End Get
End Property
Public ReadOnly Property refSceneHostVM As SceneHostVM
Get
Return LibMap.refSceneHostVM
End Get
End Property
Public ReadOnly Property refOptionPanelVM As OptionPanelSlabVM
Get
Return m_refOptionPanelVM
End Get
End Property
Public ReadOnly Property refListPageVM As ListPageSlabVM
Get
Return m_refListPageVM
End Get
End Property
Public ReadOnly Property refDetailPageVM As DetailPageSlabVM
Get
Return m_refDetailPageVM
End Get
End Property
#End Region ' Get
#Region "Set"
Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
LibMap.SetRefStatusBarVM(StatusBarVM)
Return Not IsNothing(LibMap.refStatusBarVM)
End Function
Friend Function SetRefProjectVM(ProjectVM As ProjectSlabVM) As Boolean
m_refProjectVM = ProjectVM
Return Not IsNothing(m_refProjectVM)
End Function
Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
LibMap.SetRefSceneHostVM(SceneHostVM)
Return Not IsNothing(LibMap.refSceneHostVM)
End Function
Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelSlabVM) As Boolean
m_refOptionPanelVM = OptionPanelVM
Return Not IsNothing(m_refOptionPanelVM)
End Function
Friend Function SetRefListPageVM(ListPageVM As ListPageSlabVM) As Boolean
m_refListPageVM = ListPageVM
Return Not IsNothing(m_refListPageVM)
End Function
Friend Function SetRefDetailPageVM(DetailPageVM As DetailPageSlabVM) As Boolean
m_refDetailPageVM = DetailPageVM
Return Not IsNothing(m_refDetailPageVM)
End Function
Friend Function SetRefSearchPanelVM(SearchPanelVM As SearchPanelSlabVM) As Boolean
m_refSearchPanelVM = SearchPanelVM
Return Not IsNothing(m_refSearchPanelVM)
End Function
#End Region ' Set
#Region "Init"
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
Return Not IsNothing(m_refProjectVM) AndAlso
Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refStatusBarVM) AndAlso
Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refListPageVM) AndAlso
Not IsNothing(m_refDetailPageVM) AndAlso Not IsNothing(m_refSearchPanelVM) AndAlso
LibMap.EndInit
End Function
#End Region ' Init
End Module
+295
View File
@@ -0,0 +1,295 @@
Imports System.Windows.Controls.Primitives
Imports System.Windows.Controls
Imports System.Windows
Imports System.Windows.Media
Imports System
Imports System.Diagnostics
Imports System.Collections.Specialized
Imports System.Windows.Data
Public Class VirtualizingTilePanel
Inherits VirtualizingPanel
Implements IScrollInfo
Public Sub New()
' For use in the IScrollInfo implementation
Me.RenderTransform = _trans
End Sub
Public Shared ReadOnly ChildSizeProperty As DependencyProperty = DependencyProperty.RegisterAttached("ChildSize", GetType(Double), GetType(VirtualizingTilePanel), New FrameworkPropertyMetadata(200.0, FrameworkPropertyMetadataOptions.AffectsMeasure Or FrameworkPropertyMetadataOptions.AffectsArrange))
Public Property ChildSize As Double
Get
Return CDbl(GetValue(ChildSizeProperty))
End Get
Set(ByVal value As Double)
SetValue(ChildSizeProperty, value)
End Set
End Property
Protected Overrides Function MeasureOverride(ByVal availableSize As Size) As Size
UpdateScrollInfo(availableSize)
Dim firstVisibleItemIndex, lastVisibleItemIndex As Integer
GetVisibleRange(firstVisibleItemIndex, lastVisibleItemIndex)
Dim children As UIElementCollection = Me.InternalChildren
Dim generator As IItemContainerGenerator = Me.ItemContainerGenerator
Dim startPos As GeneratorPosition = generator.GeneratorPositionFromIndex(firstVisibleItemIndex)
Dim childIndex As Integer = If((startPos.Offset = 0), startPos.Index, startPos.Index + 1)
Using generator.StartAt(startPos, GeneratorDirection.Forward, True)
Dim itemIndex As Integer = firstVisibleItemIndex
While itemIndex <= lastVisibleItemIndex
Dim newlyRealized As Boolean
Dim child As UIElement = TryCast(generator.GenerateNext(newlyRealized), UIElement)
If newlyRealized Then
If childIndex >= children.Count Then
MyBase.AddInternalChild(child)
Else
MyBase.InsertInternalChild(childIndex, child)
End If
generator.PrepareItemContainer(child)
Else
Debug.Assert(child Is children(childIndex), "Wrong child was generated")
End If
child.Measure(GetChildSize())
System.Threading.Interlocked.Increment(itemIndex)
System.Threading.Interlocked.Increment(childIndex)
End While
End Using
CleanUpItems(firstVisibleItemIndex, lastVisibleItemIndex)
Return availableSize
End Function
Protected Overrides Function ArrangeOverride(ByVal finalSize As Size) As Size
Dim generator As IItemContainerGenerator = Me.ItemContainerGenerator
UpdateScrollInfo(finalSize)
For i As Integer = 0 To Me.Children.Count - 1
Dim child As UIElement = Me.Children(i)
Dim itemIndex As Integer = generator.IndexFromGeneratorPosition(New GeneratorPosition(i, 0))
ArrangeChild(itemIndex, child, finalSize)
Next
Return finalSize
End Function
Private Sub CleanUpItems(ByVal minDesiredGenerated As Integer, ByVal maxDesiredGenerated As Integer)
Dim children As UIElementCollection = Me.InternalChildren
Dim generator As IItemContainerGenerator = Me.ItemContainerGenerator
Dim i As Integer = children.Count - 1
While i >= 0
Dim childGeneratorPos As GeneratorPosition = New GeneratorPosition(i, 0)
Dim itemIndex As Integer = generator.IndexFromGeneratorPosition(childGeneratorPos)
If itemIndex < minDesiredGenerated OrElse itemIndex > maxDesiredGenerated Then
generator.Remove(childGeneratorPos, 1)
RemoveInternalChildRange(i, 1)
End If
i -= 1
End While
End Sub
Protected Overrides Sub OnItemsChanged(ByVal sender As Object, ByVal args As ItemsChangedEventArgs)
Select Case args.Action
Case NotifyCollectionChangedAction.Remove, NotifyCollectionChangedAction.Replace, NotifyCollectionChangedAction.Move
RemoveInternalChildRange(args.Position.Index, args.ItemUICount)
End Select
End Sub
Private Function CalculateExtent(ByVal availableSize As Size, ByVal itemCount As Integer) As Size
Dim childrenPerRow As Integer = CalculateChildrenPerRow(availableSize)
Return New Size(childrenPerRow * Me.ChildSize, Me.ChildSize * Math.Ceiling(CDbl(itemCount) / childrenPerRow))
End Function
Private Sub GetVisibleRange(ByRef firstVisibleItemIndex As Integer, ByRef lastVisibleItemIndex As Integer)
Dim childrenPerRow As Integer = CalculateChildrenPerRow(_extent)
firstVisibleItemIndex = CInt(Math.Floor(_offset.Y / Me.ChildSize)) * childrenPerRow
lastVisibleItemIndex = CInt(Math.Ceiling((_offset.Y + _viewport.Height) / Me.ChildSize)) * childrenPerRow - 1
Dim itemsControl As ItemsControl = itemsControl.GetItemsOwner(Me)
Dim itemCount As Integer = If(itemsControl.HasItems, itemsControl.Items.Count, 0)
If lastVisibleItemIndex >= itemCount Then lastVisibleItemIndex = itemCount - 1
End Sub
Private Function GetChildSize() As Size
Return New Size(Me.ChildSize, Me.ChildSize)
End Function
Private Sub ArrangeChild(ByVal itemIndex As Integer, ByVal child As UIElement, ByVal finalSize As Size)
Dim childrenPerRow As Integer = CalculateChildrenPerRow(finalSize)
Dim row As Integer = itemIndex \ childrenPerRow ' IMPORTANTE L'operatore è di divisione intera, quindi \ NON / che invece arrotonda all'intero pari più vicino!!!!
Dim column As Integer = itemIndex Mod childrenPerRow
child.Arrange(New Rect(column * Me.ChildSize, row * Me.ChildSize, Me.ChildSize, Me.ChildSize))
End Sub
Private Function CalculateChildrenPerRow(ByVal availableSize As Size) As Integer
Dim childrenPerRow As Integer
If availableSize.Width = Double.PositiveInfinity Then childrenPerRow = Me.Children.Count Else childrenPerRow = Math.Max(1, CInt(Math.Floor(availableSize.Width / Me.ChildSize)))
Return childrenPerRow
End Function
Private Sub UpdateScrollInfo(ByVal availableSize As Size)
Dim itemsControl As ItemsControl = itemsControl.GetItemsOwner(Me)
Dim itemCount As Integer = If(itemsControl.HasItems, itemsControl.Items.Count, 0)
Dim extent As Size = CalculateExtent(availableSize, itemCount)
If extent <> _extent Then
_extent = extent
If _owner IsNot Nothing Then _owner.InvalidateScrollInfo()
End If
If availableSize <> _viewport Then
_viewport = availableSize
If _owner IsNot Nothing Then _owner.InvalidateScrollInfo()
End If
End Sub
Public Property ScrollOwner As ScrollViewer Implements IScrollInfo.ScrollOwner
Get
Return _owner
End Get
Set(ByVal value As ScrollViewer)
_owner = value
End Set
End Property
Public Property CanHorizontallyScroll As Boolean Implements IScrollInfo.CanHorizontallyScroll
Get
Return _canHScroll
End Get
Set(ByVal value As Boolean)
_canHScroll = value
End Set
End Property
Public Property CanVerticallyScroll As Boolean Implements IScrollInfo.CanVerticallyScroll
Get
Return _canVScroll
End Get
Set(ByVal value As Boolean)
_canVScroll = value
End Set
End Property
Public ReadOnly Property HorizontalOffset As Double Implements IScrollInfo.HorizontalOffset
Get
Return _offset.X
End Get
End Property
Public ReadOnly Property VerticalOffset As Double Implements IScrollInfo.VerticalOffset
Get
Return _offset.Y
End Get
End Property
Public ReadOnly Property ExtentHeight As Double Implements IScrollInfo.ExtentHeight
Get
Return _extent.Height
End Get
End Property
Public ReadOnly Property ExtentWidth As Double Implements IScrollInfo.ExtentWidth
Get
Return _extent.Width
End Get
End Property
Public ReadOnly Property ViewportHeight As Double Implements IScrollInfo.ViewportHeight
Get
Return _viewport.Height
End Get
End Property
Public ReadOnly Property ViewportWidth As Double Implements IScrollInfo.ViewportWidth
Get
Return _viewport.Width
End Get
End Property
Public Sub LineUp() Implements IScrollInfo.LineUp
SetVerticalOffset(Me.VerticalOffset - 10)
End Sub
Public Sub LineDown() Implements IScrollInfo.LineDown
SetVerticalOffset(Me.VerticalOffset + 10)
End Sub
Public Sub PageUp() Implements IScrollInfo.PageUp
SetVerticalOffset(Me.VerticalOffset - _viewport.Height)
End Sub
Public Sub PageDown() Implements IScrollInfo.PageDown
SetVerticalOffset(Me.VerticalOffset + _viewport.Height)
End Sub
Public Sub MouseWheelUp() Implements IScrollInfo.MouseWheelUp
SetVerticalOffset(Me.VerticalOffset - 50)
End Sub
Public Sub MouseWheelDown() Implements IScrollInfo.MouseWheelDown
SetVerticalOffset(Me.VerticalOffset + 50)
End Sub
Public Sub LineLeft() Implements IScrollInfo.LineLeft
Throw New InvalidOperationException()
End Sub
Public Sub LineRight() Implements IScrollInfo.LineRight
Throw New InvalidOperationException()
End Sub
Public Function MakeVisible(ByVal visual As Visual, ByVal rectangle As Rect) As Rect Implements IScrollInfo.MakeVisible
Return New Rect()
End Function
Public Sub MouseWheelLeft() Implements IScrollInfo.MouseWheelLeft
Throw New InvalidOperationException()
End Sub
Public Sub MouseWheelRight() Implements IScrollInfo.MouseWheelRight
Throw New InvalidOperationException()
End Sub
Public Sub PageLeft() Implements IScrollInfo.PageLeft
Throw New InvalidOperationException()
End Sub
Public Sub PageRight() Implements IScrollInfo.PageRight
Throw New InvalidOperationException()
End Sub
Public Sub SetHorizontalOffset(ByVal offset As Double) Implements IScrollInfo.SetHorizontalOffset
Throw New InvalidOperationException()
End Sub
Public Sub SetVerticalOffset(ByVal offset As Double) Implements IScrollInfo.SetVerticalOffset
If offset < 0 OrElse _viewport.Height >= _extent.Height Then
offset = 0
Else
If offset + _viewport.Height >= _extent.Height Then
offset = _extent.Height - _viewport.Height
End If
End If
_offset.Y = offset
If _owner IsNot Nothing Then _owner.InvalidateScrollInfo()
_trans.Y = -offset
InvalidateMeasure()
End Sub
Private _trans As TranslateTransform = New TranslateTransform()
Private _owner As ScrollViewer
Private _canHScroll As Boolean = False
Private _canVScroll As Boolean = False
Private _extent As Size = New Size(0, 0)
Private _viewport As Size = New Size(0, 0)
Private _offset As Point
End Class