~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/DesignerResourceService.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Globalization;
 
6
using ICSharpCode.Core;
 
7
 
 
8
namespace ICSharpCode.FormsDesigner.Services
 
9
{
 
10
        sealed class DesignerResourceService : System.ComponentModel.Design.IResourceService
 
11
        {
 
12
                readonly ResourceStore store;
 
13
                
 
14
                public DesignerResourceService(ResourceStore store)
 
15
                {
 
16
                        if (store == null)
 
17
                                throw new ArgumentNullException("store");
 
18
                        this.store = store;
 
19
                }
 
20
                
 
21
                #region System.ComponentModel.Design.IResourceService interface implementation
 
22
                public System.Resources.IResourceWriter GetResourceWriter(CultureInfo info)
 
23
                {
 
24
                        try {
 
25
                                LoggingService.Debug("ResourceWriter requested for culture: " + info.ToString());
 
26
                                return this.store.GetWriter(info);
 
27
                        } catch (Exception e) {
 
28
                                MessageService.ShowException(e);
 
29
                                return null;
 
30
                        }
 
31
                }
 
32
                
 
33
                public System.Resources.IResourceReader GetResourceReader(System.Globalization.CultureInfo info)
 
34
                {
 
35
                        try {
 
36
                                LoggingService.Debug("ResourceReader requested for culture: "+info.ToString());
 
37
                                return this.store.GetReader(info);
 
38
                        } catch (Exception e) {
 
39
                                MessageService.ShowException(e);
 
40
                                return null;
 
41
                        }
 
42
                }
 
43
                #endregion
 
44
        }
 
45
}