Esempio n. 1
0
        public App()
        {
            PositionToStringValueConverter positionConverter = new PositionToStringValueConverter();

            // This app main page is a Circle Page
            var page = new CirclePage();

            // With a Circle List View as the only component
            var circleListView = new CircleListView
            {
                // Items on this list view are coming from a predefined pins list (check Pins.cs)
                ItemsSource = Pins.Predefined,
                // Each item on the list has two visual elements:
                ItemTemplate = new DataTemplate(() =>
                {
                    var cell = new TextCell();
                    // a Label (e.g. Rome)
                    cell.SetBinding(TextCell.TextProperty, "Label");
                    // and its coordinates.
                    cell.SetBinding(TextCell.DetailProperty, "Position", converter: positionConverter);
                    return(cell);
                }),
            };

            circleListView.ItemTapped += CircleListView_ItemTapped;
            page.Content           = circleListView;
            page.RotaryFocusObject = circleListView;
            NavigationPage.SetHasNavigationBar(page, false);
            MainPage = new NavigationPage();
            MainPage.Navigation.PushAsync(page, false);
        }
Esempio n. 2
0
        public App()
        {
            label = new Label
            {
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                Text = "Welcome to Xamarin Forms!"
            };

            button = new Button
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text = "Start service",
            };
            button.Clicked += OnButtonClicked;

            // The root page of your application
            MainPage = new CirclePage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        label,
                        button
                    }
                }
            };
        }
        public App()
        {
            Tizen.Log.Debug("PATH", _htmlFilePath);

            //Load file and set the file contents as HtmlWebViewSource object property
            var htmlSource = new HtmlWebViewSource();

            //html file contents to play with via c# code
            string html = File.ReadAllText(_htmlFilePath);

            //setting htmlsource html as the html string readed from file
            if (File.Exists(_htmlFilePath))
            {
                htmlSource.Html = html;
            }


            // Create new page and add WebView with htmlSource as source
            MainPage = new CirclePage
            {
                Content = new WebView
                {
                    Source        = htmlSource,
                    HeightRequest = 2000, //You can play with different values here
                    WidthRequest  = 2000,
                    Scale         = 0.5   //Scale does work bad because it does not only resizes the content but the whole frame as well
                }
            };
        }
Esempio n. 4
0
        public App()
        {
            // Initiate database first.
            initiateSQLite();
            // Get items in the Item table.
            var           itemList = dbConnection.Table <Item>();
            List <string> dbList   = new List <string>();

            dbList.Add("Rows in Item table:");
            // Add to itemList to be used as ItemsSource in a CircleListView.
            foreach (var item in itemList)
            {
                dbList.Add("Row " + item.Id + ": " + item.Time);
            }

            // The root page of your application
            MainPage = new CirclePage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        new CircleListView
                        {
                            ItemsSource = dbList
                        }
                    }
                }
            };
        }
Esempio n. 5
0
        /// <summary>
        /// Sets initial application page
        /// </summary>
        public App()
        {
            ScanBtn = new Button
            {
                Text = "BLE Scan",
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            ScanBtn.Clicked += OnScanButtonClicked;

            var nameLabel = new Label
            {
                Text = "LE Scanner",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            CirclePage content = new CirclePage
            {
                Content = new StackLayout
                {
                    Spacing         = 20,
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        nameLabel,
                        ScanBtn
                    }
                },
            };

            NavigationPage.SetHasNavigationBar(content, false);

            MainPage = new NavigationPage(content);
        }
Esempio n. 6
0
        public App()
        {
            Label label = new Label
            {
                HorizontalTextAlignment = TextAlignment.Center,
                Text = "미로찾기를 시작합니다."
            };

            Button button =
                new Button
            {
                Text              = "TOUCH",
                FontSize          = 7,
                WidthRequest      = 110,
                HorizontalOptions = LayoutOptions.Center
            };

            button.Clicked += new EventHandler(button_Clicked);

            // The root page of your application
            MainPage = new CirclePage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        label, button
                    }
                }
            };
        }
Esempio n. 7
0
        public App()
        {
            try
            {
                MessagePort messagePort = null;
                messagePort = new MessagePort(uiAppPortName, true);
                // You need to first call Listen even you need to send a message.
                messagePort.Listen();
                // Register MessageReceived event callback
                messagePort.MessageReceived += (s, e) => {
                    Console.WriteLine("UI application received a message");
                    if (e.Message.Contains("greetingReturn"))
                    {
                        Toast.DisplayText("Received:" + e.Message.GetItem("greetingReturn") + ", Array: " + BitConverter.ToInt32((byte[])e.Message.GetItem("intByteArray"), 0));
                    }
                };

                // The root page of your application
                MainPage = new CirclePage
                {
                    Content = new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Children        =
                        {
                            new Label
                            {
                                HorizontalTextAlignment = TextAlignment.Center,
                                Text = "Talk over message port APIs"
                            },
                            new Button
                            {
                                Text    = "Send a message",
                                Command = new Command(() =>
                                {
                                    Bundle bundleToSend = new Bundle();
                                    bundleToSend.AddItem("greeting", "hello");
                                    bundleToSend.AddItem("intByteArray", BitConverter.GetBytes(1024 * 1024));

                                    try
                                    {
                                        // Need to call Listen() before calling Send
                                        messagePort.Send(bundleToSend, "org.tizen.example.ServiceApp", serviceAppPortName, false);
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine("Exception: " + e.Message + ", " + e);
                                        Toast.DisplayText("An exception occurs!!   " + e.Message + ",   " + e, 10000);
                                    }
                                })
                            }
                        }
                    }
                };
            } catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Esempio n. 8
0
        public void showDetails(Object sender, ItemTappedEventArgs e)
        {
            TagDescBind tdb  = e.Item as TagDescBind;
            String      time = tdb.detailDesc.Substring(0, 8);
            String      date = cCurrTime.ToString("yyyy-MM-dd").Substring(5);
            String      amount;

            if (tdb.detailDesc.Contains("M"))
            {
                amount = tdb.detailDesc.Substring(10);
            }
            else
            {
                amount = tdb.detailDesc.Substring(8);
            }
            deleteId          = tdb.id;
            DeleteBtnClicked += deleteClickedFunc;
            Label dateLabel = new Label()
            {
                Text = date, HorizontalTextAlignment = TextAlignment.Center, FontSize = 8
            };
            Label timeLabel = new Label()
            {
                Text = time.Substring(0, 5) + " | " + tdb.tagDesc, HorizontalTextAlignment = TextAlignment.Center, FontSize = 10
            };
            Label descLabel = new Label()
            {
                Text = tdb.descDesc, HorizontalTextAlignment = TextAlignment.Center, FontSize = 7
            };
            Label amountLabel = new Label()
            {
                Text = amount,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize  = 20,
                TextColor = amount.Contains("+") ? Color.Green : Color.Red,
            };
            Button deleteBtn = new Button()
            {
                Text            = "删除",
                TextColor       = Color.Red,
                BackgroundColor = Color.Transparent,
            };

            deleteBtn.Clicked += DeleteBtnClicked;
            StackLayout sl = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.Center,
                Children        = { dateLabel, timeLabel, descLabel, amountLabel, deleteBtn },
            };
            CirclePage cp = new CirclePage()
            {
                Content = sl
            };

            Navigation.PushModalAsync(cp);
        }
Esempio n. 9
0
        ///<summary>
        /// Called after tapping device from DeviceListView.
        /// Creates new CirclePage with list of tapped device
        /// service UUIDs.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event arguments</param>
        public async void DeviceTapped(object sender, ItemTappedEventArgs e)
        {
            if (e.Item != null)
            {
                Device device = e.Item as Device;

                if (UuidListView == null)
                {
                    CreateUUIDListView();
                }
                UuidList.Clear();

                CirclePage content = new CirclePage
                {
                    RotaryFocusObject = UuidListView,
                    Content           = new StackLayout
                    {
                        Padding = new Thickness(0, 30),

                        Children =
                        {
                            GattLabel,
                            UuidListView,
                        }
                    },
                };
                NavigationPage.SetHasNavigationBar(content, false);

                GattLabel.Text = "GattConnect\n" +
                                 "initiated";
                GattLabel.HorizontalTextAlignment = TextAlignment.Center;

                UuidPage = content;
                await MainPage.Navigation.PushAsync(UuidPage);

                device.Ledevice.GattConnectionStateChanged += Device_GattConnectionStateChanged;

                GattClient = device.Ledevice.GattConnect(false);
                await WaitStateChangedFlag();

                GattLabel.Text = "GattConnected";

                foreach (BluetoothGattService srv in GattClient.GetServices())
                {
                    UuidList.Add(srv.Uuid);
                }

                UuidListView.ItemsSource = null; // Refreshing does not work without it
                UuidListView.ItemsSource = UuidList;
                GattClientExit(device.Ledevice);
            }
        }
Esempio n. 10
0
        private void tagClickedFunc(Object sender, EventArgs e)
        {
            TagProvider tp = new TagProvider();
            Dictionary <string, string> d = tp.getAllTag();
            int tagCount = tp.getNum();
            var tagGroup = new List <IconDescBind>();

            foreach (string key in d.Keys)
            {
                tagGroup.Add(new IconDescBind {
                    path = key, tagDesc = d[key]
                });
            }
            DataTemplate dt = new DataTemplate(() =>
            {
                var icon = new Image()
                {
                    HorizontalOptions = LayoutOptions.End
                };
                var tagDescLable = new Label()
                {
                    HorizontalTextAlignment = TextAlignment.Center
                };
                //var space = new Label() { Text = "    " };
                icon.SetBinding(Image.SourceProperty, "path");
                tagDescLable.SetBinding(Label.TextProperty, "tagDesc");
                StackLayout sl = new StackLayout()
                {
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.Center,
                    Children          = { icon, tagDescLable, }
                };
                return(new ViewCell {
                    View = sl
                });
            });
            CircleListView clv = new CircleListView
            {
                ItemsSource       = tagGroup,
                ItemTemplate      = dt,
                HorizontalOptions = LayoutOptions.Center,
            };

            clv.ItemTapped += TagTapped;
            cp              = new CirclePage()
            {
                Content = clv
            };
            //np.PushAsync(cp);
            Navigation.PushModalAsync(cp);
        }
Esempio n. 11
0
        private void OnButtonClick(Object sender, EventArgs e)
        {
            StackLayout descEntryLayout = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.Center,
                Children        = { desc, submit },
            };
            //an optional input description page
            CirclePage descEntryPage = new CirclePage()
            {
                Content = descEntryLayout,
            };

            Navigation.PushModalAsync(descEntryPage);
        }
Esempio n. 12
0
 public App()
 {
     // The root page of your application
     MainPage = new CirclePage
     {
         Content = new StackLayout
         {
             VerticalOptions = LayoutOptions.Center,
             Children        =
             {
                 new Label {
                     HorizontalTextAlignment = TextAlignment.Center,
                     Text = "Welcome to Xamarin Forms!"
                 }
             }
         }
     };
 }
Esempio n. 13
0
 public App()
 {
     // The root page of your application
     MainPage = new CirclePage
     {
         Content = new StackLayout
         {
             VerticalOptions = LayoutOptions.Center,
             Children        =
             {
                 new Label {
                     HorizontalTextAlignment = TextAlignment.Center,
                     Text = "Check WorldClockWidget2 web widget installed with this app"
                 }
             }
         }
     };
 }
Esempio n. 14
0
 public App()
 {
     // The root page of your application
     MainPage = new CirclePage
     {
         Content = new StackLayout
         {
             VerticalOptions = LayoutOptions.Center,
             Children        =
             {
                 new Label
                 {
                     HorizontalTextAlignment = TextAlignment.Center,
                     Text = "Launch other applications using app control"
                 },
                 new Button
                 {
                     Text    = "Launch",
                     Command = new Command(async() =>
                     {
                         try {
                             // Launch with app control APIs
                             Tizen.Applications.AppControl.SendLaunchRequest(
                                 new Tizen.Applications.AppControl
                             {
                                 ApplicationId = "org.tizen.example.AppInformation",
                                 LaunchMode    = Tizen.Applications.AppControlLaunchMode.Single,
                             }, (launchRequest, replyRequest, result) =>
                             {
                                 Console.WriteLine("Put your code for appcontrol callback method.");
                             });
                         }
                         catch (Exception e)
                         {
                             Console.WriteLine("Error : " + e.Message + ", " + e.Source + ", " + e.StackTrace);
                             await MainPage.DisplayAlert("Error", e.Message + "\nPlease satisfy the prerequisites(install AppInformation app to launch", "OK");
                         }
                     })
                 }
             }
         }
     };
 }
Esempio n. 15
0
        public App()
        {
            // The root page of your application
            MainPage = new CirclePage();
            StackLayout mainStack = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center,
            };

            Tizen.Applications.Application app = Tizen.Applications.Application.Current;
            CircleListView clView      = new CircleListView();
            List <string>  appInfoList = new List <string>();

            // ApplicationInfo
            appInfoList.Add("ApplicationInfo: ");

            appInfoList.Add("AppID: " + app.ApplicationInfo.ApplicationId);
            appInfoList.Add("AppType: " + app.ApplicationInfo.ApplicationType);
            appInfoList.Add("ExePath: " + app.ApplicationInfo.ExecutablePath);
            appInfoList.Add("PackageId: " + app.ApplicationInfo.IconPath);
            appInfoList.Add("SharedResourcePath: " + app.ApplicationInfo.SharedResourcePath);
            appInfoList.Add("SharedTrustedPath: " + app.ApplicationInfo.SharedTrustedPath);

            // DirectoryInfo
            appInfoList.Add("DirectoryInfo: ");

            appInfoList.Add("Resource: " + app.DirectoryInfo.Resource);
            appInfoList.Add("Cache: " + app.DirectoryInfo.Cache);
            appInfoList.Add("Data: " + app.DirectoryInfo.Data);
            appInfoList.Add("ExpansionPackageResource: " + app.DirectoryInfo.ExpansionPackageResource);
            appInfoList.Add("ExternalCache: " + app.DirectoryInfo.ExternalCache);
            appInfoList.Add("ExternalData: " + app.DirectoryInfo.ExternalData);
            appInfoList.Add("ExternalSharedData: " + app.DirectoryInfo.ExternalSharedData);
            appInfoList.Add("SharedResource: " + app.DirectoryInfo.SharedResource);
            appInfoList.Add("SharedTrusted: " + app.DirectoryInfo.SharedTrusted);
            appInfoList.Add("SharedData: " + app.DirectoryInfo.SharedData);

            clView.ItemsSource = appInfoList;
            mainStack.Children.Add(clView);
            ((CirclePage)MainPage).Content = mainStack;
        }
Esempio n. 16
0
        public App()
        {
            var button = new Button
            {
                Text = "Share you system images!",
            };

            button.Clicked += UploadSystemImages;

            MainPage = new CirclePage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        button
                    }
                }
            };
        }
Esempio n. 17
0
        /// <summary>
        /// Creates a CirclePage with list of detected LE devices.
        /// </summary>
        public async void RenderDevicePage()
        {
            if (DeviceListView == null)
            {
                CreateDeviceListView();
            }

            ScanLabel.Text = "Scanning";
            ScanLabel.HorizontalOptions = LayoutOptions.Center;

            CirclePage content = new CirclePage
            {
                RotaryFocusObject = DeviceListView,
                Content           = new StackLayout
                {
                    Padding           = new Thickness(0, 30),
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    Children          =
                    {
                        ScanLabel,
                        DeviceListView,
                    }
                },
            };

            NavigationPage.SetHasNavigationBar(content, false);

            DevicePage = content;

            await MainPage.Navigation.PushAsync(DevicePage);

            await LeScanSetup();

            ScanLabel.Text             = "Scan completed";
            DeviceListView.ItemsSource = null; // Refreshing does not work without it
            DeviceListView.ItemsSource = DeviceList;
        }
Esempio n. 18
0
 public App()
 {
     // The root page of your application
     MainPage = new CirclePage
     {
         Content = new StackLayout
         {
             VerticalOptions = LayoutOptions.Center,
             Children        =
             {
                 new Label
                 {
                     HorizontalTextAlignment = TextAlignment.Center,
                     Text = "Launch other applications using app control"
                 },
                 new Button
                 {
                     Text    = "Launch",
                     Command = new Command(() =>
                     {
                         // Launch with app control APIs
                         Tizen.Applications.AppControl.SendLaunchRequest(
                             new Tizen.Applications.AppControl
                         {
                             ApplicationId = "org.tizen.example.AppInformation",
                             LaunchMode    = Tizen.Applications.AppControlLaunchMode.Single,
                         }, (launchRequest, replyRequest, result) =>
                         {
                             System.Diagnostics.Debug.WriteLine("Put your code for appcontrol callback method.");
                         });
                     })
                 }
             }
         }
     };
 }
Esempio n. 19
0
        private async Task GoToCirclePage()
        {
            var circlePage = new CirclePage {
                ActionButton = new ActionButtonItem()
            };

            circlePage.ActionButton.Clicked += async(sender, args) =>
            {
                // ignore this bad code
                await Device.InvokeOnMainThreadAsync(async() => { await ButtonWorker(); }).ConfigureAwait(false);
            };

            var profileEditView = new CircleStackLayout
            {
                Padding           = new Thickness(0, 25, 0, 70),
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new Label
                    {
                        FontSize = 8,
                        HorizontalTextAlignment = TextAlignment.Center,
                        BackgroundColor         = Color.Black,
                        Text = "CirclePage",
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            new Label      {
                                VerticalOptions = LayoutOptions.Center, FontSize = 12, Text = "🗺:"
                            },
                            new PopupEntry {
                                Text = "abc"
                            }
                        }
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            new Label      {
                                VerticalOptions = LayoutOptions.Center, FontSize = 12, Text = "🗺:"
                            },
                            new PopupEntry {
                                Text = "abc"
                            }
                        }
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            new Label      {
                                VerticalOptions = LayoutOptions.Center, FontSize = 12, Text = "🗺:"
                            },
                            new PopupEntry {
                                Text = "abc"
                            }
                        }
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            new Label      {
                                VerticalOptions = LayoutOptions.Center, FontSize = 12, Text = "🗺:"
                            },
                            new PopupEntry {
                                Text = "abc"
                            }
                        }
                    }
                }
            };

            var profileEditScrollView = new CircleScrollView {
                Content = profileEditView
            };

            circlePage.Content = profileEditScrollView;
            MainPage           = circlePage;

            async Task ButtonWorker() => await GoToContentPage().ConfigureAwait(false);

            circlePage.ActionButton.Text = "To ContentPage";
        }