|
7 | 7 |
|
8 | 8 | <PackageTips Name="BootstrapBlazor.OpcDa"/> |
9 | 9 |
|
| 10 | +<p class="code-label">@Localizer["RegisterServiceText"]</p> |
| 11 | + |
| 12 | +<Pre>// 增加 BootstrapBlazor.OpcDa 服务 |
| 13 | +if (OperatingSystem.IsWindows()) |
| 14 | +{ |
| 15 | + services.AddOpcDaServer(); |
| 16 | +}</Pre> |
| 17 | + |
10 | 18 | <DemoBlock Title="@Localizer["OpcDaNormalTitle"]" Introduction="@Localizer["OpcDaNormalIntro"]" ShowCode="false" Name="Normal"> |
11 | | - <p class="code-label">1. 点击 <b>连接</b> 按钮与 <code>OpcDa</code> 服务器建立通讯连接</p> |
| 19 | + <p class="code-label">@Localizer["InjectServiceText"]</p> |
| 20 | + <Pre>[Inject] |
| 21 | +[NotNull] |
| 22 | +private IOpcDaServer? OpcDaServer { get; set; }</Pre> |
| 23 | + |
| 24 | + <p class="code-label">@((MarkupString)Localizer["Step1Text"].Value)</p> |
12 | 25 | <p> |
13 | 26 | <BootstrapInputGroup> |
14 | | - <BootstrapInputGroupLabel DisplayText="OpcDa Server"></BootstrapInputGroupLabel> |
| 27 | + <BootstrapInputGroupLabel DisplayText="@Localizer["ServerLabel"]"></BootstrapInputGroupLabel> |
15 | 28 | <Display @bind-Value="@_serverName"></Display> |
16 | | - <Button Text="连接" OnClick="OnConnect" IsDisabled="OpcDaServer.IsConnected"></Button> |
17 | | - <Button Text="断开" OnClick="OnDisConnect" IsDisabled="!OpcDaServer.IsConnected" |
| 29 | + <Button Text="@Localizer["ConnectButtonText"]" OnClick="OnConnect" IsDisabled="OpcDaServer.IsConnected"></Button> |
| 30 | + <Button Text="@Localizer["DisconnectButtonText"]" OnClick="OnDisConnect" IsDisabled="!OpcDaServer.IsConnected" |
18 | 31 | Color="Color.Danger"></Button> |
19 | 32 | </BootstrapInputGroup> |
20 | 33 | </p> |
21 | 34 |
|
22 | | - <p class="code-label">2. 点击 <b>读取</b> 按钮读取 <code>OpcDa</code> 服务器上的位号值</p> |
| 35 | + <p class="code-label">@((MarkupString)Localizer["Step2Text"].Value)</p> |
23 | 36 | <div class="row g-3 mb-3"> |
24 | 37 | <div class="col-12 col-sm-6"> |
25 | 38 | <BootstrapInputGroup> |
26 | | - <BootstrapInputGroupLabel DisplayText="转速"></BootstrapInputGroupLabel> |
| 39 | + <BootstrapInputGroupLabel DisplayText="@Localizer["SpeedLabel"]"></BootstrapInputGroupLabel> |
27 | 40 | <BootstrapInputGroupLabel DisplayText="@Tag1"></BootstrapInputGroupLabel> |
28 | 41 | <Display @bind-Value="@_tagValue1"></Display> |
29 | 42 | </BootstrapInputGroup> |
30 | 43 | </div> |
31 | 44 | <div class="col-12 col-sm-6"> |
32 | 45 | <BootstrapInputGroup> |
33 | | - <BootstrapInputGroupLabel DisplayText="流速"></BootstrapInputGroupLabel> |
| 46 | + <BootstrapInputGroupLabel DisplayText="@Localizer["FlowLabel"]"></BootstrapInputGroupLabel> |
34 | 47 | <BootstrapInputGroupLabel DisplayText="@Tag2"></BootstrapInputGroupLabel> |
35 | 48 | <Display @bind-Value="@_tagValue2"></Display> |
36 | 49 | </BootstrapInputGroup> |
37 | 50 | </div> |
38 | 51 | <div class="col-12 col-sm-6"> |
39 | | - <Button OnClick="OnRead" Text="读取" IsDisabled="!OpcDaServer.IsConnected"></Button> |
| 52 | + <Button OnClick="OnRead" Text="@Localizer["ReadButtonText"]" IsDisabled="!OpcDaServer.IsConnected"></Button> |
40 | 53 | </div> |
41 | 54 | </div> |
42 | 55 |
|
43 | | - <p class="code-label">3. 订阅功能</p> |
44 | | - <p>通过订阅可以监控一组 <b>位号</b> 数据改变情况,当数据改变时通过 <code>DataChanged</code> 回调方法通知订阅者</p> |
| 56 | + <p class="code-label">@Localizer["Step3Title"]</p> |
| 57 | + <p>@((MarkupString)Localizer["Step3Text"].Value)</p> |
45 | 58 | <p class="row g-3"> |
46 | 59 | <div class="col-12 col-sm-6"> |
47 | 60 | <BootstrapInputGroup> |
48 | | - <BootstrapInputGroupLabel DisplayText="订阅名称"></BootstrapInputGroupLabel> |
| 61 | + <BootstrapInputGroupLabel DisplayText="@Localizer["SubscriptionNameLabel"]"></BootstrapInputGroupLabel> |
49 | 62 | <BootstrapInputGroupLabel DisplayText="Subscription1"></BootstrapInputGroupLabel> |
50 | 63 | </BootstrapInputGroup> |
51 | 64 | </div> |
52 | 65 | <div class="col-12 col-sm-6"> |
53 | 66 | <BootstrapInputGroup> |
54 | | - <BootstrapInputGroupLabel DisplayText="更新频率"></BootstrapInputGroupLabel> |
| 67 | + <BootstrapInputGroupLabel DisplayText="@Localizer["UpdateRateLabel"]"></BootstrapInputGroupLabel> |
55 | 68 | <BootstrapInputGroupLabel DisplayText="1000"></BootstrapInputGroupLabel> |
56 | 69 | </BootstrapInputGroup> |
57 | 70 | </div> |
58 | 71 | <div class="col-12 col-sm-6"> |
59 | 72 | <BootstrapInputGroup> |
60 | | - <BootstrapInputGroupLabel DisplayText="转速"></BootstrapInputGroupLabel> |
| 73 | + <BootstrapInputGroupLabel DisplayText="@Localizer["SpeedLabel"]"></BootstrapInputGroupLabel> |
61 | 74 | <BootstrapInputGroupLabel DisplayText="@Tag1"></BootstrapInputGroupLabel> |
62 | 75 | <Display @bind-Value="@_tagValue3"></Display> |
63 | 76 | </BootstrapInputGroup> |
64 | 77 | </div> |
65 | 78 | <div class="col-12 col-sm-6"> |
66 | 79 | <BootstrapInputGroup> |
67 | | - <BootstrapInputGroupLabel DisplayText="流速"></BootstrapInputGroupLabel> |
| 80 | + <BootstrapInputGroupLabel DisplayText="@Localizer["FlowLabel"]"></BootstrapInputGroupLabel> |
68 | 81 | <BootstrapInputGroupLabel DisplayText="@Tag2"></BootstrapInputGroupLabel> |
69 | 82 | <Display @bind-Value="@_tagValue4"></Display> |
70 | 83 | </BootstrapInputGroup> |
71 | 84 | </div> |
72 | 85 | <div class="col-12 col-sm-6"> |
73 | | - <Button OnClick="OnCreateSubscription" Text="订阅" IsDisabled="@(!OpcDaServer.IsConnected || _subscribed)"></Button> |
74 | | - <Button OnClick="OnCancelSubscription" Text="取消" IsDisabled="!_subscribed"></Button> |
| 86 | + <Button OnClick="OnCreateSubscription" Text="@Localizer["SubscribeButtonText"]" IsDisabled="@(!OpcDaServer.IsConnected || _subscribed)"></Button> |
| 87 | + <Button OnClick="OnCancelSubscription" Text="@Localizer["CancelButtonText"]" IsDisabled="!_subscribed"></Button> |
75 | 88 | </div> |
76 | 89 | </p> |
77 | 90 |
|
78 | | - <p class="code-label">4. 浏览</p> |
79 | | - <p>通过调用 <code>OpcDaServer</code> 的 <code>Browse</code> 方法可以构建一个节点树状结构</p> |
| 91 | + <p class="code-label">@Localizer["Step4Title"]</p> |
| 92 | + <p>@((MarkupString)Localizer["Step4Text"].Value)</p> |
80 | 93 | <p> |
81 | | - <Button OnClick="OnBrowse" Text="浏览" IsDisabled="!OpcDaServer.IsConnected"></Button> |
| 94 | + <Button OnClick="OnBrowse" Text="@Localizer["BrowseButtonText"]" IsDisabled="!OpcDaServer.IsConnected"></Button> |
82 | 95 | </p> |
83 | 96 | <p> |
84 | 97 | <TreeView Items="_roots" AutoCheckChildren="true" AutoCheckParent="true" ShowIcon="true" |
|
0 commit comments