Inheritance: Windows.UI.Xaml.Controls.Primitives.ToggleButton, ICheckBox
 private void addChoices(SurveyQuestion p_targetQuestion)
 {
     switch (p_targetQuestion.Type)
     {
         case "radio":
             foreach (var choice in p_targetQuestion.Choices)
             {
                 RadioButton rb = new RadioButton();
                 rb.Content = choice.Text;
                 rb.Margin = new Thickness(20);
                 rb.Foreground = new SolidColorBrush(Color.FromArgb(0, 3, 22, 52));
                 this.ChoiceArea.Children.Add(rb);
             }
             break;
         case "check":
             foreach (var choice in p_targetQuestion.Choices)
             {
                 CheckBox cb = new CheckBox();
                 cb.Content = choice.Text;
                 cb.Margin = new Thickness(20);
                 cb.Foreground = new SolidColorBrush(Color.FromArgb(255, 3, 22, 52));
                 cb.Width = 350;
                 this.ChoiceArea.Children.Add(cb);
             }
             break;
         default:
             break;
     }
 }
        private void CreateControl()
        {
            var grid = new Grid();

            var margin = new Thickness {Top = 24};

            grid.Margin = margin;

            var distinctEdgesCheckBox = new CheckBox {Margin = margin, VerticalAlignment = VerticalAlignment.Center};

            var padding = new Thickness {Left = 12, Right = 12};
            distinctEdgesCheckBox.Padding = padding;

            var textBlock = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = _resourceLoader.GetString("DistinctEdges/Text")
            };

            distinctEdgesCheckBox.Content = textBlock;
            distinctEdgesCheckBox.IsChecked = Filter.DistinctEdges;
            distinctEdgesCheckBox.Checked += distinctEdgesCheckBox_Checked;
            distinctEdgesCheckBox.Unchecked += distinctEdgesCheckBox_Unchecked;

            var rowDefinition = new RowDefinition {Height = GridLength.Auto};
            grid.RowDefinitions.Add(rowDefinition);

            var columnDefinition = new ColumnDefinition {Width = GridLength.Auto};
            grid.ColumnDefinitions.Add(columnDefinition);

            grid.Children.Add(distinctEdgesCheckBox);

            Control = grid;
        }
         private void MeuLayout()
         {
             CheckBox MeuCheckBox = new CheckBox();

             MeuCheckBox.Width = 70;
             MeuCheckBox.Height = 70;
             MeuCheckBox.Content = "Executa";
             MeuCheckBox.Name = "x:MeuCheckBox";
             MeuCheckBox.Click += btnExecuta_Click;
             MeuStackPanel.Children.Add(MeuCheckBox);
         }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (ValueConverterCs.Common.LayoutAwarePage)this.FindName("pageRoot");
            showCheckBox = (Windows.UI.Xaml.Controls.CheckBox)this.FindName("showCheckBox");
        }
 public override FrameworkElement buildFieldView()
 {
     CheckBox checkBox = new CheckBox();
     checkBox.FontSize = getSkin().getFieldFontSize();
     checkBox.Foreground = new SolidColorBrush(getSkin().getFieldColor());
     if (getField().getFieldInfo().isReadOnly())
     {
         checkBox.IsEnabled = false;
     }
     return checkBox;
 }
Exemple #6
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 100; i++)
                                {
                                    CheckBox chb = new CheckBox();
                                    chb.Name = string.Format("Task{0}", i);

                                }
                                    if (taskInput != null)
                                        taskOutput.Text = taskOutput.Text + "\n" + taskInput.Text;
                                    Task1.Visibility = Visibility.Visible;
                                    deadlineOutput.Text = deadlineOutput.Text + "\n" + deadlineInput.Text;
        }
        public SymbolUserControl(YouMapsSymbol youmapsSymbol)
        {
            CheckBoxEverything = new CheckBox();
            SymbolNameText = new TextBlock();
            EditRadioButton = new RadioButton();

            this.InitializeComponent();
            this.YouMapsSymbol = youmapsSymbol;
            SymbolNameText.Text = youmapsSymbol.Name;
            SymbolNameText.FontSize = 30;
            ControlStackpanel.Children.Add(CheckBoxEverything);
            ControlStackpanel.Children.Add(SymbolNameText);
            ControlStackpanel.Children.Add(EditRadioButton);
        }
        public object GetContent(ButtonConfig okButtonConfig)
        {
            var stackpanel = new StackPanel();
            
            var label = new TextBlock();
            label.Text = "Do you agree?";
            stackpanel.Children.Add(label);

            var checkBox = new CheckBox();
            checkBox.Checked += (o, args) => { okButtonConfig.IsEnabled = checkBox.IsChecked.HasValue && checkBox.IsChecked.Value; };
            stackpanel.Children.Add(checkBox);
 
            return stackpanel;
        }
        public AddService()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
            for (int i = 0; i < Services.allServices.Count; i++)
            {
                CheckBox checkBox1 = new CheckBox();
                checkBox1.Click += CheckHandler;
                checkBox1.Content = (new Uri(Services.allServices.ElementAt(i).Item1).Host.ToUpper().Trim().Replace("WWW.", "")).ToString();
                ListServices.Items.Add(checkBox1);
            }
        }
 /// <summary>
 /// 加载时 加载标签
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void AddWZDialog_Loaded(object sender, RoutedEventArgs e)
 {
     string[] tags = await UserService.GetWZTags();
     if (tags != null)
     {
         foreach (string tag in tags)
         {
             CheckBox ch = new CheckBox();
             ch.Content = tag;
             ch.Padding = new Thickness(0);
             ch.FontSize = 13;
             ch.VerticalContentAlignment = VerticalAlignment.Center;
             ch.Click += Ch_Click;
             Tags.Children.Add(ch);
         }
     }
 }
        private void Button_OnClick_ContentCallout(object sender, RoutedEventArgs e)
        {
            var callout = SimpleIoc.Default.GetInstance<ICallout>();

            var okButtonConfig = new ButtonConfig("I Agree", () => { Debug.WriteLine("Agreed!"); }, isEnabled: false);
            var cancelButtonConfig = new ButtonConfig("I Decline", () => { Debug.WriteLine("Disagreed!"); });
            var buttonConfigs = new[] { okButtonConfig, cancelButtonConfig };

            var panel = new StackPanel();
            panel.Children.Add(new TextBlock { Text = "This is a short message.", TextWrapping = TextWrapping.Wrap, });

            var checkBox = new CheckBox { Content = "Agree" };
            checkBox.Checked += (o, args) => { okButtonConfig.IsEnabled = true; };
            checkBox.Unchecked += (o, args) => { okButtonConfig.IsEnabled = false; };
            panel.Children.Add(checkBox);

            callout.Show("Content Callout", panel, buttonConfigs);
        }
 private void AddLedCheckBoxes()
 {
     for (var row = 0; row < 9; row++)
     {
         for (var col = 0; col < 9; col++)
         {
             var checkBox = new Windows.UI.Xaml.Controls.CheckBox
             {
                 Background = new SolidColorBrush(new Color {
                     A = 255, B = 255, G = 255, R = 255
                 })
             };
             Grid.SetRow(checkBox, row);
             Grid.SetColumn(checkBox, col);
             LedGrid.Children.Add(checkBox);
         }
     }
 }
        public async Task<IBinaryStateEndpoint> CreateDemoBinaryComponent(string caption)
        {
            IBinaryStateEndpoint result = null;

            await Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal,
                () =>
                {
                    var checkBox = new CheckBox();
                    checkBox.IsEnabled = false;
                    checkBox.Content = caption;

                    var endpoint = new CheckBoxBinaryStateEndpoint(checkBox);

                    DemoLampsStackPanel.Children.Add(checkBox);

                    result = endpoint;
                });

            return result;
        }
        private void ClearSelectedGroups()
        {
            foreach (GroupView item in list_group_delete.Items)
            {
                var check = listCheckedGroupIds.FirstOrDefault(l => l.Id.Equals(item.Id));
                if(check != null)
                    listCheckedGroupIds.Remove(check);

                item.IsChecked = false;

                ListViewItem ListBoxItemObj = (ListViewItem)list_group_delete.ContainerFromItem(item);

                if (ListBoxItemObj == null)
                    continue;

                var checkbox = MyUtils.FindChild<CheckBox>(ListBoxItemObj, "cbox_contact");
                if (checkbox != null)
                    checkbox.IsChecked = false;

                ListBoxItemObj.Background = new SolidColorBrush(Colors.Transparent);
            }

            CheckBox chkAll = new CheckBox();
            chkAll = (CheckBox)MyUtils.GetChildren(listview_group_header_delete).First(x => x.Name == "check_group_delete_all");
            chkStatusHeader = false;
            chkAll.Unchecked -= check_all_delete_UnChecked;
            chkAll.IsChecked = false;
            chkAll.Unchecked += check_all_delete_UnChecked;
        }
        private void ShowInfoSelectedGroups()
        {
            CheckBox chkAll = new CheckBox(); //(CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            if (listview_group_header_delete != null)
            {
                try
                {
                    chkAll = (CheckBox)MyUtils.GetChildren(listview_group_header_delete).First(x => x.Name == "check_group_delete_all");
                }
                catch { }
            }

            selectedItems = list_group_delete.Items.Where(l => ((GroupView)l).IsChecked == true).ToList().Count;

            if (selectedItems > 0)
            {
                btn_delete.IsEnabled = true;

                if (selectedItems == list_group_delete.Items.Count())
                {
                    chkAll.Checked -= check_all_group_delete_Checked;
                    chkAll.IsChecked = true;
                    chkStatusHeader = true;
                    chkAll.Checked += check_all_group_delete_Checked;
                }
                else
                {
                    chkStatusHeader = false;
                    chkAll.Unchecked -= check_all_delete_UnChecked;
                    chkAll.IsChecked = false;
                    chkAll.Unchecked += check_all_delete_UnChecked;
                }
            }
            else
            {
                btn_delete.IsEnabled = false;
                chkAll.IsChecked = false;
                chkStatusHeader = false;
            }
        }
Exemple #16
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            object obj = e.Parameter;
            if (null != obj)
            {
                string path = obj as string;
                imgPath = path;
                int index = 0;
                while (index >= 0)
                {
                    index = path.IndexOf('\\');
                    if (index >= 0)
                    {
                        path = path.Substring(index + 1);
                    }
                }
                index = path.IndexOf('.');
                if(index < 0)
                {
                    imageName = path;
                }
                else
                {
                    imageName = path.Substring(0, index);
                }
                
                
                StorageFile file = await StorageFile.GetFileFromPathAsync(imgPath);
                using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
                {
                    BitmapImage image = new BitmapImage();
                    image.SetSource(fileStream);
                    source = image;
                }
                InkCanvas inkCanvas = new InkCanvas();
                inkCanvas.InkPresenter.StrokeContainer.Clear();
                var stream = await file.OpenSequentialReadAsync();
                if (null != stream)
                {
                    try
                    {
                        await inkCanvas.InkPresenter.StrokeContainer.LoadAsync(stream);
                        if (inkCanvas.InkPresenter.StrokeContainer.GetStrokes().Count != 0)
                        {
                            isInkPic = true;
                        }
                    }
                    catch (Exception ex)
                    {
#if DEBUG
                        System.Diagnostics.Debug.WriteLine(ex.Message);
#endif
                        isInkPic = false;
                    }
                }
            }
            if (null != source)
            {
                ResourceDictionary dic = Application.Current.Resources;
                IList<ResourceDictionary> dics = dic.MergedDictionaries;
                ResourceDictionary resource = null;
                foreach(var item in dics)
                {
                    if(item.Source.AbsolutePath.Contains("/Files/Styles/Styles.xaml"))
                    {
                        resource = item;
                        break;
                    }

                }
                object style = null;
                if(null != resource)
                {
                                       
                    resource.TryGetValue("CheckBoxStyle", out style);
                }               

                ImageBrush brush = new ImageBrush();
                brush.ImageSource = source;
                //item 1
                GoodsPanel panel1 = new GoodsPanel();
                panel1.PictureWith = PicWidth;
                CheckBox check1 = new CheckBox();
                //check1.SetValue(StyleProperty,);
                check1.Checked += CheckBox_Checked;
                check1.Unchecked += CheckBox_Unchecked;
                if((style as Style) != null)
                {
                    check1.SetValue(StyleProperty, style);
                }
                panel1.Check = check1;
                panel1.PictureBrush = brush;
                panel1.GoodsName = "白杯子";
                panel1.Price = "¥35";
                panel1.PicturePath = imgPath;
                goodsPanels.Add(0,panel1);
                panel1.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
                panel1.SetValue(RelativePanel.AlignTopWithPanelProperty,true);
                goodsPanel.Children.Add(panel1);

                //item 2
                GoodsPanel panel2 = new GoodsPanel();
                panel2.PictureWith = PicWidth;
                CheckBox check2 = new CheckBox();
                //check1.SetValue(StyleProperty,);
                check2.Checked += CheckBox_Checked;
                check2.Unchecked += CheckBox_Unchecked;
                panel2.Check = check2;
                if ((style as Style) != null)
                {
                    check2.SetValue(StyleProperty, style);
                }
                panel2.PictureBrush = brush;
                panel2.GoodsName = "黑杯子";
                panel2.Price = "¥35";
                panel2.PicturePath = imgPath;
                goodsPanels.Add(1, panel2);
                panel2.SetValue(RelativePanel.RightOfProperty, panel1.Name);
                panel2.SetValue(RelativePanel.AlignTopWithPanelProperty, true);
                goodsPanel.Children.Add(panel2);

                //item 3
                GoodsPanel panel3 = new GoodsPanel();
                panel3.PictureWith = PicWidth;
                CheckBox check3 = new CheckBox();
                //check1.SetValue(StyleProperty,);
                check3.Checked += CheckBox_Checked;
                check3.Unchecked += CheckBox_Unchecked;
                panel3.Check = check3;
                if ((style as Style) != null)
                {
                    check3.SetValue(StyleProperty, style);
                }
                panel3.PictureBrush = brush;
                panel3.GoodsName = "白T恤";
                panel3.Price = "¥86";
                panel3.PicturePath = imgPath;
                goodsPanels.Add(2, panel3);
                panel3.SetValue(RelativePanel.RightOfProperty, panel2.Name);
                panel3.SetValue(RelativePanel.AlignTopWithPanelProperty, true);
                goodsPanel.Children.Add(panel3);

                //item 4
                GoodsPanel panel4 = new GoodsPanel();
                panel4.PictureWith = PicWidth;
                CheckBox check4 = new CheckBox();
                //check1.SetValue(StyleProperty,);
                check4.Checked += CheckBox_Checked;
                check4.Unchecked += CheckBox_Unchecked;
                panel4.Check = check4;
                if ((style as Style) != null)
                {
                    check4.SetValue(StyleProperty, style);
                }
                panel4.PictureBrush = brush;
                panel4.GoodsName = "黑T恤";
                panel4.Price = "¥86";
                panel4.PicturePath = imgPath;
                goodsPanels.Add(3, panel4);
                panel4.SetValue(RelativePanel.RightOfProperty, panel3.Name);
                panel4.SetValue(RelativePanel.AlignTopWithPanelProperty, true);
                goodsPanel.Children.Add(panel4);
                ResetPicturePanelPositon();
            }
        }
        private void CheckSelected()
        {
            try
            {
                totalSelectedContacts = listCheckedContactIds.Count();
                increaseContactLimitation = currentContactNumber + totalSelectedContacts;
                CheckBox chkAll = new CheckBox();
                if (listview_contacts_header != null)
                {
                    chkAll = (CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
                }

                if (increaseContactLimitation > ContactDB.MAX_LIMITATION)
                {
                    btnImportContacts.IsEnabled = false;
                    btnImportContactsNoFlyout.IsEnabled = false;
                    var errorStr = string.Format(UC_AddressBook.ResourcesStringLoader.GetString("exceed_max_limit_contact"), ContactDB.MAX_LIMITATION);
                    NotifyUser(errorStr, NotifyType.ErrorMessage);
                }
                else
                {
                    if (listCheckedContactIds.Count() > 0)
                    {
                        StatusPanel.Visibility = Visibility.Visible;
                        NotifyUser(string.Format("{0} contact(s) selected.", totalSelectedContacts), NotifyType.InformMessage);
                        btnImportContacts.IsEnabled = true;

                        if (increaseContactLimitation > ContactDB.MAX_CONTACT)
                        {
                            btnImportContacts.Visibility = Visibility.Visible;
                            btnImportContactsNoFlyout.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            btnImportContacts.Visibility = Visibility.Collapsed;
                            btnImportContactsNoFlyout.Visibility = Visibility.Visible;
                            btnImportContactsNoFlyout.IsEnabled = true;
                        }
                    }
                    else
                    {
                        btnImportContacts.IsEnabled = false;
                        btnImportContactsNoFlyout.IsEnabled = false;
                        StatusPanel.Visibility = Visibility.Collapsed;
                    }
                }

                if (totalSelectedContacts == listview_contacts.Items.Count())
                {
                    chkAll.IsChecked = true;
                }
                else
                {
                    chkAll.Unchecked -= chkStatusHeader_UnselectAll;
                    chkAll.IsChecked = false;
                    chkAll.Unchecked += chkStatusHeader_UnselectAll;
                }
                totalSelectedContacts = listCheckedContactIds.Count();
                increaseContactLimitation = currentContactNumber + totalSelectedContacts;
                tblockContactNumber.Text = increaseContactLimitation.ToString();
            }
            catch (Exception)
            {
                return;
            }
        }
        private void ShowInfoSelectedContacts()
        {
            CheckBox chkAll = new CheckBox(); //(CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            if (listview_contacts_header != null)
            {
                chkAll = (CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            }

            var selectedItems = listview_contacts.Items.Where(l => ((ContactView)l).IsChecked == true).ToList().Count;

            if (selectedItems == listview_contacts.Items.Count && selectedItems != 0)
            {
                if (chkAll != null)
                {
                    chkAll.Checked -= chkStatusHeader_SelectAll;
                    chkAll.IsChecked = true;
                    chkAll.Checked += chkStatusHeader_SelectAll;
                }
            }
            else
            {
                if (chkAll != null)
                {
                    chkStatusHeader = false;
                    chkAll.Unchecked -= chkStatusHeader_UnselectAll;
                    chkAll.IsChecked = false;
                    chkAll.Unchecked += chkStatusHeader_UnselectAll;
                }
            }

            CheckSelected();
        }
Exemple #19
0
        void CreateCellContent(DataGrid grid, DataGridPanel panel, Border bdr, CellRange rng)
        {
            // get row and column
            var r = panel.Rows[rng.Row];
            var c = panel.Columns[rng.Column];
            //var gr = r as GroupRow;

            // honor user templates (if the row has a backing data item)
            if (r.DataItem != null && c.CellTemplate != null && panel.CellType == CellType.Cell)
            {
                bdr.Padding = GetTemplatePadding(bdr.Padding);
                bdr.Child = GetTemplatedCell(grid, c.CellTemplate);
                return;
            }

            // get binding, unbound value for the cell
            var b = r.DataItem != null ? c.Binding : null;
            var ubVal = r.DataItem != null ? null : panel[rng.Row, rng.Column];

            // get foreground brush taking selected state into account
            var fore = GetForegroundBrush(grid, r, rng, grid.Foreground);

            // handle non-text types
            var type = c.DataType;
            TextBlock tb = null;
            CheckBox chk = null;
            if (// not a group, or hierarchical
                panel.CellType == CellType.Cell &&
                (type == typeof(bool) || type == typeof(bool?))) // and bool
            {
                // Boolean cells: use CheckBox
                chk = new CheckBox();
                chk.IsThreeState = type == typeof(bool?);
                chk.HorizontalAlignment = HorizontalAlignment.Center;
                chk.VerticalAlignment = VerticalAlignment.Center;
                chk.MinWidth = 32;

                chk.HorizontalAlignment = HorizontalAlignment.Stretch;
                chk.VerticalAlignment = VerticalAlignment.Stretch;
                chk.Margin = new Thickness(0, -10, 0, -10);

                chk.IsHitTestVisible = false;
                chk.IsTabStop = false;
                if (fore != null)
                {
                    chk.Foreground = fore;
                }

                bdr.Child = chk;
                if (b != null)
                {
                    chk.SetBinding(CheckBox.IsCheckedProperty, b);
                }
                else
                {
                    var value = ubVal as bool?;
                    chk.IsChecked = value;
                }
            }
            else
            {
                // use TextBlock for everything else (even empty cells)
                tb = new TextBlock();
                tb.VerticalAlignment = VerticalAlignment.Center;
                if (fore != null)
                {
                    tb.Foreground = fore;
                }
                bdr.Child = tb;

                // bound values
                if (b != null)
                {
                    // apply binding
                    tb.SetBinding(TextBlock.TextProperty, b);
                }
                else if (ubVal != null) // unbound values
                {
                    // get column format from column and/or binding
                    tb.Text = r.GetDataFormatted(c);
                }
            }

        }
 private void chkShowTracePanel_Loaded(object sender, RoutedEventArgs e)
 {
     chkShowTracePanel = sender as CheckBox;
 }
        //make sure the user wants to delete the playlist
        public async Task<bool> ShowPlaylistDeletionConfirmation(Playlist play)
        {
            bool disable = false;

            var dialog = new ContentDialog()
            {
                Title = "Confirm Deletion",
            };

            var panel = new StackPanel();
            var tb = new TextBlock
            {
                Text = "Deleting a playlist cannot be undone. Are you sure you want to proceed?",
            };

            var cb = new CheckBox
            {
                Content = "Disable confirmations for this session",
                Margin = new Windows.UI.Xaml.Thickness { Top = 10 }
            };

            panel.Children.Add(tb);
            panel.Children.Add(cb);
            dialog.Content = panel;

            dialog.PrimaryButtonText = "Delete";
            var cmd = new RelayCommand(() =>
            {
                disable = cb.IsChecked ?? false;
            });

            dialog.PrimaryButtonCommand = cmd;
            dialog.SecondaryButtonText = "Cancel";
            dialog.RequestedTheme = (ElementTheme) new Converters.BooleanToThemeConverter().Convert(Settings.UseDarkTheme,null,null,null);
            var result = await dialog.ShowAsync();
            if (result == ContentDialogResult.Primary)
            {
                if (disable)
                    ApplicationSettingsHelper.SaveSettingsValue("disableConfirmSession", true);
                return true;
            }
            return false;
        }
Exemple #22
0
        private void BuildControl(InputType type, string label, string placeholderText, double labelFontSize, double labelTranslateY, string groupName, ContentControl ccInput) {

            FrameworkElement fe = null;

            if (type == InputType.text)
            {
                var tb = new TextBox();
                tb.PlaceholderText = placeholderText;
                tb.Style = _GeneralTextBoxStyle;
                tb.KeyUp += ittext_KeyUp;

                _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment= VerticalAlignment.Top};
                _udfTBL1 = new TextBlock();
                _udfTBL1.Text = label;
                _udfTBL1.FontSize = labelFontSize;
                _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0);
                _udfg1.Visibility = Visibility.Collapsed;
                _udfg1.Children.Add(_udfTBL1);

                var gd = new Grid();
                gd.Children.Add(_udfg1);
                gd.Children.Add(tb);

                fe = gd;
            }
            else if (type == InputType.password)
            {
                

                var tb = new PasswordBox();
                tb.PlaceholderText = placeholderText;
                tb.Style = _GeneralPasswordBoxStyle;
                tb.PasswordChanged += itpassword_PasswordChanged;

                _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top };
                _udfTBL1 = new TextBlock();
                _udfTBL1.Text = label;
                _udfTBL1.FontSize = labelFontSize;
                _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0);
                _udfg1.Visibility = Visibility.Collapsed;
                _udfg1.Children.Add(_udfTBL1);

                var gd = new Grid();
                gd.Children.Add(_udfg1);
                gd.Children.Add(tb);

                fe = gd;
            }
            else if (type == InputType.checkbox)
            {
                var sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                
                var lb = new TextBlock();
                lb.Text = label;
                lb.FontSize = LabelFontSize;
                lb.Margin = new Thickness(0, LabelTranslateY, 0, 0);

                var cb = new CheckBox();
                cb.Checked += itcheckbox_Checked;
                cb.Content = lb;
                cb.Style = _GeneralCheckBoxStyle;
                sp.Children.Add(cb);

                fe = sp;
            }
            else if (type == InputType.radio)
            {
                var sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                
                var lb = new TextBlock();
                lb.Text = label;
                lb.FontSize = LabelFontSize;
                lb.Margin = new Thickness(0, LabelTranslateY, 0, 0);

                var rb = new RadioButton();
                rb.GroupName = groupName;
                rb.Checked += itradio_Checked;
                rb.Content = lb;
                rb.Style = _GeneralRadioButtonStyle;
                sp.Children.Add(rb);

                fe = sp;
            }


            fe.HorizontalAlignment = HorizontalAlignment.Stretch;
            fe.VerticalAlignment = VerticalAlignment.Stretch;
            ccInput.Content = fe;

        }
        private void ShowInfoSelectedContacts()
        {
            CheckBox chkAll = new CheckBox(); //(CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            if (listview_contacts_header != null && listview_contacts_header.Visibility == Visibility.Visible)
            {
                chkAll = (CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            }

            selectedItems = listview_contacts.Items.Where(l => ((ContactView)l).IsChecked == true).ToList().Count;

            if (selectedItems > 0)
            {
                btn_delete.IsEnabled = true;
                btn_group.IsEnabled = true;

                if (selectedItems == 1)
                {
                    btn_edit.IsEnabled = true;
                }
                else
                {
                    btn_edit.IsEnabled = false;
                }

                if (selectedItems == listview_contacts.Items.Count())
                {
                    chkAll.IsChecked = true;
                    chkAllNoHeader.IsChecked = true;
                    chkStatusHeader = true;
                }
                else
                {
                    chkStatusHeader = false;
                    chkAll.Unchecked -= chkStatusHeader_UnselectAll;
                    chkAll.IsChecked = false;
                    chkAll.Unchecked += chkStatusHeader_UnselectAll;

                    chkAllNoHeader.Unchecked -= chkAllNoHeader_Unchecked;
                    chkAllNoHeader.IsChecked = false;
                    chkAllNoHeader.Unchecked += chkAllNoHeader_Unchecked;
                }
            }
            else
            {
                btn_edit.IsEnabled = false;
                btn_delete.IsEnabled = false;
                btn_group.IsEnabled = false;
                chkAll.Unchecked -= chkStatusHeader_UnselectAll;
                chkAll.IsChecked = false;
                chkAll.Unchecked += chkStatusHeader_UnselectAll;
                chkStatusHeader = false;

                chkAllNoHeader.Unchecked -= chkAllNoHeader_Unchecked;
                chkAllNoHeader.IsChecked = false;
                chkAllNoHeader.Unchecked += chkAllNoHeader_Unchecked;
            }

            if (selectedItems != 0)
            {
                if (succeededMessage == string.Empty)
                {
                    isSelecting = true;
                    NotifyUser(string.Format("{0} contact(s) selected.", selectedItems), NotifyType.InformMessage);
                }
            }
            else
            {
                isSelecting = false;
                if (succeededMessage == string.Empty)
                    StatusPanel.Visibility = Visibility.Collapsed;
            }

            if(succeededMessage != string.Empty)
                NotifyUser(succeededMessage, NotifyType.StatusMessage);

            UpdateGUIWhenStopingProcess();
        }
Exemple #24
0
        private async void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            this.checkedItem = sender as CheckBox;

            await this.ShowMessage("Confirmation", "The selected order will be marked as delivered. Do you want to continue?");
        }
        private void ResetListView()
        {
            listCheckedContactIds.Clear();
            SetDefaultStyle();
            CheckBox chkAll = new CheckBox(); //(CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");
            if (listview_contacts_header != null)
            {
                chkAll = (CheckBox)MyUtils.GetChildren(listview_contacts_header).First(x => x.Name == "chkStatusHeader");

                if (chkAll != null)
                {
                    chkStatusHeader = false;
                    chkAll.Unchecked -= chkStatusHeader_UnselectAll;
                    chkAll.IsChecked = false;
                    chkAll.Unchecked += chkStatusHeader_UnselectAll;
                }
            }
        }
        private void CheckAll_Tapped(object sender, TappedRoutedEventArgs e)
        {
            TextBlock s = sender as TextBlock;
            string preName = s.Name.Substring(0, s.Name.IndexOf("_"));
            CheckBox cOne = new CheckBox();
            CheckBox cTwo = new CheckBox();
            CheckBox cThree = new CheckBox();
            CheckBox cFour = new CheckBox();
            CheckBox cFive = new CheckBox();
            CheckBox cSix = new CheckBox();

            if (preName == "i")
            {
                cOne = i_i;
                cTwo = i_ii;
                cThree = i_iii;
                cFour = i_iv;
                cFive = i_v;
                cSix = i_vi;
            }
            else if (preName == "ii")
            {
                cOne = ii_i;
                cTwo = ii_ii;
                cThree = ii_iii;
                cFour = ii_iv;
                cFive = ii_v;
                cSix = ii_vi;
            }
            else if (preName == "iii")
            {
                cOne = iii_i;
                cTwo = iii_ii;
                cThree = iii_iii;
                cFour = iii_iv;
                cFive = iii_v;
                cSix = iii_vi;
            }
            else if (preName == "iv")
            {
                cOne = iv_i;
                cTwo = iv_ii;
                cThree = iv_iii;
                cFour = iv_iv;
                cFive = iv_v;
                cSix = iv_vi;
            }
            else if (preName == "v")
            {
                cOne = v_i;
                cTwo = v_ii;
                cThree = v_iii;
                cFour = v_iv;
                cFive = v_v;
                cSix = v_vi;
            }
            else if (preName == "vi")
            {
                cOne = vi_i;
                cTwo = vi_ii;
                cThree = vi_iii;
                cFour = vi_iv;
                cFive = vi_v;
                cSix = vi_vi;
            }
            // check if all boxes are checked, if not check them all, if yes, uncheck all
            if ((bool)cOne.IsChecked && (bool)cTwo.IsChecked && (bool)cThree.IsChecked && (bool)cFour.IsChecked && (bool)cFive.IsChecked && (bool)cSix.IsChecked)
            {
                cOne.IsChecked = false;
                cTwo.IsChecked = false;
                cThree.IsChecked = false;
                cFour.IsChecked = false;
                cFive.IsChecked = false;
                cSix.IsChecked = false;
            }
            else
            {
                if (!(bool)cOne.IsChecked) { cOne.IsChecked = true; }
                if (!(bool)cTwo.IsChecked) { cTwo.IsChecked = true; }
                if (!(bool)cThree.IsChecked) { cThree.IsChecked = true; }
                if (!(bool)cFour.IsChecked) { cFour.IsChecked = true; }
                if (!(bool)cFive.IsChecked) { cFive.IsChecked = true; }
                if (!(bool)cSix.IsChecked) { cSix.IsChecked = true; }
            }
        }
Exemple #27
0
        /// <summary>
        /// Action when "settings" button is pressed, opens a content dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void settings_button_click(object sender, RoutedEventArgs e)
        {
            var dialog = new ContentDialog()
            {
                Title = "Settings",
                MaxWidth = this.ActualWidth // Required for Mobile
            };

            // Setup Content
            var panel = new StackPanel();

            panel.Children.Add(new TextBlock
            {
                Text = "Select the currency you want to use:",
                TextWrapping = TextWrapping.Wrap,
            });

            var cbEuro = new CheckBox
            {
                Content = "Euros"
            };
            
            var cbFt = new CheckBox
            {
                Content = "Forints"
            };

            var text = new TextBlock
            {
                Text = "Specify a monthly budget:"
            };

            var budget = new TextBox
            {
                Text = ""
            };
            var text2 = new TextBlock
            {
                Text = "Specify an alert threshold:"
            };

            var threshold = new TextBox
            {
                Text = ""
            };

            panel.Children.Add(cbEuro);
            panel.Children.Add(cbFt);
            panel.Children.Add(text);
            panel.Children.Add(budget);
            panel.Children.Add(text2);
            panel.Children.Add(threshold);
            dialog.Content = panel;
            
            dialog.PrimaryButtonText = "OK";
            dialog.PrimaryButtonClick += delegate
            {
                MainPage.budgetLeft = Convert.ToInt32(budget.Text);
                MainPage.budget = Convert.ToInt32(budget.Text);
                MainPage.threshold = Convert.ToInt32(threshold.Text);
                localSettings.Values["budget"] = Convert.ToInt32(budget.Text);
                localSettings.Values["budgetLeft"] = Convert.ToInt32(budget.Text);
                localSettings.Values["thresh"] = Convert.ToInt32(threshold.Text);
                if (cbEuro.IsChecked == true) // selected currency is euro
                {
                    MainPage.currency = 1;
                    localSettings.Values["currency"] = 1;
                    euro.Visibility = Visibility.Visible;
                    ft.Visibility = Visibility.Collapsed;
                }
                else // selected currency is forint
                {
                    MainPage.currency = 0;
                    localSettings.Values["currency"] = 0;
                    ft.Visibility = Visibility.Visible;
                    euro.Visibility = Visibility.Collapsed;
                }
                // update main page
                canvas_left.Visibility = Visibility.Visible;
                you_are_text.Visibility = Visibility.Visible;
                green_text.Visibility = Visibility.Visible;
                add_button.IsEnabled = true;
                thresh.Text += " " + budgetLeft;
                please.Visibility = Visibility.Collapsed;
            };

            dialog.SecondaryButtonText = "Cancel";
            dialog.SecondaryButtonClick += delegate { };

            var result = await dialog.ShowAsync();
        }
        public CheckBoxBinaryStateEndpoint(CheckBox checkBox)
        {
            if (checkBox == null) throw new ArgumentNullException(nameof(checkBox));

            _checkBox = checkBox;
        }
Exemple #29
0
        /// <summary>
        /// Updates the choosableCiv list to correspond user's options wether to include Gods & Kings expansion and/or DLC civilizations or not
        /// </summary>
        private void updateCivList()
        {
            //Empty the list before adding anything
            choosableCivs.Clear();

            //Empty the listbox that you see in the screen
            civListBox.Items.Clear();

            foreach (String str in basicCivs)
            {
                choosableCivs.Add(str);
            }

            if (GNK == true)
            {
                foreach (String str in GnKCivs)
                {
                    choosableCivs.Add(str);
                }
            }

            if (DLC == true)
            {
                foreach (String str in DLCcivs)
                {
                    choosableCivs.Add(str);
                }
            }

            // Add every item in choosableCivs list to screen
            foreach (String str in choosableCivs)
            {
                CheckBox item = new CheckBox();
                item.Content = str;
                civListBox.Items.Add(item);
            }
        }
 public async void notificar(CheckBox a, Tratamiento trata)
 {
     if(a.IsChecked==false)
     {
         ParseObject appointment = new ParseObject("Notificacion");
         appointment["Medico"] = trata.Medico;
         appointment["Paciente"] = usu.Id;
         appointment["Descripcion"] = "No ha tenido en cuenta la fecha de control del tratamiento : "+trata.NomTratamiento;
        
         await appointment.SaveAsync();
     }
    
 }
Exemple #31
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            goodsList.Clear();
            try
            {
                List<GoodsInfo> list = e.Parameter as List<GoodsInfo>;
                if (null != list)
                {
                    goodsList = list;
                }              
                Windows.Storage.StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
                Windows.Storage.StorageFile shoppingCartStorageFile = await storageFolder.GetFileAsync("ShoppingCart.xml");                
                XmlDocument doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(shoppingCartStorageFile);
                IXmlNode root = null;
                foreach (var item in doc.ChildNodes)
                {
                    if (item.NodeName.Equals("goods"))
                    {
                        root = item;
                        break;
                    }
                }
                if (null != root)
                {
                    foreach (var goods in root.ChildNodes)
                    {
                        if (goods.NodeName.Equals("item"))
                        {
                            string imgUrl = goods.SelectSingleNode("img").InnerText;
                            string singlePrice = goods.SelectSingleNode("price").InnerText;
                            string name = goods.SelectSingleNode("productName").InnerText;
                            string count = goods.SelectSingleNode("count").InnerText;
                            string imagename = goods.SelectSingleNode("imageName").InnerText;
                            bool exist = false;
                            foreach (var item in goodsList)
                            {
                                if (item.name.Equals(name) && item.imgUri.Equals(imgUrl))
                                {
                                    item.count = item.count + Convert.ToInt32(count);
                                    exist = true;
                                    break;
                                }
                            }
                            if (!exist)
                            {
                                GoodsInfo info = new GoodsInfo();
                                StorageFile file = await StorageFile.GetFileFromPathAsync(imgUrl);
                                using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
                                {
                                    BitmapImage image = new BitmapImage();
                                    image.SetSource(fileStream);
                                    info.img = image;
                                }
                                info.name = name;
                                info.price = singlePrice;
                                info.count = Convert.ToInt32(count);
                                info.imageName = imagename;
                                info.imgUri = imgUrl;
                                goodsList.Add(info);
                            }

                        }
                    }
                }
                int index = 0;
                foreach (var item in goodsList)
                {
                    ShopCartPanel panel = new ShopCartPanel();
                    panel.Picture = item.brush;
                    panel.GoodsName = item.name;
                    panel.PictureName = item.imageName;
                    panel.GoodsCount = item.count;
                    panel.Price = item.price;
                    panel.Name = item.imgUri + item.name;
                    panel.PictureURL = item.imgUri;
                    CheckBox check = new CheckBox();
                    if(null != checkboxStyle)
                    {
                        check.SetValue(StyleProperty,checkboxStyle);
                    }
                    check.Checked += CheckBox_Checked;
                    check.Unchecked += CheckBox_Unchecked;
                    panel.Check = check;
                    Button btnAdd = new Button();
                    btnAdd.Click += Add_Click;
                    Button btnDecrease = new Button();
                    btnDecrease.Click += Decrease_Click;
                    panel.ButtonAdd = btnAdd;
                    panel.ButtonDecrease = btnDecrease;
                    panel.PictureWith = PicWidth;
                    if(index > 0 && goodsPanels.ContainsKey(index - 1))
                    {
                        panel.SetValue(RelativePanel.RightOfProperty, goodsPanels[index - 1].Name);                        
                    }
                    else
                    {
                        panel.SetValue(RelativePanel.AlignLeftWithPanelProperty, true);
                    }
                    panel.SetValue(RelativePanel.AlignTopWithPanelProperty, true);
                    goods.Children.Add(panel);
                    goodsPanels.Add(index++,panel);
                }
                ResetPicturePanelPositon();
            }
            catch(Exception ex)
            {
#if DEBUG
                System.Diagnostics.Debug.WriteLine(ex.Message);
#endif
            }            
        }
        public async void listarTratas()
        {
            
            DateTime fecha = DateTime.Now;
            
            tratas1 = new ObservableCollection<Tratamiento>();
            var query = from UsuarioSelected in ParseObject.GetQuery("Tratamiento")
                        where UsuarioSelected.Get<string>("paciente") == usu.Id
                        select UsuarioSelected;
            var final = await query.FindAsync();
            Tratamiento trata;
            foreach (var obj in final)
            {
             
                trata = new Tratamiento();
                trata.Id = obj.ObjectId;
                trata.Medico = obj.Get<string>("MedicoId");
                trata.Fechainicio = (DateTime)obj.CreatedAt;
                trata.Fechafin = obj.Get<DateTime>("FechaFin");
                trata.Fechacontrol = obj.Get<DateTime>("FechaControl");
                trata.NomTratamiento = obj.Get<string>("Nomtratamiento");
                trata.Descripcion = obj.Get<string>("Descripcion");
                tratas1.Add(trata);
                if (trata.Fechacontrol.Month == fecha.Month && trata.Fechacontrol.Year == fecha.Year && trata.Fechacontrol.Day == fecha.Day)
                {
                    cb = new CheckBox
                    {
                        Content = "¿Entendido?"
                    };
                    var panel = new StackPanel();

                    panel.Children.Add(new TextBlock
                    {
                        Text = "Tienes control medico del tratamiento " + trata.Fechacontrol.Date,
                        TextWrapping = TextWrapping.Wrap,
                    });
                    
                    var dialog = new ContentDialog()
                    {
                        Title = "TIENES CONTROL",
                        MaxWidth = this.MaxWidth
                    };
                    
                    cb.SetBinding(CheckBox.IsCheckedProperty, new Binding
                    {
                        Source = dialog,
                    });
                    panel.Children.Add(cb);
                    dialog.Content = panel;
                    dialog.PrimaryButtonText = "OK";
                    dialog.IsPrimaryButtonEnabled = true;
                    dialog.PrimaryButtonClick += delegate {
                        notificar(cb,trata);
                    };
                    dialog.ShowAsync();



                }
                
        }
        }