Ejemplo n.º 1
0
        private async void OptCommon_Click(object sender, RoutedEventArgs e)
        {
            ToggleMenuFlyoutItem[] opts = new ToggleMenuFlyoutItem[] { optCommonLink, optCommonWifi, optCommonMail, optCommonGeo, optCommonContact, optCommonEvent };
            var btn = sender as ToggleMenuFlyoutItem;

            foreach (ToggleMenuFlyoutItem opt in opts)
            {
                if (opt == btn)
                {
                    opt.IsChecked = true;
                }
                else
                {
                    opt.IsChecked = false;
                }
            }

            int selectedIndex = 0;

            if (sender == optCommonLink)
            {
                selectedIndex = 0;
            }
            else if (sender == optCommonWifi)
            {
                selectedIndex    = 1;
                ContentPage.SSID = await WIFI.GetNetwoksSSID();
            }
            else if (sender == optCommonMail)
            {
                selectedIndex = 2;
            }
            else if (sender == optCommonGeo)
            {
                selectedIndex = 3;
            }
            else if (sender == optCommonContact)
            {
                selectedIndex = 4;
            }
            else if (sender == optCommonEvent)
            {
                selectedIndex = 5;
            }
            if (selectedIndex >= 0)
            {
                ContentPage.SelectedIndex = selectedIndex;

                if (CURRENT_USINGDIALOG)
                {
                    edContent.Items.Clear();
                    edQR.Visibility = Visibility.Visible;

                    var dlgCommon = new CommonQRDialog();
                    dlgCommon.Items.Clear();
                    dlgCommon.Items.Add(ContentPage.SelectedItem);
                    var dlgResult = await dlgCommon.ShowAsync();

                    if (dlgResult == ContentDialogResult.Primary)
                    {
                        edQR.Text    = ContentPage.GetContents();
                        imgQR.Source = edQR.Text.EncodeQR(CURRENT_FGCOLOR, CURRENT_BGCOLOR, CURRENT_ECL);
                    }
                    dlgCommon.Items.Clear();
                }
                else
                {
                    edQR.Visibility = Visibility.Collapsed;
                    edContent.Items.Clear();
                    edContent.Items.Add(ContentPage.SelectedItem);
                }
            }
        }