Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Markup / Localizer / BamlLocalizableResource.cs / 1 / BamlLocalizableResource.cs
//------------------------------------------------------------------------
//
// Microsoft Windows Client Platform
// Copyright (C) Microsoft Corporation, 2001
//
// File: BamlLocalizableResource.cs
//
// Contents: BamlLocalizableResource class, part of Baml Localization API
//
// Created: 3/4/2004 garyyang
// History: 8/3/2004 garyyang Move to System.Windows namespace
// 11/29/2004 garyyang Move to System.Windows.Markup.Localization namespace
// 03/24/2005 Garyyang Move to System.Windows.Markup.Localizer namespace
//
//-----------------------------------------------------------------------
using System;
using System.Windows;
using MS.Internal;
using System.Diagnostics;
namespace System.Windows.Markup.Localizer
{
///
/// Localization resource in Baml
///
public class BamlLocalizableResource
{
//--------------------------------
// constructor
//--------------------------------
///
/// Constructor of LocalizableResource
///
public BamlLocalizableResource() : this (
null,
null,
LocalizationCategory.None,
true,
true
)
{
}
///
/// Constructor of LocalizableResource
///
public BamlLocalizableResource(
string content,
string comments,
LocalizationCategory category,
bool modifiable,
bool readable
)
{
_content = content;
_comments = comments;
_category = category;
Modifiable = modifiable;
Readable = readable;
}
///
/// constructor that creates a deep copy of the other localizable resource
///
/// the other localizale resource
internal BamlLocalizableResource(BamlLocalizableResource other)
{
Debug.Assert(other != null);
_content = other._content;
_comments = other._comments;
_flags = other._flags;
_category = other._category;
}
//---------------------------------
// public properties
//---------------------------------
///
/// The localizable value
///
public string Content
{
get
{
return _content;
}
set
{
_content = value;
}
}
///
/// The localization comments
///
public string Comments
{
get
{
return _comments;
}
set
{
_comments = value;
}
}
///
/// Localization Lock by developer
///
public bool Modifiable
{
get
{
return (_flags & LocalizationFlags.Modifiable) > 0;
}
set
{
if (value)
{
_flags |= LocalizationFlags.Modifiable;
}
else
{
_flags &= (~LocalizationFlags.Modifiable);
}
}
}
///
/// Visibility of the resource for translation
///
public bool Readable
{
get
{
return (_flags & LocalizationFlags.Readable) > 0;
}
set
{
if (value)
{
_flags |= LocalizationFlags.Readable;
}
else
{
_flags &= (~LocalizationFlags.Readable);
}
}
}
///
/// String category of the resource
///
public LocalizationCategory Category
{
get
{
return _category;
}
set
{
_category = value;
}
}
///
/// compare equality
///
public override bool Equals(object other)
{
BamlLocalizableResource otherResource = other as BamlLocalizableResource;
if (otherResource == null)
return false;
return (_content == otherResource._content
&& _comments == otherResource._comments
&& _flags == otherResource._flags
&& _category == otherResource._category);
}
///
///Return the hashcode.
///
public override int GetHashCode()
{
return (_content == null ? 0 : _content.GetHashCode())
^(_comments == null ? 0 : _comments.GetHashCode())
^ (int) _flags
^ (int) _category;
}
//---------------------------------
// private members
//---------------------------------
private string _content;
private string _comments;
private LocalizationFlags _flags;
private LocalizationCategory _category;
//---------------------------------
// Private type
//---------------------------------
[Flags]
private enum LocalizationFlags : byte
{
Readable = 1,
Modifiable = 2,
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------
//
// Microsoft Windows Client Platform
// Copyright (C) Microsoft Corporation, 2001
//
// File: BamlLocalizableResource.cs
//
// Contents: BamlLocalizableResource class, part of Baml Localization API
//
// Created: 3/4/2004 garyyang
// History: 8/3/2004 garyyang Move to System.Windows namespace
// 11/29/2004 garyyang Move to System.Windows.Markup.Localization namespace
// 03/24/2005 Garyyang Move to System.Windows.Markup.Localizer namespace
//
//-----------------------------------------------------------------------
using System;
using System.Windows;
using MS.Internal;
using System.Diagnostics;
namespace System.Windows.Markup.Localizer
{
///
/// Localization resource in Baml
///
public class BamlLocalizableResource
{
//--------------------------------
// constructor
//--------------------------------
///
/// Constructor of LocalizableResource
///
public BamlLocalizableResource() : this (
null,
null,
LocalizationCategory.None,
true,
true
)
{
}
///
/// Constructor of LocalizableResource
///
public BamlLocalizableResource(
string content,
string comments,
LocalizationCategory category,
bool modifiable,
bool readable
)
{
_content = content;
_comments = comments;
_category = category;
Modifiable = modifiable;
Readable = readable;
}
///
/// constructor that creates a deep copy of the other localizable resource
///
/// the other localizale resource
internal BamlLocalizableResource(BamlLocalizableResource other)
{
Debug.Assert(other != null);
_content = other._content;
_comments = other._comments;
_flags = other._flags;
_category = other._category;
}
//---------------------------------
// public properties
//---------------------------------
///
/// The localizable value
///
public string Content
{
get
{
return _content;
}
set
{
_content = value;
}
}
///
/// The localization comments
///
public string Comments
{
get
{
return _comments;
}
set
{
_comments = value;
}
}
///
/// Localization Lock by developer
///
public bool Modifiable
{
get
{
return (_flags & LocalizationFlags.Modifiable) > 0;
}
set
{
if (value)
{
_flags |= LocalizationFlags.Modifiable;
}
else
{
_flags &= (~LocalizationFlags.Modifiable);
}
}
}
///
/// Visibility of the resource for translation
///
public bool Readable
{
get
{
return (_flags & LocalizationFlags.Readable) > 0;
}
set
{
if (value)
{
_flags |= LocalizationFlags.Readable;
}
else
{
_flags &= (~LocalizationFlags.Readable);
}
}
}
///
/// String category of the resource
///
public LocalizationCategory Category
{
get
{
return _category;
}
set
{
_category = value;
}
}
///
/// compare equality
///
public override bool Equals(object other)
{
BamlLocalizableResource otherResource = other as BamlLocalizableResource;
if (otherResource == null)
return false;
return (_content == otherResource._content
&& _comments == otherResource._comments
&& _flags == otherResource._flags
&& _category == otherResource._category);
}
///
///Return the hashcode.
///
public override int GetHashCode()
{
return (_content == null ? 0 : _content.GetHashCode())
^(_comments == null ? 0 : _comments.GetHashCode())
^ (int) _flags
^ (int) _category;
}
//---------------------------------
// private members
//---------------------------------
private string _content;
private string _comments;
private LocalizationFlags _flags;
private LocalizationCategory _category;
//---------------------------------
// Private type
//---------------------------------
[Flags]
private enum LocalizationFlags : byte
{
Readable = 1,
Modifiable = 2,
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DBCommandBuilder.cs
- LocalizabilityAttribute.cs
- clipboard.cs
- DocumentViewerHelper.cs
- Cursor.cs
- x509utils.cs
- RoutedEventHandlerInfo.cs
- MenuItemBinding.cs
- EntityDesignerUtils.cs
- BlockUIContainer.cs
- MissingManifestResourceException.cs
- Preprocessor.cs
- TypeElement.cs
- thaishape.cs
- DiscoveryClientDocuments.cs
- ImportCatalogPart.cs
- CollectionsUtil.cs
- XmlTextWriter.cs
- InitializationEventAttribute.cs
- URLString.cs
- TransformPattern.cs
- SrgsGrammar.cs
- Collection.cs
- InvokeMethodActivity.cs
- DrawingAttributesDefaultValueFactory.cs
- DayRenderEvent.cs
- InputLanguageProfileNotifySink.cs
- CheckBox.cs
- Process.cs
- WorkItem.cs
- EventMemberCodeDomSerializer.cs
- XmlPropertyBag.cs
- TemplateXamlTreeBuilder.cs
- WCFBuildProvider.cs
- WebPartCatalogCloseVerb.cs
- PathSegment.cs
- FunctionQuery.cs
- SystemInfo.cs
- StrokeNodeData.cs
- EmbeddedMailObject.cs
- TypeElement.cs
- SelfIssuedSamlTokenFactory.cs
- SimpleTextLine.cs
- InlineCollection.cs
- ResXDataNode.cs
- Int32Storage.cs
- RelOps.cs
- ClientSettings.cs
- PageAsyncTaskManager.cs
- CustomAttributeBuilder.cs
- EventLogPermission.cs
- WmfPlaceableFileHeader.cs
- SqlDataSourceStatusEventArgs.cs
- FormatSettings.cs
- HybridObjectCache.cs
- ProxyWebPartConnectionCollection.cs
- DataGridViewRow.cs
- SystemNetHelpers.cs
- itemelement.cs
- TreeViewDesigner.cs
- XmlSignatureManifest.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- RijndaelManaged.cs
- CompositeScriptReference.cs
- DefaultProxySection.cs
- DependencyPropertyHelper.cs
- PropertyMetadata.cs
- AccessDataSourceView.cs
- DecimalConstantAttribute.cs
- HashAlgorithm.cs
- PropertyChange.cs
- MarkupCompilePass2.cs
- ExplicitDiscriminatorMap.cs
- ReachPageContentSerializer.cs
- LabelAutomationPeer.cs
- RangeContentEnumerator.cs
- TreeNode.cs
- MemoryMappedView.cs
- ReferentialConstraint.cs
- IDReferencePropertyAttribute.cs
- WorkflowMarkupSerializer.cs
- ExtensionSurface.cs
- GeneralTransformGroup.cs
- DatePickerDateValidationErrorEventArgs.cs
- DesignDataSource.cs
- UnsafeNativeMethods.cs
- Stackframe.cs
- Cursor.cs
- GlobalItem.cs
- ScriptModule.cs
- DESCryptoServiceProvider.cs
- GroupItemAutomationPeer.cs
- ReadWriteSpinLock.cs
- TreeChangeInfo.cs
- TextBox.cs
- ClrProviderManifest.cs
- ProcessHostMapPath.cs
- CommonObjectSecurity.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- WasEndpointConfigContainer.cs