From: <dou...@us...> - 2011-11-21 20:30:09
|
Revision: 4338 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4338&view=rev Author: dougmckeen Date: 2011-11-21 20:29:56 +0000 (Mon, 21 Nov 2011) Log Message: ----------- Added Paths: ----------- trunk/plugins/CanadianWeather/ trunk/plugins/CanadianWeather/CanadianWeather.csproj trunk/plugins/CanadianWeather/CanadianWeather.csproj.user trunk/plugins/CanadianWeather/ConfigurationForm.Designer.cs trunk/plugins/CanadianWeather/ConfigurationForm.cs trunk/plugins/CanadianWeather/ConfigurationForm.resx trunk/plugins/CanadianWeather/GUICanadianWeather.cs trunk/plugins/CanadianWeather/Properties/ trunk/plugins/CanadianWeather/Properties/AssemblyInfo.cs trunk/plugins/CanadianWeather/Properties/DataSources/ trunk/plugins/CanadianWeather/Properties/DataSources/ConfigurationForm.datasource trunk/plugins/CanadianWeather/Properties/lf.png trunk/plugins/CanadianWeather/Properties/lf_disabled.png trunk/plugins/CanadianWeather/Resource1.Designer.cs trunk/plugins/CanadianWeather/Resource1.resx trunk/plugins/CanadianWeather/Resources/ trunk/plugins/CanadianWeather/Resources/lf.png trunk/plugins/CanadianWeather/Resources/lf_disabled.png Added: trunk/plugins/CanadianWeather/CanadianWeather.csproj =================================================================== --- trunk/plugins/CanadianWeather/CanadianWeather.csproj (rev 0) +++ trunk/plugins/CanadianWeather/CanadianWeather.csproj 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4065B871-27FA-4CCE-9ECC-D3722571B79D}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CanadianWeather</RootNamespace> + <AssemblyName>CanadianWeather</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <Win32Resource> + </Win32Resource> + </PropertyGroup> + <ItemGroup> + <Reference Include="Common.Utils"> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + </Reference> + <Reference Include="Core, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> + <Reference Include="Dialogs"> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="GUICanadianWeather.cs" /> + <Compile Include="ConfigurationForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="ConfigurationForm.Designer.cs"> + <DependentUpon>ConfigurationForm.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Resource1.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resource1.resx</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="ConfigurationForm.resx"> + <DependentUpon>ConfigurationForm.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Resource1.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resource1.Designer.cs</LastGenOutput> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Resources\lf.png" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Resources\lf_disabled.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Properties\DataSources\ConfigurationForm.datasource" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: trunk/plugins/CanadianWeather/CanadianWeather.csproj.user =================================================================== --- trunk/plugins/CanadianWeather/CanadianWeather.csproj.user (rev 0) +++ trunk/plugins/CanadianWeather/CanadianWeather.csproj.user 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +</Project> \ No newline at end of file Added: trunk/plugins/CanadianWeather/ConfigurationForm.Designer.cs =================================================================== --- trunk/plugins/CanadianWeather/ConfigurationForm.Designer.cs (rev 0) +++ trunk/plugins/CanadianWeather/ConfigurationForm.Designer.cs 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,451 @@ +namespace MediaPortal.GUI.CanadianWeather +{ + partial class ConfigurationForm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.RadioButtonEnglish = new System.Windows.Forms.RadioButton(); + this.RadioButtonFrench = new System.Windows.Forms.RadioButton(); + this.LanguageChoice = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.RefreshIntervalTxtBx = new System.Windows.Forms.TextBox(); + this.PluginNameTextBox = new System.Windows.Forms.Label(); + this.PluginNameTxtBx = new System.Windows.Forms.TextBox(); + this.OKButton = new System.Windows.Forms.Button(); + this.Cancel = new System.Windows.Forms.Button(); + this.Locations = new System.Windows.Forms.ListBox(); + this.MoveUp = new System.Windows.Forms.Button(); + this.MoveDown = new System.Windows.Forms.Button(); + this.Delete = new System.Windows.Forms.Button(); + this.Add = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.listBoxProvince = new System.Windows.Forms.ListBox(); + this.listBoxCity = new System.Windows.Forms.ListBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.ImageURL0 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.ImageURL1 = new System.Windows.Forms.TextBox(); + this.ImageURL2 = new System.Windows.Forms.TextBox(); + this.ImageURL3 = new System.Windows.Forms.TextBox(); + this.ImageURL4 = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.configurationFormBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.LanguageChoice.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.configurationFormBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // RadioButtonEnglish + // + this.RadioButtonEnglish.AutoSize = true; + this.RadioButtonEnglish.Checked = true; + this.RadioButtonEnglish.Enabled = false; + this.RadioButtonEnglish.Location = new System.Drawing.Point(6, 19); + this.RadioButtonEnglish.Name = "RadioButtonEnglish"; + this.RadioButtonEnglish.Size = new System.Drawing.Size(59, 17); + this.RadioButtonEnglish.TabIndex = 5; + this.RadioButtonEnglish.TabStop = true; + this.RadioButtonEnglish.Text = "English"; + this.RadioButtonEnglish.UseVisualStyleBackColor = true; + // + // RadioButtonFrench + // + this.RadioButtonFrench.AutoSize = true; + this.RadioButtonFrench.Enabled = false; + this.RadioButtonFrench.Location = new System.Drawing.Point(6, 40); + this.RadioButtonFrench.Name = "RadioButtonFrench"; + this.RadioButtonFrench.Size = new System.Drawing.Size(58, 17); + this.RadioButtonFrench.TabIndex = 6; + this.RadioButtonFrench.Text = "French"; + this.RadioButtonFrench.UseVisualStyleBackColor = true; + // + // LanguageChoice + // + this.LanguageChoice.Controls.Add(this.RadioButtonEnglish); + this.LanguageChoice.Controls.Add(this.RadioButtonFrench); + this.LanguageChoice.Enabled = false; + this.LanguageChoice.Location = new System.Drawing.Point(341, 1); + this.LanguageChoice.Name = "LanguageChoice"; + this.LanguageChoice.Size = new System.Drawing.Size(79, 66); + this.LanguageChoice.TabIndex = 8; + this.LanguageChoice.TabStop = false; + this.LanguageChoice.Text = "Language"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(14, 37); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(82, 26); + this.label1.TabIndex = 9; + this.label1.Text = "Refresh Interval\r\n(minutes)"; + // + // RefreshIntervalTxtBx + // + this.RefreshIntervalTxtBx.Location = new System.Drawing.Point(102, 45); + this.RefreshIntervalTxtBx.Name = "RefreshIntervalTxtBx"; + this.RefreshIntervalTxtBx.Size = new System.Drawing.Size(135, 20); + this.RefreshIntervalTxtBx.TabIndex = 10; + // + // PluginNameTextBox + // + this.PluginNameTextBox.AutoSize = true; + this.PluginNameTextBox.Location = new System.Drawing.Point(14, 11); + this.PluginNameTextBox.Name = "PluginNameTextBox"; + this.PluginNameTextBox.Size = new System.Drawing.Size(67, 13); + this.PluginNameTextBox.TabIndex = 9; + this.PluginNameTextBox.Text = "Plugin Name"; + // + // PluginNameTxtBx + // + this.PluginNameTxtBx.Location = new System.Drawing.Point(102, 11); + this.PluginNameTxtBx.MaxLength = 127; + this.PluginNameTxtBx.Name = "PluginNameTxtBx"; + this.PluginNameTxtBx.Size = new System.Drawing.Size(135, 20); + this.PluginNameTxtBx.TabIndex = 10; + // + // OKButton + // + this.OKButton.Location = new System.Drawing.Point(345, 491); + this.OKButton.Name = "OKButton"; + this.OKButton.Size = new System.Drawing.Size(75, 23); + this.OKButton.TabIndex = 12; + this.OKButton.Text = "OK"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OK_Click); + // + // Cancel + // + this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Cancel.Location = new System.Drawing.Point(426, 491); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 13; + this.Cancel.Text = "Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.Click += new System.EventHandler(this.Cancel_Click); + // + // Locations + // + this.Locations.FormattingEnabled = true; + this.Locations.HorizontalScrollbar = true; + this.Locations.Location = new System.Drawing.Point(335, 62); + this.Locations.Name = "Locations"; + this.Locations.Size = new System.Drawing.Size(160, 173); + this.Locations.TabIndex = 0; + // + // MoveUp + // + this.MoveUp.Location = new System.Drawing.Point(254, 127); + this.MoveUp.Name = "MoveUp"; + this.MoveUp.Size = new System.Drawing.Size(75, 23); + this.MoveUp.TabIndex = 1; + this.MoveUp.Text = "Move Up"; + this.MoveUp.UseVisualStyleBackColor = true; + this.MoveUp.Click += new System.EventHandler(this.MoveUp_Click); + // + // MoveDown + // + this.MoveDown.Location = new System.Drawing.Point(254, 156); + this.MoveDown.Name = "MoveDown"; + this.MoveDown.Size = new System.Drawing.Size(75, 23); + this.MoveDown.TabIndex = 2; + this.MoveDown.Text = "Move Down"; + this.MoveDown.UseVisualStyleBackColor = true; + this.MoveDown.Click += new System.EventHandler(this.MoveDown_Click); + // + // Delete + // + this.Delete.Location = new System.Drawing.Point(254, 212); + this.Delete.Name = "Delete"; + this.Delete.Size = new System.Drawing.Size(75, 23); + this.Delete.TabIndex = 3; + this.Delete.Text = "Delete"; + this.Delete.UseVisualStyleBackColor = true; + this.Delete.Click += new System.EventHandler(this.Delete_Click); + // + // Add + // + this.Add.Location = new System.Drawing.Point(254, 67); + this.Add.Name = "Add"; + this.Add.Size = new System.Drawing.Size(75, 23); + this.Add.TabIndex = 4; + this.Add.Text = "Add"; + this.Add.UseVisualStyleBackColor = true; + this.Add.Click += new System.EventHandler(this.Add_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(8, 16); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(215, 13); + this.label6.TabIndex = 9; + this.label6.Text = "Select a Province then a City and press Add"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(335, 40); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 13); + this.label2.TabIndex = 11; + this.label2.Text = "Locations"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(17, 40); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(49, 13); + this.label4.TabIndex = 16; + this.label4.Text = "Province"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(17, 129); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(24, 13); + this.label5.TabIndex = 16; + this.label5.Text = "City"; + // + // listBoxProvince + // + this.listBoxProvince.FormattingEnabled = true; + this.listBoxProvince.Location = new System.Drawing.Point(96, 39); + this.listBoxProvince.Name = "listBoxProvince"; + this.listBoxProvince.Size = new System.Drawing.Size(76, 82); + this.listBoxProvince.TabIndex = 17; + this.listBoxProvince.SelectedIndexChanged += new System.EventHandler(this.listBoxProvince_SelectedIndexChanged); + // + // listBoxCity + // + this.listBoxCity.FormattingEnabled = true; + this.listBoxCity.HorizontalScrollbar = true; + this.listBoxCity.Location = new System.Drawing.Point(46, 127); + this.listBoxCity.Name = "listBoxCity"; + this.listBoxCity.Size = new System.Drawing.Size(185, 108); + this.listBoxCity.TabIndex = 18; + this.listBoxCity.SelectedIndexChanged += new System.EventHandler(this.listBoxCity_SelectedIndexChanged); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.listBoxCity); + this.groupBox1.Controls.Add(this.listBoxProvince); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label6); + this.groupBox1.Controls.Add(this.Add); + this.groupBox1.Controls.Add(this.Delete); + this.groupBox1.Controls.Add(this.MoveDown); + this.groupBox1.Controls.Add(this.MoveUp); + this.groupBox1.Controls.Add(this.Locations); + this.groupBox1.Location = new System.Drawing.Point(6, 72); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(509, 254); + this.groupBox1.TabIndex = 19; + this.groupBox1.TabStop = false; + // + // ImageURL0 + // + this.ImageURL0.Location = new System.Drawing.Point(65, 363); + this.ImageURL0.Name = "ImageURL0"; + this.ImageURL0.Size = new System.Drawing.Size(436, 20); + this.ImageURL0.TabIndex = 20; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(14, 366); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(45, 13); + this.label3.TabIndex = 21; + this.label3.Text = "Image 1"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(14, 389); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(45, 13); + this.label7.TabIndex = 21; + this.label7.Text = "Image 2"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(14, 412); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(45, 13); + this.label8.TabIndex = 21; + this.label8.Text = "Image 3"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(14, 435); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(45, 13); + this.label9.TabIndex = 21; + this.label9.Text = "Image 4"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(14, 457); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(45, 13); + this.label10.TabIndex = 21; + this.label10.Text = "Image 5"; + // + // ImageURL1 + // + this.ImageURL1.Location = new System.Drawing.Point(65, 386); + this.ImageURL1.Name = "ImageURL1"; + this.ImageURL1.Size = new System.Drawing.Size(436, 20); + this.ImageURL1.TabIndex = 20; + // + // ImageURL2 + // + this.ImageURL2.Location = new System.Drawing.Point(65, 409); + this.ImageURL2.Name = "ImageURL2"; + this.ImageURL2.Size = new System.Drawing.Size(436, 20); + this.ImageURL2.TabIndex = 20; + // + // ImageURL3 + // + this.ImageURL3.Location = new System.Drawing.Point(65, 432); + this.ImageURL3.Name = "ImageURL3"; + this.ImageURL3.Size = new System.Drawing.Size(436, 20); + this.ImageURL3.TabIndex = 20; + // + // ImageURL4 + // + this.ImageURL4.Location = new System.Drawing.Point(65, 454); + this.ImageURL4.Name = "ImageURL4"; + this.ImageURL4.Size = new System.Drawing.Size(436, 20); + this.ImageURL4.TabIndex = 20; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(14, 338); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(319, 13); + this.label12.TabIndex = 21; + this.label12.Text = "Enter Image URLs below. e.g. http://www.sample.com/image.jpg"; + // + // configurationFormBindingSource + // + this.configurationFormBindingSource.DataSource = typeof(MediaPortal.GUI.CanadianWeather.ConfigurationForm); + // + // ConfigurationForm + // + this.AcceptButton = this.OKButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(522, 532); + this.Controls.Add(this.label12); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label3); + this.Controls.Add(this.ImageURL4); + this.Controls.Add(this.ImageURL3); + this.Controls.Add(this.ImageURL2); + this.Controls.Add(this.ImageURL1); + this.Controls.Add(this.ImageURL0); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.Cancel); + this.Controls.Add(this.OKButton); + this.Controls.Add(this.PluginNameTxtBx); + this.Controls.Add(this.RefreshIntervalTxtBx); + this.Controls.Add(this.PluginNameTextBox); + this.Controls.Add(this.label1); + this.Controls.Add(this.LanguageChoice); + this.Name = "ConfigurationForm"; + this.Text = "Canadian Weather Configuration"; + this.Load += new System.EventHandler(this.ConfigurationForm_Load); + this.LanguageChoice.ResumeLayout(false); + this.LanguageChoice.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.configurationFormBindingSource)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.RadioButton RadioButtonEnglish; + private System.Windows.Forms.RadioButton RadioButtonFrench; + private System.Windows.Forms.GroupBox LanguageChoice; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox RefreshIntervalTxtBx; + private System.Windows.Forms.Label PluginNameTextBox; + private System.Windows.Forms.TextBox PluginNameTxtBx; + private System.Windows.Forms.Button OKButton; + private System.Windows.Forms.Button Cancel; + private System.Windows.Forms.BindingSource configurationFormBindingSource; + private System.Windows.Forms.ListBox Locations; + private System.Windows.Forms.Button MoveUp; + private System.Windows.Forms.Button MoveDown; + private System.Windows.Forms.Button Delete; + private System.Windows.Forms.Button Add; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.ListBox listBoxProvince; + private System.Windows.Forms.ListBox listBoxCity; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox ImageURL0; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox ImageURL1; + private System.Windows.Forms.TextBox ImageURL2; + private System.Windows.Forms.TextBox ImageURL3; + private System.Windows.Forms.TextBox ImageURL4; + private System.Windows.Forms.Label label12; + } +} \ No newline at end of file Added: trunk/plugins/CanadianWeather/ConfigurationForm.cs =================================================================== --- trunk/plugins/CanadianWeather/ConfigurationForm.cs (rev 0) +++ trunk/plugins/CanadianWeather/ConfigurationForm.cs 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,354 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Xml.Linq; +using System.Text; +using System.Windows.Forms; +using System.Net; +using System.IO; +using MediaPortal.Configuration; + +namespace MediaPortal.GUI.CanadianWeather +{ + public partial class ConfigurationForm : Form + { + String strURL = "http://dd.weatheroffice.ec.gc.ca/citypage_weather/xml/siteList.xml"; + + List<string> _items = new List<string>(); + string PluginName; + int RefreshTime; + string Language; + string[,] Sites; + bool SiteLookupFailed; + int NumberofSites; + int siteIndex; + string[,] tempstring; + List<string> ShortListOfProvs; + List<string> CityNames; + XDocument loaded; + string[] ProvinceArray; + string[] CityArray; + string selectedProvince = ""; + string selectedCity = ""; + string Temp; + + public ConfigurationForm() + { + InitializeComponent(); + + // read settings file, fill in form + using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "CanadianWeatherSettings.xml"))) + { + PluginName = reader.GetValueAsString("BasicSettings", "PluginName", "Canadian Weather"); + RefreshTime = reader.GetValueAsInt("BasicSettings", "RefreshTime", 60); + Language = reader.GetValueAsString("BasicSettings", "Language", "English"); + + //create 2D array of sites (20 sites, 4 attributes) + Sites = new string[20, 4]; + for (int i = 0; i < 20; i++) + { + Sites[i, 0] = reader.GetValueAsString("Site" + i, "SiteID", ""); + Sites[i, 1] = reader.GetValueAsString("Site" + i, "EnglishName", ""); + Sites[i, 2] = reader.GetValueAsString("Site" + i, "FrenchName", ""); + Sites[i, 3] = reader.GetValueAsString("Site" + i, "ProvinceCode", ""); + } + + //Fill in Refresh Interval + RefreshIntervalTxtBx.Text = RefreshTime.ToString(); + + //Activate Language Radio Button + if (String.Equals(Language, "French")) + { RadioButtonFrench.Checked = true; } + else + { RadioButtonEnglish.Checked = true; } + + //Determine how many sites exist + NumberofSites = 0; + for (int i = 0; i < 20; i++) + { + if (string.IsNullOrEmpty(Sites[i, 0])) + { + NumberofSites = i; + break; + } + //null string not found so list is full + NumberofSites = 19; //(20 sites, counting from zero) + } + + //fill the list box + for (int i = 0; i < NumberofSites; i++) + { _items.Add(Sites[i, 1]); } + + Locations.DataSource = _items; + + //Fill in the Plugin Name + PluginNameTxtBx.Text = PluginName; + } + + //Get Site List from Environment Canada + GetSiteListFromEnvironmentCanada(); + } + + public Boolean GetSiteListFromEnvironmentCanada() + { + try + { + //get XML + String SiteList; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL); + request.Timeout = 20000; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + Stream responseStream = response.GetResponseStream(); + StreamReader htmlStream = new StreamReader(responseStream, Encoding.Default); + SiteList = htmlStream.ReadToEnd(); + //parse + loaded = XDocument.Parse(SiteList); + //int sitesCount = loaded.Descendants("site").Count(); + + //get a distinct list of the province codes from the XDocument + ShortListOfProvs = loaded.Descendants("provinceCode") + .Select(x => x.Value) + .Distinct() + .ToList(); + ShortListOfProvs.Sort(); + + //display the short list of provinces in the listbox + ProvinceArray = ShortListOfProvs.ToArray(); + listBoxProvince.Items.AddRange(ProvinceArray); + + //clean up + htmlStream.Dispose(); + responseStream.Dispose(); + + SiteLookupFailed = false; + return true; + } + catch (Exception) + { + //error retrieving list of sites + SiteLookupFailed = true; + MessageBox.Show("The list of Provinces and Cities could not be obtained from Environment Canada. You can perform all actions except Add. You can close the plugin Configuration and try again later."); + Add.Enabled.Equals(false); + return false; + } + } + + private void ConfigurationForm_Load(object sender, EventArgs e) + { + + } + + private void OK_Click(object sender, EventArgs e) + { + if (RadioButtonEnglish.Checked == true) + { Language = "English"; } + else + { Language = "French"; } + + //validate Refresh Interval + int tempInteger; + if (!int.TryParse(RefreshIntervalTxtBx.Text.ToString(), out tempInteger) || tempInteger < 0 || tempInteger > 1440) + { RefreshIntervalTxtBx.Text = "60"; } //input error, set as 60 + + //write XML file + using (MediaPortal.Profile.Settings writer = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "CanadianWeatherSettings.xml"))) + { + writer.SetValue("BasicSettings", "PluginName", PluginNameTxtBx.Text); + writer.SetValue("BasicSettings", "RefreshTime", RefreshIntervalTxtBx.Text); + writer.SetValue("BasicSettings", "Language", Language); + + for (int i = 0; i < 19; i++) + { + writer.SetValue("Site" + i, "SiteID", Sites[i, 0]); + writer.SetValue("Site" + i, "EnglishName", Sites[i, 1]); + writer.SetValue("Site" + i, "FrenchName", Sites[i, 2]); + writer.SetValue("Site" + i, "ProvinceCode", Sites[i, 3]); + } + + writer.SetValue("Images", "Image0", ImageURL0.Text); + writer.SetValue("Images", "Image1", ImageURL1.Text); + writer.SetValue("Images", "Image2", ImageURL2.Text); + writer.SetValue("Images", "Image3", ImageURL3.Text); + writer.SetValue("Images", "Image4", ImageURL4.Text); + + MediaPortal.Profile.Settings.SaveCache(); + } + + //close form + Close(); + Dispose(); + } + + private void Add_Click(object sender, EventArgs e) + { + if (NumberofSites == 19) + { + MessageBox.Show("The maximum number of locations allowed is 20. You will have to delete one before adding another."); + + } + else + { + //Add the site + if (SiteLookupFailed == true) + { + MessageBox.Show("The list of Provinces and Cities could not be obtained from Environment Canada. You can perform all actions except Add. You can close the plugin Configuration and try again later."); + Add.Enabled.Equals(false); + } + + if (selectedCity == "" || selectedProvince == "") + { + MessageBox.Show("Select a Province and City first"); + } + else + { + //update the Array + //determine French Name for Province and City selected, then fill the sitecode part of Sites array + Temp = loaded.Descendants("site") + .Where(x => x.Element("provinceCode").Value == selectedProvince) + .Where(x => x.Element("nameEn").Value == selectedCity) + .Select(x => x.Attribute("code").Value) + .SingleOrDefault() + .ToString(); + Sites[NumberofSites, 0] = Temp; + //fill the nameEn part of Sites array + Sites[NumberofSites, 1] = selectedCity; + //determine French Name for Province and City selected, then fill the nameFr part of Sites array + Temp = loaded.Descendants("site") + .Where(x => x.Element("provinceCode").Value == selectedProvince) + .Where(x => x.Element("nameEn").Value == selectedCity) + .Select(x => x.Element("nameFr").Value) + .SingleOrDefault() + .ToString(); + Sites[NumberofSites, 2] = Temp; + //fill the provinceCode part of Sites array + Sites[NumberofSites, 3] = selectedProvince; + + //update the Locations Listbox + _items.Add(selectedCity); + //Locations.SetSelected(NumberofSites, true); + Locations.DataSource = null; + Locations.DataSource = _items; + + NumberofSites++; + } + } + } + + private void Delete_Click(object sender, EventArgs e) + { + if (NumberofSites == 0) + { MessageBox.Show("There are no locations in the list."); } + else + { + //which site is in focus? + siteIndex = Locations.SelectedIndex; + //move the sites one place in the list and mark the last one's attributes as null + for (int i = siteIndex; i < NumberofSites; i++) + { + for (int j = 0; j < 4; j++) + { + Sites[i, j] = Sites[i + 1, j]; + } + } + for (int j = 0; j < 4; j++) + { + Sites[NumberofSites, j] = ""; + } + NumberofSites--; + + //update the ListBox + _items.RemoveAt(siteIndex); + Locations.SetSelected(Math.Max(siteIndex - 1, 0), true); //max prevents from evaluating <0 + Locations.DataSource = null; + Locations.DataSource = _items; + } + } + + private void MoveUp_Click(object sender, EventArgs e) + { + //check if already at the top + siteIndex = Locations.SelectedIndex; + if (siteIndex > 0) + { + //adjust string order + tempstring = new string[1, 4]; + for (int j = 0; j < 4; j++) + { + tempstring[0, j] = Sites[siteIndex, j]; + Sites[siteIndex, j] = Sites[siteIndex - 1, j]; + Sites[siteIndex - 1, j] = tempstring[0, j]; + } + //adjust ListBox order + _items.RemoveAt(siteIndex); + _items.Insert(siteIndex - 1, tempstring[0, 1]); + Locations.SetSelected(siteIndex - 1, true); + Locations.DataSource = null; + Locations.DataSource = _items; + } + } + + private void MoveDown_Click(object sender, EventArgs e) + { + //check if already at the bottom + siteIndex = Locations.SelectedIndex; + if (siteIndex < NumberofSites - 1) + { + //adjust string order + string[,] tempstring; + tempstring = new string[1, 4]; + for (int j = 0; j < 4; j++) + { + tempstring[0, j] = Sites[siteIndex, j]; + Sites[siteIndex, j] = Sites[siteIndex + 1, j]; + Sites[siteIndex + 1, j] = tempstring[0, j]; + } + //adjust ListBox order + _items.RemoveAt(siteIndex); + _items.Insert(siteIndex + 1, tempstring[0, 1]); + Locations.SetSelected(siteIndex + 1, true); + Locations.DataSource = null; + Locations.DataSource = _items; + } + } + + private void Cancel_Click(object sender, EventArgs e) + { + Close(); + Dispose(); + } + + private void listBoxProvince_SelectedIndexChanged(object sender, EventArgs e) + { + //Selected province to a string + selectedProvince = listBoxProvince.SelectedItem.ToString(); + + //make a list of the cities for the selected province + CityNames = loaded.Descendants("site") + .Where(x => x.Element("provinceCode").Value == selectedProvince) + .Select(x => x.Element("nameEn").Value) + .ToList(); + CityNames.Sort(); + + //if we already have a city list, clear it + if (listBoxCity.Items.Count > 0) + { + listBoxCity.Items.Clear(); + } + + //create the listbox + CityArray = CityNames.ToArray(); + listBoxCity.Items.AddRange(CityArray); + //clear the arry for use next time, if required + Array.Clear(CityArray, 0, CityArray.Length); + selectedCity = ""; + } + + private void listBoxCity_SelectedIndexChanged(object sender, EventArgs e) + { + selectedCity = listBoxCity.SelectedItem.ToString(); + } + + } + +} \ No newline at end of file Added: trunk/plugins/CanadianWeather/ConfigurationForm.resx =================================================================== --- trunk/plugins/CanadianWeather/ConfigurationForm.resx (rev 0) +++ trunk/plugins/CanadianWeather/ConfigurationForm.resx 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,123 @@ +<?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="Bitmap1" 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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" /> + <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" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </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" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </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> + <metadata name="configurationFormBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/CanadianWeather/GUICanadianWeather.cs =================================================================== --- trunk/plugins/CanadianWeather/GUICanadianWeather.cs (rev 0) +++ trunk/plugins/CanadianWeather/GUICanadianWeather.cs 2011-11-21 20:29:56 UTC (rev 4338) @@ -0,0 +1,1572 @@ +#region using + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Xml.Linq; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using System.IO; +using System.Xml; +using System.Net; +using MediaPortal.Configuration; +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using Action = MediaPortal.GUI.Library.Action; +using System.Threading; +using System.Globalization; +#endregion + +namespace MediaPortal.GUI.CanadianWeather +{ + [PluginIcons("CanadianWeather.Resources.lf.png", "CanadianWeather.Resources.lf_disabled.png")] + public class GUICanadianWeather : GUIInternalWindow, ISetupForm + { + [SkinControlAttribute(2)] protected GUIButtonControl SatelliteImageButton = null; + [SkinControlAttribute(3)] protected GUIButtonControl SevenDayForecastButton = null; + [SkinControlAttribute(4)] protected GUIButtonControl RefreshButton = null; + [SkinControlAttribute(5)] protected GUIButtonControl CityButton = null; + [SkinControlAttribute(6)] protected GUIButtonControl WeatherWarningButton = null; + + #region variables + + int tempint = 0; + string tempsavedlow = ""; + bool nightflag = false; + + + int RefreshTime; + string SelectedCity; + string LanguageChoice; + string Language; + string[,] Sites; + int NumberofSites; + string ForecastXML; + string URL; + private const int NUM_DAYS = 7; + private const char DEGREE_CHARACTER = (char)176; //the degree 'o' character + private DateTime _lastRefreshTime = DateTime.Now.AddHours(-1); //for autorefresh + string mode; + string lastmode; + private string _urlImage0 = string.Empty; + private string _urlImage1 = string.Empty; + private string _urlImage2 = string.Empty; + private string _urlImage3 = string.Empty; + private string _urlImage4 = string.Empty; + private string _urlViewImage = string.Empty; + private bool FirstTimeThruImageLoopIsCompleted; + private bool ContinueImageLoop; + + string currentLocation; + string LocalizedTimeStamp; + string ObservedYear; + string ObservedMonth; + string ObservedDay; + string ObservedHour; + string ObservedMinute; + int intObservedYear; + int intObservedMonth; + int intObservedDay; + int intObservedHour; + int intObservedMinute; + string ObservedTimeStamp; + string ObservedtextSummary; + string currentCondition; + string currentIconCode; + string currentTemperature; + string currentFeelsLike; + string currentWindChill; + string currentHumidex; + string currentDewpoint; + string currentPressure; + string currentPressuretendency; + string currentPressureAndTendency; + string currentVisibility; + string currentRelativeHumidity; + string currentWindspeed; + string currentWindgust; + string currentWinddirection; + string currentWindCombinedString; + string IssuedTimeStamp; + string SunriseTime; + string SunsetTime; + string WeatherWarningPriority; + string WeatherWarningType; + string WeatherWarningURL; + string WarningHTML; + int intIssuedYear; + int intIssuedMonth; + int intIssuedDay; + int intIssuedHour; + int intIssuedMinute; + int intSunriseYear; + int intSunriseMonth; + int intSunriseDay; + int intSunriseHour; + int intSunriseMinute; + int intSunsetYear; + int intSunsetMonth; + int intSunsetDay; + int intSunsetHour; + int intSunsetMinute; + + string strIcon = GUIGraphicsContext.Skin + @"\Media\CanadianWeather\na.png"; + string strBaseURL = "http://dd.weatheroffice.ec.gc.ca/citypage_weather/xml/"; + string strPressure = "Pressure"; + string strVisibility = "Visibility"; + string strSunrise = "Sunrise"; + string strSunset = "Sunset"; + string strForecastIssued = "Forecast Issued: "; + string strSevenDayForecast = "Text Forecast"; + string strCurrentConditions = "Current Conditions"; + string strNotObserved = "not observed"; + string strGust = " gust "; + string strWarning = "Warning - "; + string strHigh = "High"; + string strMed = "Med."; + string strLow = "Low"; + + public string[] Day = new string[NUM_DAYS]; + public string[] High = new string[NUM_DAYS]; + public string[] Low = new string[NUM_DAYS]; + public string[] IconCode = new string[NUM_DAYS]; + public string[] Pop = new string[NUM_DAYS]; + public string[] Overview = new string[NUM_DAYS]; + public string[] TextSummary = new string[NUM_DAYS]; + + private bool _workerCompleted = false; + private object _downloadLock = null; + private bool _workerActive = false; + private Images _images; + + bool SitesFound = false; + XDocument loaded; + string[] ProvinceArray; + string[] CityArray; + List<string> ShortListOfProvs; + List<string> CityNames; + String strURL = "http://dd.weatheroffice.ec.gc.ca/citypage_weather/xml/siteList.xml"; + String strChooseProv = "Select a Province"; + String strChooseCity = "Select a City"; + + #endregion + + #region enums + + private enum Controls + { + CONTROL_BTNSWITCH = 2, + CONTROL_BTNVIEW = 3, + CONTROL_BTNREFRESH = 4, + CONTROL_BTNLOCATIONSELECT = 5, + CONTROL_BTNWEATHERWARNING = 6, + + CONTROL_LABELLOCATION = 10, + CONTROL_FORECASTUPDATED = 11, + CONTROL_IMAGELOGO = 101, + CONTROL_LABELWEATHERWARNING = 16, + CONTROL_LABELSUNRISE = 19, + CONTROL_LABELSUNSET = 20, + CONTROL_IMAGENOWICON = 21, + CONTROL_LABELNOWCOND = 22, + CONTROL_LABELNOWTEMP = 23, + CONTROL_LABELNOWWIND = 24, + CONTROL_LABELNOWRELHUM = 25, + CONTROL_LABELNOWDEW = 26, + CONTROL_LABELNOWPRESSURE = 27, + CONTROL_LABELNOWVISIBILITY = 28, + CONTROL_LABELNOWFEELSLIKE = 29, + + CONTROL_STATICFEEL = 223, + CONTROL_STATICWIND = 224, + CONTROL_STATICRELHUMIDITY = 225, + CONTROL_STATICDEWPOINT = 226, + CONTROL_STATICPRESSURE = 227, + CONTROL_STATICVISIBILIY = 228, + CONTROL_STATICSUNRISE = 229, + CONTROL_STATICSUNSET = 230, + + CONTROL_LABELD0DAY = 31, + CONTROL_LABELD0HI = 32, + CONTROL_LABELD0LOW = 33, + CONTROL_LABELD0GEN = 34, + CONTROL_IMAGED0IMG = 35, + CONTROL_LABELD0POP = 36, + // Controls 31..36 - 91..96 are reserved for day 0-6 !!! + + CONTROL_STATICDAY0 = 110, //110 to 116 for StaticDay0 to StaticDay6 + CONTROL_LABELDAY0 = 120, //120 to 126 for LabelDay0 to LabelDay6 + + CONTROL_IMAGE_SAT = 1000 + + } + + private enum Images + { + Image0 = 0, + Image1 = 1, + Image2 = 2, + Image3 = 3, + Image4 = 4, + } + + #endregion + + //public GUICanadianWeather() + //{ + //} + + public bool IsRefreshing + { + get { return _workerActive; } + [MethodImpl(MethodImplOptions.Synchronized)] + private set { _workerActive = value; } + } + + protected override void OnPageDestroy(int newWindowId) + { + mode = "ShowCurrent"; + lastmode = "ShowCurrent"; + _images = Images.Image0; + FirstTimeThruImageLoopIsCompleted = false; + ContinueImageLoop = true; + } + + //protected override void OnShowContextMenu() + //{ + //} + + protected override void OnPageLoad() + { + base.OnPageLoad(); + + _downloadLock = new object(); + + FirstTimeThruImageLoopIsCompleted = false; + _images = Images.Image0; + mode = "ShowCurrent"; + lastmode = "ShowCurrent"; + LoadSettings(); //get the weather settings from the user + SelectedCity = Sites[0, 3] + "/" + Sites[0, 0] + "_"; // e.g., "AB/s0000047_" + LanguageChoice = "e"; //language choice defaulting to English for now. later check Language and set as appropriate + URL = strBaseURL + SelectedCity + LanguageChoice + ".xml"; //form URL + + OnRefresh(); + } + + public override void Process() + { + TimeSpan ts = DateTime.Now - _lastRefreshTime; + if (ts.TotalMinutes >= RefreshTime && NumberofSites > 0 && !IsRefreshing) + { + //autoupdate + mode = "ShowCurrent"; + lastmode = "ShowCurrent"; + OnRefresh(); + } + base.Process(); + } + + private void BackgroundRefresh(object sender, DoWorkEventArgs e) + { + GetForecast(URL); //get the forecast from EC + ParseXML(ForecastXML); //parse it + SetWeatherModeControls(); //display + _workerCompleted = true; + IsRefreshing = false; + } + + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + + if (control == SevenDayForecastButton) + { + OnSevenDayForecast(); + } + if (control == RefreshButton) + { + FirstTimeThruImageLoopIsCompleted = false; + lastmode = "ShowCurrent"; + mode = "ShowCurrent"; + _images = Images.Image0; + OnRefresh(); + } + if (control == CityButton) + { + OnCityButton(); + } + if (control == WeatherWarningButton) + { + OnWeatherWarningButton(); + } + if (control == SatelliteImageButton) + { + OnSatelliteImageButton(); + } + base.OnClicked(controlId, control, actionType); + } + + private void OnSatelliteImageButton() + { + + SetNextViewType(); + if (ContinueImageLoop) + { + UpdateDetailImages(); + } + OnRefresh(); + } + + private void OnSevenDayForecast() + { + if (lastmode != "ShowTextForecast") + { + mode = "ShowTextForecast"; + SetWeatherModeControls(); + lastmode = "ShowTextForeca... [truncated message content] |