Skip to content

Commit

Permalink
Fix #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed May 11, 2016
1 parent b441817 commit 434f05a
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 107 deletions.
5 changes: 2 additions & 3 deletions projects/GKCommon/GKCommon.csproj
Expand Up @@ -201,6 +201,7 @@
<Compile Include="GKCommon\ExtRect.cs" />
<Compile Include="GKCommon\FileHelper.cs" />
<Compile Include="GKCommon\GfxHelper.cs" />
<Compile Include="GKCommon\GKResourceManager.cs" />
<Compile Include="GKCommon\IndistinctMatching.cs" />
<Compile Include="GKCommon\IniFile.cs" />
<Compile Include="GKCommon\Logger.cs" />
Expand Down Expand Up @@ -270,8 +271,6 @@
<DependentUpon>SlideList.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="GKCommon\SmartGraph" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
43 changes: 43 additions & 0 deletions projects/GKCommon/GKCommon/GKResourceManager.cs
@@ -0,0 +1,43 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2016 by Serg V. Zhdanovskih (aka Alchemist, aka Norseman).
*
* This file is part of "GEDKeeper".
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Globalization;
using System.Reflection;
using System.Resources;

namespace GKCommon
{
public sealed class GKResourceManager : ResourceManager
{
private readonly CultureInfo fNeutralResourcesLanguage;

public GKResourceManager(string baseName, Assembly assembly)
: base(baseName, assembly)
{
this.fNeutralResourcesLanguage = GetNeutralResourcesLanguage(assembly);
}

public object GetObjectEx(string name)
{
return base.GetObject(name, this.fNeutralResourcesLanguage);
}
}
}
1 change: 1 addition & 0 deletions projects/GKCommon/Makefile
Expand Up @@ -124,6 +124,7 @@ sources := \
./GKCommon/ExtRect.cs \
./GKCommon/FileHelper.cs \
./GKCommon/GfxHelper.cs \
./GKCommon/GKResourceManager.cs \
./GKCommon/IndistinctMatching.cs \
./GKCommon/IniFile.cs \
./GKCommon/Logger.cs \
Expand Down
98 changes: 50 additions & 48 deletions projects/GKImageViewerPlugin/GKImageViewerPlugin.cs
Expand Up @@ -20,6 +20,7 @@

using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

using GKCore.Interfaces;
Expand All @@ -36,13 +37,14 @@
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en")]

namespace GKImageViewerPlugin
{
public enum IVLS
{
/* 000 */ LSID_ImgViewer
}
public enum IVLS
{
/* 000 */ LSID_ImgViewer
}

public class Plugin : IPlugin
{
Expand All @@ -56,63 +58,63 @@ public class Plugin : IPlugin

public void Execute()
{
try
{
ImageViewerWin frm = new ImageViewerWin(this);
this.fHost.ShowMDI(frm);
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Execute(): " + ex.Message);
}
try
{
ImageViewerWin frm = new ImageViewerWin(this);
this.fHost.ShowMDI(frm);
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Execute(): " + ex.Message);
}
}

public void OnHostClosing(ref bool cancelClosing) {}
public void OnHostActivate() {}
public void OnHostDeactivate() {}
public void OnHostActivate() {}
public void OnHostDeactivate() {}

public void OnLanguageChange()
public void OnLanguageChange()
{
try
{
this.fLangMan = this.fHost.CreateLangMan(this);
this.fDisplayName = this.fLangMan.LS(IVLS.LSID_ImgViewer);
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.OnLanguageChange(): " + ex.Message);
}
try
{
this.fLangMan = this.fHost.CreateLangMan(this);
this.fDisplayName = this.fLangMan.LS(IVLS.LSID_ImgViewer);
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.OnLanguageChange(): " + ex.Message);
}
}

public bool Startup(IHost host)
{
bool result = true;
try
{
this.fHost = host;
// Implement any startup code here
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Startup(): " + ex.Message);
result = false;
}
return result;
bool result = true;
try
{
this.fHost = host;
// Implement any startup code here
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Startup(): " + ex.Message);
result = false;
}
return result;
}

public bool Shutdown()
{
bool result = true;
try
{
// Implement any shutdown code here
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Shutdown(): " + ex.Message);
result = false;
}
return result;
bool result = true;
try
{
// Implement any shutdown code here
}
catch (Exception ex)
{
fHost.LogWrite("GKImageViewerPlugin.Shutdown(): " + ex.Message);
result = false;
}
return result;
}

}
Expand Down
4 changes: 2 additions & 2 deletions projects/GKImageViewerPlugin/GKImageViewerPlugin.csproj
Expand Up @@ -7,7 +7,6 @@
<ProjectGuid>{FFE7826E-C352-46F3-AAC9-67FCCD9F6987}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GKImageViewerPlugin</RootNamespace>
<AssemblyName>GKImageViewerPlugin</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<FileAlignment>4096</FileAlignment>
Expand Down Expand Up @@ -89,8 +88,9 @@
<DependentUpon>ImageViewerWin.cs</DependentUpon>
</Compile>
<Compile Include="IVPResource.Designer.cs">
<DependentUpon>IVPResource.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>IVPResource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
Expand Down
105 changes: 52 additions & 53 deletions projects/GKImageViewerPlugin/IVPResource.Designer.cs

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

6 changes: 5 additions & 1 deletion projects/GKImageViewerPlugin/ImageViewerWin.cs
Expand Up @@ -23,6 +23,7 @@
using System.IO;
using System.Text;
using System.Windows.Forms;
using GKCommon;
using GKCommon.Controls;
using GKCommon.GEDCOM;
using GKCore.Interfaces;
Expand All @@ -41,7 +42,10 @@ public ImageViewerWin(IPlugin plugin)
{
this.InitializeComponent();

this.tbFileLoad.Image = IVPResource.iLoad;
GKResourceManager resMgr = new GKResourceManager("IVPResource", typeof(ImageViewerWin).Assembly);
Bitmap iLoad = (Bitmap)resMgr.GetObjectEx("iLoad");

this.tbFileLoad.Image = /*IVPResource.*/iLoad;

this.fLangMan = plugin.LangMan;

Expand Down

0 comments on commit 434f05a

Please sign in to comment.