Can someone please provide some tip how to solve this issue with my script?
Script description:
Its script which creates HTML signature from GUI created in WPF.
Problem description:
First run script with WPF creates folder with right name, copy images and create HTML with right name but HTML file is blank only with images. After second run of script the folder, html file and images are filled right but with information from first run.
I guess it has something with $Global variables, because this issue is detected after i add in some $Global vars.
Thank you for any help.
PS1. script:
Add-Type -Name Window -Namespace Console -MemberDefinition
[DllImport("Kernel32.dll")]
public static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);'
[Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), 0)
#-------------------------------------------------------------#
#----Initial Declarations-------------------------------------#
#-------------------------------------------------------------#
Add-Type -AssemblyName PresentationCore, PresentationFramework
$Xaml = #"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="647" Height="630" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:ListBoxStyle">
<Window.Resources>
<Style x:Key="_ListBoxItemStyle" TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Name="_Border" Padding="2" SnapsToDevicePixels="true">
<ContentPresenter/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="_Border" Property="Background" Value="#18509c"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Name="GTX_Podpis" Margin="-2,-1,2,1" MinWidth="1500" MinHeight="1000">
<Image HorizontalAlignment="Left" Height="112" VerticalAlignment="Top" Width="137" Margin="10.84375,11,0,0" Name="Gumotex" Source="\\gtxdc1\Skupiny\Posta podpisy\Husařík_Jakub\logo_gumotex.png"/>
<TextBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" VerticalAlignment="Top" Height="30" Width="120" TextWrapping="Wrap" Margin="185,24,0,0" Name="TitulPred" Tag="TitulPred" Text="" ToolTip="TitulPřed"/>
<TextBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" VerticalAlignment="Top" Height="30" Width="120" TextWrapping="Wrap" Margin="321,24,0,0" Name="TitulZa" Tag="TitulZa" Text="" ToolTip="TitulZa"/>
<TextBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="187,76,0,0" Name="Jmeno" ToolTip="Jméno" Text="" Tag="Jmeno"/>
<TextBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="187,133,0,0" Name="Prijmeni" Tag="Prijmeni" Text="" ToolTip="Přijmeni"/>
<TextBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="189,183,0,0" Name="Funkce" Tag="Funkce" Text="" ToolTip="Funkce"/>
<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="189,235,0,0" Name="Email" BorderBrush="#18509c" BorderThickness="2"/>
<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="190,290,0,0" Name="Mobil" BorderBrush="#18509c" BorderThickness="2"/>
<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Height="30" Width="181" TextWrapping="Wrap" Margin="189,349,0,0" Name="PevnaLinka" BorderBrush="#18509c" BorderThickness="2"/>
<ListBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" Height="88" VerticalAlignment="Top" Width="164" Margin="7,75,0,0" Name="Divize" Tag="Divize" ToolTip="Divize" Foreground="#000000" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ItemContainerStyle="{DynamicResource _ListBoxItemStyle}"
>
<ListBoxItem Content="DIVIZE SERVICE"/>
<ListBoxItem Content="DIVIZE COATING"/>
<ListBoxItem Content="AUTOMOTIVE DIVISION"/>
<ListBoxItem Content="COATING DIVISION"/>
</ListBox>
<ListBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" Height="304" VerticalAlignment="Top" Width="243" Margin="387,75,0,0" Name="Zavod" Tag="Závod" ToolTip="Závod" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ItemContainerStyle="{DynamicResource _ListBoxItemStyle}"
>
<ListBoxItem Content="PRÁZDNÉ"/>
<ListBoxItem Content="ZÁVOD BŘECLAV"/>
<ListBoxItem Content="ZÁVOD TŘEBÍČ"/>
<ListBoxItem Content="ZÁVOD JAROMĚŘ"/>
<ListBoxItem Content="ZÁVOD MYJAVA"/>
<ListBoxItem Content="ZÁVOD ROŽNOV"/>
<ListBoxItem Content="PRODUCTION PLANT BRECLAV"/>
<ListBoxItem Content="PRODUCTION PLANT TREBIC"/>
<ListBoxItem Content="PRODUCTION PLANT JAROMER"/>
<ListBoxItem Content="PRODUCTION PLANT MYJAVA"/>
<ListBoxItem Content="PRODUCTION PLANT ROZNOV"/>
<ListBoxItem Content="ENGINEERING DEPARTMENT BRECLAV"/>
<ListBoxItem Content="ENGINEERING DEPARTMENT TREBIC"/>
<ListBoxItem Content="ENGINEERING DEPARTMENT JAROMER"/>
<ListBoxItem Content="ENGINEERING DEPARTMENT MYJAVA"/>
<ListBoxItem Content="ENGINEERING DEPARTMENT ROZNOV"/>
</ListBox>
<ListBox HorizontalAlignment="Left" BorderBrush="#18509c" BorderThickness="2" Height="109" VerticalAlignment="Top" Width="164" Margin="7,184,0,0" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ItemContainerStyle="{DynamicResource _ListBoxItemStyle}" Name = "Adresa"
>
<ListBoxItem Content="BŘECLAV"/>
<ListBoxItem Content="TŘEBÍČ"/>
<ListBoxItem Content="JAROMĚŘ"/>
<ListBoxItem Content="MYJAVA"/>
<ListBoxItem Content="ROŽNOV"/>
</ListBox>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Adresa" Margin="9,164,0,0" Name="AdresaLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Divize" Margin="8,54,0,0" Name="DivizeLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="TitulPred" Margin="184,5,0,0" Name="TitulPredLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Jméno" Margin="188,56,0,0" Name="JmenoLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="TitulZa" Margin="321,5,0,0" Name="TitulZaLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Přijmení" Margin="187,112,0,0" Name="PrijmeniLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Funkce" Margin="188,164,0,0" Name="FunkceLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Závod" Margin="388,55,0,0" Name="ZavodLabel"/>
<Button Content="Vytvoř podpis" HorizontalAlignment="Left" VerticalAlignment="Top" Width="224" Margin="6,527,0,0" Name="VytvorPodpisButton" Background="#18509c" Foreground="#efefef" Height="55" FontSize="15"/>
<Button Content="Zavřít" HorizontalAlignment="Left" VerticalAlignment="Top" Width="224" Margin="403,529,0,0" Height="55" Name="ZavritButton" Background="#18509c" Foreground="#ffffff" FontSize="15"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Email" Margin="189,214,0,0" Name="EmalLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Mobil" Margin="190,267,0,0" Name="MobilLabel"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Pevná linka" Margin="189,327,0,0" Name="PevnaLinkaLabel"/>
</Grid>
</Window>
"#
#-------------------------------------------------------------#
#----Global variables-----------------------------------#
#-------------------------------------------------------------#
$Global:ZavodHTML
$Global:AdresaInHTML
# Břeclav
$Global:VarAdresaBreclavUlice = "Mládežnická 3062/3a"
$Global:VarAdresaBreclavMesto = "690 02 Břeclav"
$Global:VarAdresaBreclavStat = "Česká republika"
$Global:VarAdresaBreclav
# Jaroměř
$Global:VarAdresaJaromerUlice = "V Lužinách 113, Pražské Předměstí"
$Global:VarAdresaJaromerMesto = "551 01 Jaroměř"
$Global:VarAdresaJaromerStat = "Česká republika"
$Global:VarAdresaJaromer
# Třebíč
$Global:arAdresaTrebicUlice = "Žďárského 184"
$Global:VarAdresaTrebicvMesto = "674 01 Kožichovice"
$Global:VarAdresaTrebicvStat = "Česká republika"
$Global:VarAdresaTrebic
# Myjava
$Global:VarAdresaMyjavaUlice = "Prostredná 1227/9"
$Global:VarAdresaMyjavavMesto = "907 01 Myjava"
$Global:VarAdresaMyjavaStat = "Slovenská republika"
$Global:VarAdresaMyjava
# Rožnov
$Global:VarAdresaRoznovUlice = "Televizní 2614"
$Global:VarAdresaRoznovMesto = "756 61 Rožnov pod Radhoštěm"
$Global:VarAdresaRoznovStat = "Česká republika"
$Global:VarAdresaRoznov
# Právní odstavce
#...........................................................................................................................................................................
# Český odstavec
$HTMLTextPravoS = #"
Tato zpráva má pouze informativní charakter. Obsah této zprávy obchodní společnost GUMOTEX, akciová společnost, ani žádnou jinou osobu, která s ní tvoří koncern (dále jen "GUMOTEX"), nezavazuje. GUMOTEX nemá v úmyslu touto zprávou jakoukoliv smlouvu uzavřít, přijmout nabídku nebo uzavření jakékoliv smlouvy potvrdit a zpráva ani nezakládá jeho předsmluvní odpovědnost. Kterákoliv smlouva pro GUMOTEX závazná musí mít výhradně tištěnou písemnou formu, náležitosti dle příslušných právních předpisů a musí být podepsána osobou, která je za GUMOTEX oprávněna jednat nebo GUMOTEX zastupovat. Tato zpráva může obsahovat důvěrné informace. Pokud nejste jejím určeným příjemcem, jakékoliv její zveřejnění, kopírování, rozesílání nebo jiné užití jejího obsahu je přísně zakázáno. Nejste-li určeným příjemcem zprávy, informujte v takovém případě prosím ihned jejího odesílatele a poté zprávu, včetně případných příloh, bezodkladně z Vašeho zařízení smažte.
"#
# Anglický odstavec
$HTMLTextPravoENS =
#"
This e-mail message is intended only for informational purposes. The content of this message is not binding for neither the company GUMOTEX, akciová společnost, nor any other entity forming the GUMOTEX Group (hereinafter „GUMOTEX“). GUMOTEX does not intend to conclude any agreements, to accept any offers or to confirm the conclusion of any contracts via this message. This message shall not give rise to GUMOTEX precontractual liability. Any agreement binding GUMOTEX shall be in a written form and printed, shall comply with all statutory requirements and shall be signed by a person authorized to act on behalf of or for GUMOTEX. This e-mail message may contain confidential information. If you are not the intended recipient of this message, any disclosure, copying, distribution or use of its contents is strictly prohibited. Please notify the sender immediately and delete the message (including any attachments) from your system.
"#
#...........................................................................................................................................................................
#-------------------------------------------------------------#
#----HTML-----------------------------------------------------#
#-------------------------------------------------------------#
$HTML = #"
<!DOCTYPE html>
<html lang="cs">
<head>
<title>Mail signature</title>
<meta charset="Windows-1250">
<style>
a {
text-decoration: none;
color: #000000;
}
a:hover {
color: #20549A;
}
a:active {
color: #20549A;
</style>
</head>
<body>
<table>
<tr>
<td style="font-family: arial; font-weight: bold; color: #000000; font-size: 16px;">$($TitulPred.Text+$Jmeno.Text+" "+$Prijmeni.Text + $TitulZa.Text)</td>
</tr>
<td style="font-family: arial;font-size: 1px;"> </td>
</tr>
<tr>
<td style="font-family: arial; color: #434442; font-size: 14px;">$($Funkce.Text)</td>
</tr>
$Global:ZavodHTML
<tr>
<td style="font-family: arial; color: #20549A; font-weight: bold; font-size: 14px;">$(($Divize.SelectedItem.Content))</td>
</tr>
</tr>
<td style="font-family: arial;font-size: 10px;"> </td>
</tr>
<tr>
<td><img src="logo_gumotex.png" alt="GUMOTEX"></td>
</tr>
<td style="font-family: arial;font-size: 8px;"> </td>
</tr>
</tr>
</table>
<table>
<tr>
<td><img src="icon_envelope_2.png" alt="Email"></td>
<td style="vertical-align: middle;font-family: arial; color: #000000; font-size: 12px;"> $($Email.Text)</td>
</tr>
<!-- Zde bude promenna pro logiku telefonniho a mobilniho cisla -->
<tr>
<td><img src="icon_phone_2.png" alt="$AliasS"></td>
<td style="vertical-align: middle;font-family: arial; color: #000000; font-size: 12px;"> +$FullTelefonS | +$MobilS</td>
</tr>
</table>
$Global:AdresaInHTML
<table>
<tr>
<td><img src="icon_web_2.png" alt="Web"></td>
<td><img src="icon_fb_2.png" alt="Facebook"></td>
<td><img src="icon_ln_2.png" alt="Linkedin"></td>
<td><img src="icon_yt_2.png" alt="YouTube"></td>
</tr>
</table>
<span style="font-family: arial; color: #8f8f8f; font-size: 9px;">
<table>
</tr>
<td style="font-family: arial;font-size: 4px;"> </td>
</tr>
</table>
$TextPravoS
<table>
</tr>
<td style="font-family: arial;font-size: 4px;"> </td>
</tr>
</table>
$TextPravoENS
<table>
</tr>
<td style="font-family: arial;font-size: 1px;"> </td>
</tr>
</table>
</span>
</body>
</html>
"#
#-------------------------------------------------------------#
#----Control Event Handlers-----------------------------------#
#-------------------------------------------------------------#
#Write your code here
$Window = [Windows.Markup.XamlReader]::Parse($Xaml)
[xml]$xml = $Xaml
$xml.SelectNodes("//*[#Name]") | ForEach-Object { Set-Variable -Name $_.Name -Value $Window.FindName($_.Name) }
#-------------------------------------------------------------#
#----Functions------------------------------------------------#
#-------------------------------------------------------------#
# Formátuje Mobil/Pevnou linku z formátu +420XXXXXXXXX na +420 XXX XXX XXX
<#
Function Format-Contact {
param (
[String]$FormatPevnaLinka,
[String]$FormatMobil
)
if (![String]::IsNullOrWhitespace($PevnaLinka.Text)) {
$HTMLFullTelefonS = $FormatPevnaLinka.Insert(4," ").Insert(8," ").Insert(12," ")
}
if (![String]::IsNullOrWhitespace($Mobil.Text)) {
$HTMLMobilS = $FormatMobil.Insert(4," ").Insert(8," ").Insert(12," ")
}
}
#>
function CreateFolder_forSignature {
$FolderName = $Jmeno.Text +"_"+ $Prijmeni.Text
If(!(Test-path -path "\\gtxdc1.gumotex.cz\Skupiny\posta podpisy\$FolderName"))
{
New-Item -ItemType Directory -Force -Path "\\gtxdc1.gumotex.cz\Skupiny\Posta podpisy\" -Name $FolderName
}
else {
[System.Windows.MessageBox]::Show("Složka $FolderName na síťovém disku:\\gtxdc1\skupiny\posta podpisy\ již existuje, pokud chcete vytvořit znovu tuto složku prosím smažte/přejmenujte/přesuňte stávající složku.")
}
}
function CopyImages_ToNewFolder {
$FolderName = $Jmeno.Text +"_"+ $Prijmeni.Text
Copy-Item -Path "\\gtxdc1\skupiny\posta podpisy\Obrazky\*" -Destination "\\gtxdc1\skupiny\posta podpisy\$FolderName" -Recurse
}
# Functions
# Funkce pro logiku Zavodu
function CreateZavod_toHTML {
<#if ($Zavod.SelectedItem.Content -eq "PRÁZDNÉ")
{
$Global:ZavodHTML = $null
}
else {#>
$Global:ZavodHTML = #"
<tr>
<td style="font-family: arial; color: #20549A; font-weight: bold; font-size: 14px;">$($Zavod.SelectedItem.Content)</td>
</tr>
"#
}
# Funkce pro logiku Adresy
function CreateAddress_ToHTML {
$VarUlice
$VarMesto
$VarStat
switch ($Adresa.SelectedItem.Content) {
"BŘECLAV" {
$VarUlice = $Global:VarAdresaBreclavUlice
$VarMesto = $Global:VarAdresaBreclavMesto
$VarStat = $Global:VarAdresaBreclavStat
}
"TŘEBÍČ" {
$VarUlice = $Global:VarAdresaTrebicUlice
$VarMesto = $Global:VarAdresaTrebicvMesto
$VarStat = $Global:VarAdresaTrebicvStat
}
"JAROMĚŘ" {
$VarUlice = $Global:VarAdresaJaromerUlice
$VarMesto = $Global:VarAdresaJaromerMesto
$VarStat = $Global:VarAdresaJaromerStat
}
"MYJAVA" {
$VarUlice = $Global:VarAdresaMyjavaUlice
$VarMesto = $Global:VarAdresaMyjavavMesto
$VarStat = $Global:VarAdresaMyjavaStat
}
"ROŽNOV" {
$VarUlice = $Global:VarAdresaRoznovUlice
$VarMesto = $Global:VarAdresaRoznovMesto
$VarStat = $Global:VarAdresaRoznovStaT
}
}
$Global:AdresaInHTML = #"
<table>
</tr>
<td style="font-family: arial;font-size: 4px;"> </td>
</tr>
<tr>
<td style="font-family: arial; color: #717270; font-size: 11px;">$VarUlice</td>
</tr>
<tr>
<td style="font-family: arial; color: #717270; font-size: 11px;">$VarMesto</td>
</tr>
<tr>
<td style="font-family: arial; color: #717270; font-size: 11px;">$VarStat</td>
</tr>
</tr>
<td style="font-family: arial;font-size: 10px;"> </td>
</tr>
</table>
"#
}
function CreateHTMLSignature {
$FolderName = $Jmeno.Text +"_"+ $Prijmeni.Text
$FileName = $Jmeno.Text +"_"+ $Prijmeni.Text + ".html"
New-Item -ItemType File -Path "\\gtxdc1\Skupiny\Posta podpisy\$FolderName\" -Name $FileName
Set-Content -Path "\\gtxdc1\Skupiny\Posta podpisy\$FolderName\$FileName" -Value $HTML
}
$ZavritButton.Add_Click({
$Window.Close()
})
$VytvorPodpisButton.Add_Click({
CreateFolder_forSignature
CopyImages_ToNewFolder
CreateAddress_ToHTML
CreateZavod_toHTML
CreateHTMLSignature
$Window.Close()
})
#endregion
#-------------------------------------------------------------#
#----Script Execution-----------------------------------------#
#-------------------------------------------------------------#
#Format-Contact -FormatPevnaLinka $PevnaLinka.Text -FormatMobil $Mobil.Text
$Window.ShowDialog()
solution founded: At beginning of script i put this line of code:Remove-Variable * -ErrorAction SilentlyContinue Which is solved the issue
Hello I am using windows presentation foundation and I fail to load the layout that I save but it doesnt load. I use the XmlLayoutSerializer class and the
Deserialize to load the corresponding xml fle. I assume that something is wrong with the xml file. Could you please have a look at it and check if something s wrong?
<?xml version="1.0" encoding="utf-8"?>
<LayoutRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RootPanel Orientation="Horizontal">
<LayoutAnchorablePane DockWidth="400">
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Selection" IsSelected="True" ContentId="Cont1" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Settings" ContentId="Cont2" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Security settings" ContentId="Cont3" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Log" ContentId="Cont4" CanClose="False" />
</LayoutAnchorablePane>
<LayoutDocumentPane>
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Project" IsSelected="True" IsLastFocusedDocument="True" ContentId="Cont5" CanClose="False" LastActivationTimeStamp="05/22/2015 14:35:39" />
<LayoutDocument Title="Layout" ContentId="Cont6" CanClose="False" />
<LayoutDocument Title="Sequences" ContentId="Cont10" CanClose="False" />
<LayoutDocument Title="Locations" ContentId="Cont11" CanClose="False" />
<LayoutDocument Title="Search" ContentId="Cont12" CanClose="False" />
<LayoutDocument Title="Task generator" ContentId="Cont13" CanClose="False" />
<LayoutDocument Title="Task manager" ContentId="Cont14" CanClose="False" />
<LayoutDocument Title="Layout validator" ContentId="Cont15" CanClose="False" />
<LayoutDocument Title="Variables" ContentId="Cont16" CanClose="False" />
</LayoutDocumentPane>
<LayoutAnchorablePane DockWidth="230">
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Delta & selection tool" IsSelected="True" ContentId="Cont7" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Animations" ContentId="Cont8" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Groups" ContentId="Cont9" CanClose="False" />
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Zones" ContentId="Cont10" CanClose="False" />
</LayoutAnchorablePane>
</RootPanel>
<TopSide />
<RightSide />
<LeftSide />
<BottomSide />
<FloatingWindows />
<Hidden />
</LayoutRoot>
This is the code that I use to save and load the layout (check the comments //saving layout and //loading layout).
private void RestoreWindow()
{
try
{
if (Properties.Settings.Default.WindowHeight == 0 || Properties.Settings.Default.WindowWidth == 0)
{
return;
}
}
catch(Exception e)
{
Debugger.Break();
throw;
}
Height = Properties.Settings.Default.WindowHeight;
Width = Properties.Settings.Default.WindowWidth;
Left = Properties.Settings.Default.WindowLeft;
Top = Properties.Settings.Default.WindowTop;
WindowState = (WindowState)Properties.Settings.Default.WindowState;
// loading the layout
using (var reader = new StreamReader("layoutfile.xml"))
{
XmlLayoutSerializer layoutSerializer = new XmlLayoutSerializer(DockManager);
layoutSerializer.Deserialize(reader);
}
}
private void SaveWindow()
{
Properties.Settings.Default.WindowWidth = Width;
Properties.Settings.Default.WindowHeight = Height;
Properties.Settings.Default.WindowLeft = Left;
Properties.Settings.Default.WindowTop = Top;
Properties.Settings.Default.WindowState = (int)WindowState;
// ensure that your settings are written to the disk
Properties.Settings.Default.Save();
// saving the layout
using (var writer = new StreamWriter("layoutfile.xml"))
{
XmlLayoutSerializer layoutSerializer = new XmlLayoutSerializer(DockManager);
layoutSerializer.Serialize(writer);
}
}
I am new to windows phone.My problem is the following:
I have a grid of items which are buttons. I want to implement drag and swap feature for the buttons.How to do this in WP7 platform.
Here is the solution! xaml looks like this
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<toolkit:WrapPanel Height="510" HorizontalAlignment="Left" Margin="18,56,0,0" Name="wrapPanel1" VerticalAlignment="Top" Width="411">
<Button Content="1" Height="124" Name="button2" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="2" Height="124" Name="button3" Width="134" >
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="3" Height="124" Name="button4" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="4" Height="124" Name="button5" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="5" Height="124" Name="button6" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="6" Height="124" Name="button7" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="7" Height="124" Name="button8" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="8" Height="124" Name="button9" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="9" Height="124" Name="button10" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="10" Height="124" Name="button11" MouseLeftButtonDown="mouseDown" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="11" Height="124" Name="button12" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
<Button Content="12" Height="124" Name="button13" Width="134">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta" DragStarted="GestureListener_DragStarted" DragCompleted="GestureListener_DragCompleted" />
</toolkit:GestureService.GestureListener>
</Button>
</toolkit:WrapPanel>
</Grid>
Now the code behind C#
TranslateTransform translateTransform;
PointCollection points = new System.Windows.Media.PointCollection();
Button firstObject;
private void GestureListener_DragStarted(object sender, DragStartedGestureEventArgs e)
{
translateTransform = new TranslateTransform();
firstObject = sender as Button;
var transform1 = firstObject.TransformToVisual(wrapPanel1);
Point absolutePosition1 = transform1.Transform(new Point(0, 0));
}
private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e)
{
var moveablebutton = sender as Button;
moveablebutton.RenderTransform = translateTransform;
translateTransform.X += e.HorizontalChange;
translateTransform.Y += e.VerticalChange;
}
private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
{
var lastObject = sender as Button;
Button b=new Button();
int count = wrapPanel1.Children.Count;
int index = wrapPanel1.Children.IndexOf(lastObject);
var transform2 = lastObject.TransformToVisual(wrapPanel1);
Point absolutePositon2 = transform2.Transform(new Point(0, 0));
Point P1;
Point P2 ;
Point P3 ;
Point P4 ;
P1 = e.GetPosition(wrapPanel1);
P2 = new Point(P1.X+134, P1.Y+124);
Button swapitem=null;
foreach (UIElement ctrl in wrapPanel1.Children)
{
int index2;
var transform3 = ctrl.TransformToVisual(wrapPanel1);
Point comparePos = transform3.Transform(new Point(0, 0));
swapitem = ctrl as Button;
index2 = wrapPanel1.Children.IndexOf(swapitem);
if (index != index2)
{
P3 = new Point(comparePos.X, comparePos.Y);
P4 = new Point(comparePos.X + 158, comparePos.Y+170);
if (!(P2.Y < P3.Y || P1.Y > P4.Y || P2.X < P3.X || P1.X > P4.X))
{
swapitem = ctrl as Button;
index2 = wrapPanel1.Children.IndexOf(swapitem);
b = lastObject as Button;
b.RenderTransform = translateTransform;
translateTransform.X -= e.HorizontalChange;
translateTransform.Y -= e.VerticalChange;
wrapPanel1.Children.Remove(lastObject);
wrapPanel1.Children.Remove(swapitem);
// wrapPanel1.Children.RemoveAt(index2);
if (index < index2)
{
wrapPanel1.Children.Insert(index, swapitem);
wrapPanel1.Children.Insert(index2, b);
}
else
{
wrapPanel1.Children.Insert(index2, b);
wrapPanel1.Children.Insert(index, swapitem);
}
break;
}}
}
}
Ok so I am slowly making headway on my project but I am recieving the follwoing error message:
"An SqlParameter with ParameterName 'Name' is not contained by this SqlParameterCollection."
The error points to the following statement in my vb code: e.Command.Parameters("Name").Value = NewName.Text
Could someone take a look at my code and help me with what I might b doing wrong.
Here is my vb code:
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Private Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles Laboratory.RowCommand
' Insert data if the CommandName == "Insert"
' and the validation controls indicate valid data...
If e.CommandName = "Insert" AndAlso Page.IsValid Then
' Insert new record...
SqlDataSource2.Insert()
End If
End Sub
Protected Sub SqlDataSource2_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource2.Inserting
' Programmatically reference Web controls in the inserting interface...
Dim NewName As TextBox = Laboratory.FooterRow.FindControl("txtName")
Dim NewAddress As TextBox = Laboratory.FooterRow.FindControl("txtAddress")
Dim NewProvidence As TextBox = Laboratory.FooterRow.FindControl("txtProvidence")
Dim NewCity As TextBox = Laboratory.FooterRow.FindControl("txtCity")
Dim NewZipCode As TextBox = Laboratory.FooterRow.FindControl("txtZipCode")
Dim NewCountry As TextBox = Laboratory.FooterRow.FindControl("txtcountry")
Dim NewPhone As TextBox = Laboratory.FooterRow.FindControl("txtPhone")
Dim NewFax As TextBox = Laboratory.FooterRow.FindControl("txtFax")
Dim NewEmail As TextBox = Laboratory.FooterRow.FindControl("txtEmail")
' Set the ObjectDataSource's InsertParameters values...
' THIS IS WHERE I THINK I AM HAVING MY PROBLEM...
e.Command.Parameters("Name").Value = NewName.Text
e.Command.Parameters("Address").Value = NewAddress.Text
e.Command.Parameters("Providence").Value = NewProvidence.Text
e.Command.Parameters("City").Value = NewCity.Text
e.Command.Parameters("ZipCode").Value = NewZipCode.Text
e.Command.Parameters("Country").Value = NewCountry.Text
e.Command.Parameters("Phone").Value = NewPhone.Text
e.Command.Parameters("Fax").Value = NewFax.Text
e.Command.Parameters("Email").Value = NewEmail.Text
End Sub
And Here is my html.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<br />
<br />
<asp:GridView ID="Laboratory" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="LaboratoryID" DataSourceID="SqlDataSource2" ShowFooter="True">
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="AddRow" runat="server" CommandName="Insert" Text="Add" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtName" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address" SortExpression="Address">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Providence" SortExpression="Providence">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Providence") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtProvidence" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Providence") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" SortExpression="City">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtCity" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ZipCode" SortExpression="ZipCode">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("ZipCode") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtZipCode" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("ZipCode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country" SortExpression="Country">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Country") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtCountry" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone" SortExpression="Phone">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("Phone") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtPhone" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("Phone") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fax" SortExpression="Fax">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Fax") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtFax" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("Fax") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email" SortExpression="Email">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtEmail" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:GreatGrizzlyConnectionString1 %>" DeleteCommand="DELETE FROM [Laboratory] WHERE [LaboratoryID] = #LaboratoryID" InsertCommand="INSERT INTO [Laboratory] ([Name], [Address], [Providence], [City], [ZipCode], [Country], [Phone], [Fax], [Email]) VALUES (#Name, #Address, #Providence, #City, #ZipCode, #Country, #Phone, #Fax, #Email)" SelectCommand="SELECT * FROM [Laboratory]" UpdateCommand="UPDATE [Laboratory] SET [Name] = #Name, [Address] = #Address, [Providence] = #Providence, [City] = #City, [ZipCode] = #ZipCode, [Country] = #Country, [Phone] = #Phone, [Fax] = #Fax, [Email] = #Email WHERE [LaboratoryID] = #LaboratoryID">
<DeleteParameters>
<asp:Parameter Name="LaboratoryID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Address" Type="String" />
<asp:Parameter Name="Providence" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="ZipCode" Type="String" />
<asp:Parameter Name="Country" Type="String" />
<asp:Parameter Name="Phone" Type="String" />
<asp:Parameter Name="Fax" Type="String" />
<asp:Parameter Name="Email" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Address" Type="String" />
<asp:Parameter Name="Providence" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="ZipCode" Type="String" />
<asp:Parameter Name="Country" Type="String" />
<asp:Parameter Name="Phone" Type="String" />
<asp:Parameter Name="Fax" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="LaboratoryID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>
You need to create your parameters, there are lots of variations possible but here is a simple one
Dim Name As New SqlParameter("#Name", SqlDbType.nvarchar(50))
Name.Value = txtName.text
e.Command.Parameters.Add(Name)
You would need to do this for each parameter.
If the parameter already exists then you dont need to create it! You would just use the following. All I added was the "#" to your original code.
e.Command.Parameters("#Name").Value = NewName.Text
(It has been a while since I worked on this stuff.)
I have indexed Image, like these:
<s:Image id="imgListaTaskAnalysis0" left="20" top="110" width="200" height="200"/>
<s:Image id="imgListaTaskAnalysis1" left="20" top="360" width="200" height="200"/>
<s:Image id="imgListaTaskAnalysis2" left="20" top="360" width="200" height="200"/>
And so on..
I want to put them in an array, so:
public var arrayImg:Array = new Array(imgListaTaskAnalysis0,imgListaTaskAnalysis1,imgListaTaskAnalysis2);
But I can't give them a source:
for(var i:Number=0;i<=arrayImg.length;i++)
arrayImg[i].source = cuboImmagini.path;
In this way doesn't work, doesn't give them any source..There is a way to do this?
It is the interested part of my project:
public var arrayImg:Array = new Array(imgListaTaskAnalysis0,imgListaTaskAnalysis1);
/* DICHIARAZIONE IMMAGINI */
public var cuboImmagini:Object = {path:"../assets/cuboImmagini.png"};
public var exit:Object = {path:"../assets/exit.png"};
public var home:Object = {path:"../assets/home.png"};
/* FINE DICHIARAZIONE IMMAGINI */
/* FUNZIONI */
// cambiaPagina
public function cambiaPagina(prossimaPagina:String):void
{
currentState = prossimaPagina;
}
// chiudiApplicazione
protected function chiudiApplicazione(event:MouseEvent):void
{
NativeApplication.nativeApplication.exit();
}
public function carica():void
{
arrayImg[0].source = cuboImmagini.path;
arrayImg[1].source = home.path;
cambiaPagina("HomePage");
}
/* FINE FUNZIONI */
]]>
</fx:Script>
<s:states>
<s:State name="PaginaPresentazione"/>
<s:State name="HomePage"/>
<s:State name="ListaTaskAnalysis"/>
<s:State name="ScegliAzioneTaskAnalysis"/>
</s:states>
<fx:Declarations>
</fx:Declarations>
<!-- =================================== MXML =================================== -->
<!-- =================================== PaginaPresentazione =================================== -->
<s:Group id="gruppoPaginaPresentazione" includeIn="PaginaPresentazione" left="0" right="0" top="0" bottom="0"
horizontalCenter="0" verticalCenter="0">
<s:Button id="btnPresentazione" right="10" bottom="10" label="INIZIA"
click="carica()"/>
</s:Group>
<!-- =================================== HomePage =================================== -->
<s:Group id="gruppoHomePage" includeIn="HomePage,PaginaPresentazione" left="0" right="0" top="0"
bottom="0" horizontalCenter="0" verticalCenter="0">
<s:Button id="btnVaiTaskAnalysis" includeIn="HomePage" width="600" height="90"
label="TASK ANALYSIS" click="cambiaPagina('ListaTaskAnalysis')" fontSize="50"
horizontalCenter="0" verticalCenter="80"/>
<s:Button id="btnVaiStorieSociali" includeIn="HomePage" width="600" height="90"
label="STORIE SOCIALI" fontSize="50" horizontalCenter="0" verticalCenter="-80"/>
</s:Group>
<!-- =================================== /HomePage =================================== -->
<s:Group id="gruppoListaTaskAnalysis" includeIn="ListaTaskAnalysis" left="0" right="0" top="0" bottom="0"
horizontalCenter="0" verticalCenter="0">
<s:Group id="gruppoBottoniListaTaskAnalyis" left="0" right="0" top="0" height="90"
horizontalCenter="0">
<s:Button id="btnExitListaTaskAnalysis" right="10" top="5" width="80" height="80"
icon="assets/exit.png" click="chiudiApplicazione(event)"/>
<s:Button id="btnHomeListaTaskAnalysis" right="100" top="5" width="80" height="80"
icon="assets/home.png" click = "cambiaPagina('HomePage')"/>
</s:Group>
<s:Image id="imgListaTaskAnalysis0" left="20" top="110" width="200" height="200"
source="assets/cuboImmagini.png"/>
<s:Image id="imgListaTaskAnalysis1" left="20" top="360" width="200" height="200"/>
<s:Button id="btnSegreto1" left="10" bottom="10" width="90" height="90" alpha="0.1" click="combinazioneSegreta(1)"/>
<s:Button id="btnSegreto2" right="10" bottom="10" width="90" height="90" alpha="0.1" click="combinazioneSegreta(2)"/>
</s:Group>
<s:Group id="gruppoListaTaskAnalysis0" includeIn="ScegliAzioneTaskAnalysis" left="0" right="0"
top="0" bottom="0" horizontalCenter="0" verticalCenter="0">
<s:Group id="gruppoBottoniListaTaskAnalyis0" left="0" right="0" top="0" height="90"
horizontalCenter="0">
<s:Button id="btnExitScegliAzioneTaskAnalysis0" right="10" top="5" width="80" height="80"
icon="assets/exit.png" click="chiudiApplicazione(event)"/>
<s:Button id="btnHomeScegliAzioneTaskAnalisys" right="100" top="5" width="80" height="80"
icon="assets/home.png" click = "cambiaPagina('HomePage')"/>
</s:Group>
</s:Group>
<!-- =================================== /HomePage =================================== -->
Thanks in advance..
I solved the problem.. I put the images in the array when they are created:
<s:Image id="img" creationComplete = "loadImage(event,this.img,0) />
---------------------------------------------------------------------
public function loadImage(e:FlexEvent,img:Image,num:Number):void
{
array[num] = img;
}
Thanks anyway..