Skip to content

Commit ebd1b6f

Browse files
author
medigor
committed
добавил пример внешнего события
1 parent bab1edf commit ebd1b6f

File tree

9 files changed

+196
-15
lines changed

9 files changed

+196
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* [addin1.rs](src/addin1.rs) - реализация компоненты с помощью низкоуровнего интерфейса, причем весь код безопасный.
2626
* [addin2.rs](src/addin2.rs) - упрощенный вариант, используется другой трейт.
2727

28-
### [conf1c](conf1c) - конфигурация 1С (выгрузка из конфигуратора 8.3.22), минимальный тестовый код.
28+
### [conf1c](conf1c) - конфигурация 1С (выгрузка из конфигуратора 8.3.23), минимальный тестовый код.
2929
* [DataProcessors/Обработка1/Forms/Форма/Ext/Form/Module.bsl](conf1c/DataProcessors/Обработка1/Forms/Форма/Ext/Form/Module.bsl) - тесты для ручного запуска.
3030

3131
## Разработка

conf1c/Configuration.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<Configuration uuid="72b21170-d6cc-48ee-8426-d69353f61fd5">
44
<InternalInfo>
55
<xr:ContainedObject>
@@ -36,7 +36,7 @@
3636
<Synonym/>
3737
<Comment/>
3838
<NamePrefix/>
39-
<ConfigurationExtensionCompatibilityMode>Version8_3_22</ConfigurationExtensionCompatibilityMode>
39+
<ConfigurationExtensionCompatibilityMode>Version8_3_23</ConfigurationExtensionCompatibilityMode>
4040
<DefaultRunMode>ManagedApplication</DefaultRunMode>
4141
<UsePurposes>
4242
<v8:Value xsi:type="app:ApplicationUsePurpose">PlatformApplication</v8:Value>
@@ -193,6 +193,14 @@
193193
<app:functionality>Videoconferences</app:functionality>
194194
<app:use>false</app:use>
195195
</app:functionality>
196+
<app:functionality>
197+
<app:functionality>NFC</app:functionality>
198+
<app:use>false</app:use>
199+
</app:functionality>
200+
<app:functionality>
201+
<app:functionality>DocumentScanning</app:functionality>
202+
<app:use>false</app:use>
203+
</app:functionality>
196204
</UsedMobileApplicationFunctionalities>
197205
<StandaloneConfigurationRestrictionRoles/>
198206
<MobileApplicationURLs/>
@@ -210,6 +218,7 @@
210218
<ModalityUseMode>DontUse</ModalityUseMode>
211219
<SynchronousPlatformExtensionAndAddInCallUseMode>DontUse</SynchronousPlatformExtensionAndAddInCallUseMode>
212220
<InterfaceCompatibilityMode>Taxi</InterfaceCompatibilityMode>
221+
<DatabaseTablespacesUseMode>DontUse</DatabaseTablespacesUseMode>
213222
<CompatibilityMode>Version8_3_22</CompatibilityMode>
214223
<DefaultConstantsForm/>
215224
</Properties>

conf1c/DataProcessors/Обработка1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<DataProcessor uuid="33179d0b-730e-44f5-b20c-1af11f7f1f60">
44
<InternalInfo>
55
<xr:GeneratedType name="DataProcessorObject.Обработка1" category="Object">

conf1c/DataProcessors/Обработка1/Forms/Форма.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<Form uuid="24033a67-5ef1-4265-9a88-eb7f279ce1cb">
44
<Properties>
55
<Name>Форма</Name>

conf1c/DataProcessors/Обработка1/Forms/Форма/Ext/Form.xml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Form xmlns="http://v8.1c.ru/8.3/xcf/logform" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcssch="http://v8.1c.ru/8.1/data-composition-system/schema" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<Form xmlns="http://v8.1c.ru/8.3/xcf/logform" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcssch="http://v8.1c.ru/8.1/data-composition-system/schema" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<AutoSaveDataInSettings>Use</AutoSaveDataInSettings>
44
<AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/>
5+
<Events>
6+
<Event name="ExternalEvent">ВнешнееСобытие</Event>
7+
</Events>
58
<ChildItems>
69
<InputField name="ИмяФайла" id="19">
710
<DataPath>ИмяФайла</DataPath>
@@ -31,6 +34,11 @@
3134
<CommandName>Form.Command.Тест4</CommandName>
3235
<ExtendedTooltip name="Тест4РасширеннаяПодсказка" id="27"/>
3336
</Button>
37+
<Button name="ТестВнешнееСобытие" id="28">
38+
<Type>UsualButton</Type>
39+
<CommandName>Form.Command.ТестВнешнееСобытие</CommandName>
40+
<ExtendedTooltip name="ТестВнешнееСобытиеРасширеннаяПодсказка" id="29"/>
41+
</Button>
3442
</ChildItems>
3543
<Attributes>
3644
<Attribute name="Объект" id="1">
@@ -119,5 +127,20 @@
119127
</ToolTip>
120128
<Action>Тест4</Action>
121129
</Command>
130+
<Command name="ТестВнешнееСобытие" id="5">
131+
<Title>
132+
<v8:item>
133+
<v8:lang>ru</v8:lang>
134+
<v8:content>Тест внешнее событие</v8:content>
135+
</v8:item>
136+
</Title>
137+
<ToolTip>
138+
<v8:item>
139+
<v8:lang>ru</v8:lang>
140+
<v8:content>Тест внешнее событие</v8:content>
141+
</v8:item>
142+
</ToolTip>
143+
<Action>ТестВнешнееСобытие</Action>
144+
</Command>
122145
</Commands>
123146
</Form>

conf1c/DataProcessors/Обработка1/Forms/Форма/Ext/Form/Module.bsl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11

2+
&НаКлиенте
3+
Перем КомпонентаДляВнешнегоСобытия;
4+
5+
&НаКлиенте
6+
Перем СчетчикВнешнихСобытий;
7+
8+
&НаКлиенте
9+
Перем ДатаНачалаСобытий;
10+
11+
212
&НаКлиенте
313
Процедура Тест1(Команда)
414
Тест1НаСервере(ИмяФайла);
@@ -149,3 +159,37 @@
149159
Сообщить(СтрШаблон("Длительность: %1 мс", Конец - Начало));
150160

151161
КонецПроцедуры
162+
163+
&НаКлиенте
164+
Асинх Процедура ТестВнешнееСобытие(Команда)
165+
166+
Если Не Ждать ПодключитьВнешнююКомпонентуАсинх(ИмяФайла, "Test", ТипВнешнейКомпоненты.Native, ТипПодключенияВнешнейКомпоненты.НеИзолированно) Тогда
167+
ВызватьИсключение "Не удалось подключить";
168+
КонецЕсли;
169+
170+
КомпонентаДляВнешнегоСобытия = Новый ("AddIn.Test.Class2");
171+
172+
СчетчикВнешнихСобытий = 0;
173+
ДатаНачалаСобытий = ТекущаяУниверсальнаяДатаВМиллисекундах();
174+
Элементы.ТестВнешнееСобытие.Доступность = Ложь;
175+
176+
Ждать КомпонентаДляВнешнегоСобытия.StartTimerAsync(1000);
177+
178+
КонецПроцедуры
179+
180+
&НаКлиенте
181+
Асинх Процедура ВнешнееСобытие(Источник, Событие, Данные)
182+
183+
Если Источник = "Class2" И Событие = "Timer" Тогда
184+
СчетчикВнешнихСобытий = СчетчикВнешнихСобытий + 1;
185+
Сообщить(СтрШаблон("%1 мс, внешнее событие № %2, данные: %3", ТекущаяУниверсальнаяДатаВМиллисекундах() - ДатаНачалаСобытий, СчетчикВнешнихСобытий, Данные));
186+
Если СчетчикВнешнихСобытий = 5 Тогда
187+
Ждать КомпонентаДляВнешнегоСобытия.StopTimerAsync();
188+
КонецЕсли;
189+
ИначеЕсли Источник = "Class2" И Событие = "TimerShutdown" Тогда
190+
КомпонентаДляВнешнегоСобытия = Неопределено;
191+
Сообщить(СтрШаблон("%1 мс, TimerShutdown", ТекущаяУниверсальнаяДатаВМиллисекундах() - ДатаНачалаСобытий));
192+
Элементы.ТестВнешнееСобытие.Доступность = Истина;
193+
КонецЕсли;
194+
195+
КонецПроцедуры

conf1c/Ext/HomePageWorkArea.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<HomePageWorkArea xmlns="http://v8.1c.ru/8.3/xcf/extrnprops" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<HomePageWorkArea xmlns="http://v8.1c.ru/8.3/xcf/extrnprops" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<WorkingAreaTemplate>TwoColumnsEqualWidth</WorkingAreaTemplate>
44
<LeftColumn>
55
<Item>

conf1c/Languages/Русский.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.15">
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.16">
33
<Language uuid="e3ac9659-5250-4530-9ca6-3f4f4ef6413a">
44
<Properties>
55
<Name>Русский</Name>

0 commit comments

Comments
 (0)