Beispiel #1
0
        private byte[] GetPage(ulong address)
        {
            byte[]   buffer      = new byte[4096];
            uint     error       = GetLastError();
            IntPtr   procAddress = GetProcAddress(_helperLib, "ReadPage");
            ReadPage rp          = (ReadPage)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ReadPage));
            int      result      = rp(address, buffer);

            if (result == 0)
            {
                return(buffer);
            }
            return(null);
        }
Beispiel #2
0
        private async void OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            if (e.Item == null)
            {
                return;
            }

            ListNode selected = e.Item as ListNode;

            if (selected.Children == true)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    UserDialogs.Instance.ShowLoading();
                });


                storedTree = await Task.Run(() =>
                {
                    Task.Delay(200).Wait();
                    return(client.GetChildren(selected.Id));
                });

                Device.BeginInvokeOnMainThread(() =>
                {
                    UserDialogs.Instance.HideLoading();
                });
                hierarchyAddressSpace.Push(storedTree);
                hierarchyStringAddressSpace.Push(selected.NodeName);
                ParentNodeEntry.Text   = selected.NodeName;
                ParentLayout.IsVisible = true;
                DisplayNodes();
            }
            else
            {
                await DisplayAlert("Info", "There are no children for this node!", "Ok");

                if (selected.NodeClass.Equals("Variable"))
                {
                    if (useMode)
                    {
                        var selection = await DisplayActionSheet("Select Action: ", "cancel", null, "Read", "Write");

                        if (selection.Equals("Read"))
                        {
                            ContentPage readPage = new ReadPage(client, selected.Id);
                            readPage.Title = "OPC Read Service";
                            await Navigation.PushAsync(readPage);

                            Navigation.RemovePage(this);
                        }
                        else if (selection.Equals("Write"))
                        {
                            ContentPage writePage = new WritePage(client, selected.Id);
                            writePage.Title = "OPC Write Service";
                            await Navigation.PushAsync(writePage);

                            Navigation.RemovePage(this);
                        }
                    }
                    else
                    {
                        var choice = await DisplayAlert("Info", "Do you want to create a monitored item for this variable node?", "yes", "no");

                        if (choice)
                        {
                            MessagingCenter.Send <BrowsePage, string> (this, "update", selected.Id);
                            Navigation.RemovePage(this);
                        }
                    }
                }
            }
        }
Beispiel #3
0
 public void LoadSubPage()
 {
     this.SubPage = new ReadPage(this.Style, Deep, this.Config);
     this.SubPage.SetUpperDataName(this.DataName, FieldType.read_value);
     this.subLsitMethod = this.SubPage.GetListMethods(this.DataName);
 }
Beispiel #4
0
        public App()
        {
            InitializeComponent();

            MainPage = new ReadPage();
        }