Skip to content

Commit

Permalink
Merge pull request #31 from RapidScada/develop
Browse files Browse the repository at this point in the history
Merge Develop to Master
  • Loading branch information
2mik authored Jan 23, 2017
2 parents 3f9d0b1 + 8c78652 commit 47da7fd
Show file tree
Hide file tree
Showing 284 changed files with 4,530 additions and 762 deletions.
Binary file modified Base/data/ScadaBase_4.2_en.sdf
Binary file not shown.
Binary file modified Base/data/ScadaBase_4.2_ru.sdf
Binary file not shown.
3 changes: 2 additions & 1 deletion Report/RepBuilder/ExcelRepBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,8 @@ protected bool FindDirective(string s, string attrName, out string attrVal, out
/// </summary>
protected void SetNodeTextWithBreak(XmlNode xmlNode, string text, string textBreak)
{
if (text == null) text = "";
if (text == null)
text = "";
xmlNode.InnerText = text.Replace(textBreak, Break);
textBroken = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
*
* Product : Rapid SCADA
* Module : AddressBook
* Summary : The phrases used by the library
* Summary : The phrases used by the address book
*
* Author : Mikhail Shiryaev
* Created : 2016
* Modified : 2016
*/

namespace Scada.Comm.Devices.AddressBook
namespace Scada.Comm.Devices.AB
{
/// <summary>
/// The phrases used by the library
/// <para>Фразы, используемые библиотекой</para>
/// The phrases used by the address book
/// <para>Фразы, используемые адресной книгой</para>
/// </summary>
internal static class LibPhrases
internal static class AbPhrases
{
static LibPhrases()
static AbPhrases()
{
SetToDefault();
}
Expand Down
95 changes: 95 additions & 0 deletions ScadaComm/OpenKPs/AddressBook/AbUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright 2016 Mikhail Shiryaev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* Product : Rapid SCADA
* Module : AddressBook
* Summary : The class contains utility methods for the address book
*
* Author : Mikhail Shiryaev
* Created : 2016
* Modified : 2016
*/

using System.Collections.Generic;
using System.IO;
using Utils;

namespace Scada.Comm.Devices.AB
{
/// <summary>
/// The class contains utility methods for the address book
/// <para>Класс, содержащий вспомогательные методы для адресной книги</para>
/// </summary>
public static class AbUtils
{
/// <summary>
/// Загрузить адресную книгу из файла
/// </summary>
public static bool LoadAddressBook(string configDir, Log.WriteLineDelegate writeToLog,
out AddressBook addressBook)
{
addressBook = new AddressBook();

string fileName = configDir + AddressBook.DefFileName;
if (File.Exists(fileName))
{
writeToLog(Localization.UseRussian ?
"Загрузка адресной книги" :
"Loading address book");
string errMsg;

if (addressBook.Load(fileName, out errMsg))
{
return true;
}
else
{
writeToLog(errMsg);
return false;
}
}
else
{
writeToLog(Localization.UseRussian ?
"Адресная книга отсутствует" :
"Address book is missing");
return false;
}
}

/// <summary>
/// Загрузить адресную книгу из файла или получить её из общих свойств линии связи Коммуникатора
/// </summary>
public static AddressBook GetAddressBook(string configDir, SortedList<string, object> commonProps,
Log.WriteLineDelegate writeToLog)
{
AddressBook addressBook;
object addrBookObj;

if (commonProps.TryGetValue("AddressBook", out addrBookObj))
{
addressBook = addrBookObj as AddressBook;
}
else
{
LoadAddressBook(configDir, writeToLog, out addressBook);
commonProps.Add("AddressBook", addressBook);
}

return addressBook;
}
}
}
6 changes: 3 additions & 3 deletions ScadaComm/OpenKPs/AddressBook/AddressBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using System.Collections.Generic;
using System.Xml;

namespace Scada.Comm.Devices.AddressBook
namespace Scada.Comm.Devices.AB
{
/// <summary>
/// Address book
Expand Down Expand Up @@ -460,7 +460,7 @@ public bool Load(string fileName, out string errMsg)
}
catch (Exception ex)
{
errMsg = LibPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message;
errMsg = AbPhrases.LoadAddressBookError + ":" + Environment.NewLine + ex.Message;
return false;
}
}
Expand Down Expand Up @@ -509,7 +509,7 @@ public bool Save(string fileName, out string errMsg)
}
catch (Exception ex)
{
errMsg = LibPhrases.SaveAddressBookError + ":" + Environment.NewLine + ex.Message;
errMsg = AbPhrases.SaveAddressBookError + ":" + Environment.NewLine + ex.Message;
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions ScadaComm/OpenKPs/AddressBook/AddressBook.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ProjectGuid>{CB3BC544-51CB-4A40-8CF0-4B769C01F996}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Scada.Comm.Devices.AddressBook</RootNamespace>
<RootNamespace>Scada.Comm.Devices.AB</RootNamespace>
<AssemblyName>AddressBook</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
Expand All @@ -29,8 +29,13 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\AddressBook.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Log, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Log\bin\Release\Log.dll</HintPath>
</Reference>
<Reference Include="ScadaCommCommon, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ScadaCommCommon\bin\Release\ScadaCommCommon.dll</HintPath>
Expand All @@ -45,14 +50,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AbUtils.cs" />
<Compile Include="AddressBook.cs" />
<Compile Include="FrmAddressBook.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmAddressBook.designer.cs">
<DependentUpon>FrmAddressBook.cs</DependentUpon>
</Compile>
<Compile Include="LibPhrases.cs" />
<Compile Include="AbPhrases.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
30 changes: 15 additions & 15 deletions ScadaComm/OpenKPs/AddressBook/FrmAddressBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using System.Net.Mail;
using System.Windows.Forms;

namespace Scada.Comm.Devices.AddressBook
namespace Scada.Comm.Devices.AB
{
/// <summary>
/// Address book form
Expand Down Expand Up @@ -231,9 +231,9 @@ private void FrmAddressBook_Load(object sender, EventArgs e)
{
if (Localization.LoadDictionaries(appDirs.LangDir, "AddressBook", out errMsg))
{
Translator.TranslateForm(this, "Scada.Comm.Devices.AddressBook.FrmAddressBook");
LibPhrases.Init();
rootNode.Text = LibPhrases.AddressBookNode;
Translator.TranslateForm(this, "Scada.Comm.Devices.AB.FrmAddressBook");
AbPhrases.Init();
rootNode.Text = AbPhrases.AddressBookNode;
}
else
{
Expand All @@ -258,7 +258,7 @@ private void FrmAddressBook_FormClosing(object sender, FormClosingEventArgs e)
{
if (Modified)
{
DialogResult result = MessageBox.Show(LibPhrases.SavePhonebookConfirm,
DialogResult result = MessageBox.Show(AbPhrases.SavePhonebookConfirm,
CommonPhrases.QuestionCaption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

switch (result)
Expand All @@ -284,7 +284,7 @@ private void FrmAddressBook_FormClosing(object sender, FormClosingEventArgs e)
private void btnAddContactGroup_Click(object sender, EventArgs e)
{
// добавление группы контактов
AddressBook.ContactGroup contactGroup = new AddressBook.ContactGroup(LibPhrases.NewContactGroup);
AddressBook.ContactGroup contactGroup = new AddressBook.ContactGroup(AbPhrases.NewContactGroup);
TreeNode contactGroupNode = CreateContactGroupNode(contactGroup);

treeView.Add(rootNode, contactGroupNode);
Expand All @@ -298,7 +298,7 @@ private void btnAddContact_Click(object sender, EventArgs e)
TreeNode contactGroupNode = treeView.FindClosest(typeof(AddressBook.ContactGroup));
if (contactGroupNode != null)
{
AddressBook.Contact contact = new AddressBook.Contact(LibPhrases.NewContact);
AddressBook.Contact contact = new AddressBook.Contact(AbPhrases.NewContact);
TreeNode contactNode = CreateContactNode(contact);

treeView.Add(contactGroupNode, contactNode);
Expand All @@ -313,7 +313,7 @@ private void btnAddPhoneNumber_Click(object sender, EventArgs e)
TreeNode contactNode = treeView.FindClosest(typeof(AddressBook.Contact));
if (contactNode != null)
{
AddressBook.PhoneNumber phoneNumber = new AddressBook.PhoneNumber(LibPhrases.NewPhoneNumber);
AddressBook.PhoneNumber phoneNumber = new AddressBook.PhoneNumber(AbPhrases.NewPhoneNumber);
TreeNode phoneNumberNode = CreatePhoneNumberNode(phoneNumber);

treeView.Add(contactNode, phoneNumberNode);
Expand All @@ -328,7 +328,7 @@ private void btnAddEmail_Click(object sender, EventArgs e)
TreeNode contactNode = treeView.FindClosest(typeof(AddressBook.Contact));
if (contactNode != null)
{
AddressBook.Email email = new AddressBook.Email(LibPhrases.NewEmail);
AddressBook.Email email = new AddressBook.Email(AbPhrases.NewEmail);
TreeNode emailNode = CreateEmailNode(email);

treeView.Add(contactNode, emailNode);
Expand Down Expand Up @@ -400,7 +400,7 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
if (newVal == "")
{
e.CancelEdit = true;
ScadaUiUtils.ShowError(LibPhrases.EmptyValueNotAllowed);
ScadaUiUtils.ShowError(AbPhrases.EmptyValueNotAllowed);
e.Node.BeginEdit();
}
else if (!oldVal.Equals(newVal, StringComparison.Ordinal))
Expand All @@ -420,14 +420,14 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
newInd = FindInsertIndex<AddressBook.ContactGroup>(
(List<AddressBook.ContactGroup>)list, curInd, out duplicated);
if (duplicated)
errMsg = LibPhrases.ContactGroupExists;
errMsg = AbPhrases.ContactGroupExists;
}
else if (bookItem is AddressBook.Contact)
{
newInd = FindInsertIndex<AddressBook.Contact>(
(List<AddressBook.Contact>)list, curInd, out duplicated);
if (duplicated)
errMsg = LibPhrases.ContactExists;
errMsg = AbPhrases.ContactExists;
}
else if (bookItem is AddressBook.ContactRecord)
{
Expand All @@ -437,14 +437,14 @@ private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
if (bookItem is AddressBook.PhoneNumber)
{
if (duplicated)
errMsg = LibPhrases.PhoneNumberExists;
errMsg = AbPhrases.PhoneNumberExists;
}
else
{
if (duplicated)
errMsg = LibPhrases.EmailExists;
errMsg = AbPhrases.EmailExists;
if (!CheckEmail(newVal))
errMsg = LibPhrases.IncorrectEmail;
errMsg = AbPhrases.IncorrectEmail;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ScadaComm/OpenKPs/AddressBook/FrmAddressBook.designer.cs

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

4 changes: 2 additions & 2 deletions ScadaComm/OpenKPs/AddressBook/Lang/AddressBook.en-GB.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<AddressBookDictionaries>
<Dictionary key="Scada.Comm.Devices.AddressBook">
<Dictionary key="Scada.Comm.Devices.AB">
<Phrase key="LoadAddressBookError">Error loading address book</Phrase>
<Phrase key="SaveAddressBookError">Error saving address book</Phrase>
</Dictionary>
<Dictionary key="Scada.Comm.Devices.AddressBook.FrmAddressBook">
<Dictionary key="Scada.Comm.Devices.AB.FrmAddressBook">
<Phrase key="this">Address Book</Phrase>
<Phrase key="btnAddContactGroup.ToolTip">Add contact group</Phrase>
<Phrase key="btnAddContact.ToolTip">Add contact</Phrase>
Expand Down

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

2 changes: 1 addition & 1 deletion ScadaComm/OpenKPs/KpEmail/FrmConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Modified : 2016
*/

using Scada.Comm.Devices.AddressBook;
using Scada.Comm.Devices.AB;
using Scada.UI;
using System;
using System.IO;
Expand Down
Loading

0 comments on commit 47da7fd

Please sign in to comment.