Inheritance: Windows.UI.Xaml.DependencyObject, IRowDefinition
        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 = Strings.DistinctEdges
            };

            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;
        }
Beispiel #2
0
        /// <summary>
        /// Inicializace hlavního gridu
        /// </summary>
        private void gridInit()
        {
            LayoutGrid.Height = 768;
            LayoutGrid.Width = 1366;
            MyScrollViewer.Content = LayoutGrid;

            //disablovani rotace pro rotaci displeje
            //LayoutGrid.ManipulationMode = ManipulationModes.None;
            


            //definice pozadi
            LayoutGrid.Background = new SolidColorBrush(Colors.White);

            //definice rozmeru
            LayoutGrid.Width = (Window.Current.Bounds.Height / 6) * 11;
            LayoutGrid.Height = Window.Current.Bounds.Height;

            //deklarace a definice 6 radku
            RowDefinition rowdef1 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef3);
            RowDefinition rowdef4 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef4);
            RowDefinition rowdef5 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef5);
            RowDefinition rowdef6 = new RowDefinition();
            LayoutGrid.RowDefinitions.Add(rowdef6);

            //deklarace a definice 11 sloupců
            ColumnDefinition coldef1 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef5);
            ColumnDefinition coldef6 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef6);
            ColumnDefinition coldef7 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef7);
            ColumnDefinition coldef8 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef8);
            ColumnDefinition coldef9 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef9);
            ColumnDefinition coldef10 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef10);
            ColumnDefinition coldef11 = new ColumnDefinition();
            LayoutGrid.ColumnDefinitions.Add(coldef11);

            
            

        }
 private void SetupButtonGrid() {
     var gridSize = GridLogic.GridSize;
     // calculating button height
     var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
     var buttonSize = Window.Current.Bounds.Width * scaleFactor / gridSize;
     // setting up rows and columns
     for (var i = 0; i < gridSize; i++) {
         var colDef = new ColumnDefinition {
             Width = new GridLength(1, GridUnitType.Star)
         };
         MainButtonsGrid.ColumnDefinitions.Add(colDef);
     }
     for (var i = 0; i < gridSize; i++) {
         var rowDef = new RowDefinition {
             Height = new GridLength(1, GridUnitType.Star)
         };
         MainButtonsGrid.RowDefinitions.Add(rowDef);
     }
     // obtaining buttons content - a shameful workaround
     var buttonStrings = _resLoader.GetString("MainButtonsContent").Split(';');
     // creating and adding buttons
     _mainButtons = new ToggleButton[gridSize * gridSize];
     for (var i = 0; i < gridSize; i++) {
         for (var j = 0; j < gridSize; j++) {
             var bIndex = i * gridSize + j;
             var b = new ToggleButton {
                 HorizontalAlignment = HorizontalAlignment.Stretch,
                 VerticalAlignment = VerticalAlignment.Stretch,
                 Height = buttonSize,
                 Width = buttonSize
             };
             b.SetValue(Grid.RowProperty, i);
             b.SetValue(Grid.ColumnProperty, j);
             b.Padding = new Thickness(0);
             b.Margin = new Thickness(0, -11, 0, -11);
             // setting button content
             var textBlock = new TextBlock {
                 TextWrapping = TextWrapping.Wrap,
                 FontSize = 14,
                 FontStretch = Windows.UI.Text.FontStretch.ExtraCondensed,
                 Text = buttonStrings[bIndex]
             };
             b.HorizontalContentAlignment = HorizontalAlignment.Left;
             b.Padding = new Thickness(4, 1, 1, 1);
             b.Content = textBlock;
             // adding OnClickListener
             b.Tag = bIndex;
             b.Click += mainButton_Click;
             // saving the button and adding to grid
             _mainButtons[bIndex] = b;
             MainButtonsGrid.Children.Add(b);
         }
     }
 }
Beispiel #4
0
 public PicturePanel()
 {
     picGrid.Margin = new Thickness(10, 10, 10, 10);
     RowDefinition row = new RowDefinition();
     picGrid.RowDefinitions.Add(row);
     ColumnDefinition col = new ColumnDefinition();
     picGrid.ColumnDefinitions.Add(col);
     picBorder.BorderThickness = new Thickness(1);
     picBorder.BorderBrush = new SolidColorBrush(Colors.White);
     picBorder.CornerRadius = new CornerRadius(5,5,5,5);
     picGrid.Children.Add(picBorder);
     this.Children.Add(picGrid);
 }
Beispiel #5
0
        public GoodsPanel()
        {
            this.Margin = new Thickness(5,5,5,5);
            RowDefinition goodsRow = new RowDefinition();
            ColumnDefinition goodsColumn = new ColumnDefinition();
            goodsGrid.RowDefinitions.Add(goodsRow);
            goodsGrid.ColumnDefinitions.Add(goodsColumn);
            goodsGrid.Background = new SolidColorBrush(Color.FromArgb(255,235,235,235));
            goodsBorder.BorderThickness = new Thickness(1);
            goodsBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(255,255,255,255));
            goodsBorder.CornerRadius = new CornerRadius(5,5,5,5);
            goodsGrid.Children.Add(goodsBorder);

            //init goods info panel
            goodsInfoPanel.Name = "goodsInfoPanel";
            nameText.Width = 50;
            nameText.Height = 25;
            nameText.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51));
            nameText.Name = "nameText";
            nameText.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
            nameText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
            nameText.Margin = new Thickness(10,0,0,10);
            nameText.TextAlignment = TextAlignment.Left;
            goodsInfoPanel.Children.Add(nameText);

            priceText.Width = 50;
            priceText.Height = 25;
            priceText.Foreground = new SolidColorBrush(Color.FromArgb(255,253,40,57));
            priceText.SetValue(RelativePanel.AlignRightWithPanelProperty,true);
            priceText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
            priceText.Margin = new Thickness(0,0,10,10);
            priceText.TextAlignment = TextAlignment.Right;
            goodsInfoPanel.Children.Add(priceText);

            RowDefinition picRow = new RowDefinition();
            ColumnDefinition picColumn = new ColumnDefinition();
            picGrid.RowDefinitions.Add(picRow);
            picGrid.ColumnDefinitions.Add(picColumn);
            picGrid.Name = "PictureGrid";
            picGrid.SetValue(RelativePanel.AlignLeftWithPanelProperty, true);
            picGrid.SetValue(RelativePanel.AboveProperty,nameText.Name);
            picGrid.Margin = new Thickness(10,0,10,10);
            picBorder.BorderThickness = new Thickness(1);
            picBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(255,255,255,255));
            picBorder.CornerRadius = new CornerRadius(5,5,5,5);
            picGrid.Children.Add(picBorder);
            goodsInfoPanel.Children.Add(picGrid);

            goodsGrid.Children.Add(goodsInfoPanel);
            this.Children.Add(goodsGrid);
        }
Beispiel #6
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            sc     = (WC.ScrollViewer) this.GetTemplateChild("sc");
            r1     = (WC.RowDefinition) this.GetTemplateChild("r1");
            r3     = (WC.RowDefinition) this.GetTemplateChild("r3");
            border = (WC.Border) this.GetTemplateChild("border");

            sc.ViewChanged += Sc_ViewChanged;

            this.PointerEntered += DataPicker_PointerEntered;
            this.PointerExited  += DataPicker_PointerExited;
        }
        public MainPage()
        {
            this.InitializeComponent();

            for(  int i = 0; i < 10; i++ )
            {
                var ctr = new MyUserControl1();
                var row = new RowDefinition();
                MainGrid.RowDefinitions.Add(row);
                ctr.SetValue(Grid.RowProperty, i);
                MainGrid.Children.Add(ctr);
            }

            this.textBlock.Text = typeof(Page).AssemblyQualifiedName; //PortableLibrary1.init(this);
        }
Beispiel #8
0
        private Button NewRoomButton(string _name)
        {
            Button bt = new Button();
            bt.Margin = new Thickness(20, 20, 20, 20);
            bt.Height = 200;
            bt.Width = 200;

            /*<Grid
                        <Grid.RowDefinitions>
                            <RowDefinition Height="8*"></RowDefinition>
                            <RowDefinition Height="2*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Image Grid.Row="0" Source="ms-appx:///Images/addicon.png" Stretch="Fill"></Image>
                        <TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontStyle="Italic">Add new room</TextBlock>
                    </Grid>*/

            Grid grid = new Grid();
            RowDefinition rowDef = new RowDefinition();
            rowDef.Height = new GridLength(8, GridUnitType.Star);
            grid.RowDefinitions.Add(rowDef);
            rowDef = new RowDefinition();
            rowDef.Height = new GridLength(2, GridUnitType.Star);
            grid.RowDefinitions.Add(rowDef);

            Image image = new Image();
            image.Stretch = Stretch.Fill;
            BitmapImage bitmapImage = new BitmapImage();
            Uri uri = new Uri("ms-appx:///Images/none.png");
            bitmapImage.UriSource = uri;
            image.Source = bitmapImage;

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = HorizontalAlignment.Center;
            tb.FontStyle = Windows.UI.Text.FontStyle.Italic;
            tb.Text = _name != null? _name: "New Room " + (wpRooms.Children.Count - 1);

            grid.Children.Add(tb);
            Grid.SetRow(tb, 1);
            grid.Children.Add(image);
            Grid.SetRow(image, 0);

            bt.Content = grid;
            bt.Click += btnViewRoom_Click;

            return bt;
        }
        private void PopulateMainImageGrid()
        {
            for (int i = 0; i < 10; i++)
            {
                var rowDef = new RowDefinition();
                rowDef.Height = new GridLength(150);
                MainImageGrid.RowDefinitions.Add(rowDef);
                MainImageGrid.ColumnDefinitions.Add(new ColumnDefinition());
                for (int j = 0; j < 10; j++)
                {
                    var image = MainPageImageHandler.CreateImageButtons(new Uri("ms-appx:///Assets/120px-Human_Thumbnail.jpg"));
                    MainImageGrid.Children.Add(image);
                    Grid.SetRow(image, i);
                    Grid.SetColumn(image, j);

                }
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            int index = 0;
            foreach (Character character in Settings.characterList)
            {
                // create a field for every character
                RowDefinition rowDefinition = new RowDefinition();
                rowDefinition.Height = Windows.UI.Xaml.GridLength.Auto;
                this.CharGrid.RowDefinitions.Add(rowDefinition);

                CharacterDisplay charInfo = new CharacterDisplay(character);
                Grid.SetRow(charInfo, index++);
                Grid.SetColumn(charInfo, 0);

                this.CharGrid.Children.Add(charInfo);

                charInfo.OnSelect += SelectCharacter;
            }
        }
        private void RenderRoundSummaries()
        {
            int roundCount = 1;
            int rowIndex = 0;

            foreach (string summary in game.RoundSummaries)
            {
                // create two grid rows for each summary, for title and body
                RowDefinition rdTitle = new RowDefinition();
                rdTitle.Height = titleRowHeight;
                RowDefinition rdBody = new RowDefinition();
                rdBody.Height = new GridLength(1, GridUnitType.Auto);
                roundSummariesGrid.RowDefinitions.Insert(rowIndex, rdTitle);
                roundSummariesGrid.RowDefinitions.Insert(rowIndex + 1, rdBody);

                // create new textblocks for title and body
                TextBlock tbTitle = new TextBlock();
                TextBlock tbBody = new TextBlock();

                // set text
                tbTitle.Text = "ROUND " + roundCount;
                tbBody.Text = summary;

                //set styling
                tbTitle.Foreground = titleTextBrush;
                tbTitle.FontFamily = shuiFont;
                tbBody.TextWrapping = TextWrapping.WrapWholeWords;
                tbBody.Margin = new Thickness(0, 10, 0, 20);

                // add as children to grid
                roundSummariesGrid.Children.Add(tbTitle);
                roundSummariesGrid.Children.Add(tbBody);

                //set grid rows
                Grid.SetRow(tbTitle, rowIndex);
                Grid.SetRow(tbBody, rowIndex + 1);

                roundCount++;
                rowIndex = rowIndex + 2;
            }
        }
Beispiel #12
0
        protected override void OnApplyTemplate()
        {
            _expanderButton = GetTemplateChild(StringConstants.ExpanderToggleButtonPart) as ToggleButton;
            _headerButton = GetTemplateChild(StringConstants.HeaderButtonPart) as ButtonBase;
            _mainContentRow = GetTemplateChild(StringConstants.MainContentRowPart) as RowDefinition;

            if (_expanderButton != null)
            {
                _expanderButton.Checked += OnExpanderButtonChecked;
                _expanderButton.Unchecked += OnExpanderButtonUnChecked;
                _expanderButton.IsChecked = IsExpanded;
                if (IsExpanded)
                    ExpandControl();
                else
                    CollapseControl();
            }

            if (_headerButton != null)
            {
                _headerButton.Click += OnHeaderButtonClick;
            }
        }
        private void AlignElements()
        {
            if (Window.Current.Bounds.Width < 600 && !smallView)
            {
                smallView = true;
                MySplitView.DisplayMode = SplitViewDisplayMode.Overlay;
                embedContent.Width = Window.Current.Bounds.Width - 50;

                // Change signature location radio boxes from 1x4 to 2x2 grid
                RadioBoxGrid.ColumnDefinitions.Remove(RadioBoxGrid.ColumnDefinitions.First());
                RadioBoxGrid.ColumnDefinitions.Remove(RadioBoxGrid.ColumnDefinitions.First());
                RowDefinition rd = new RowDefinition();
                rd.Height = new GridLength(1.0, GridUnitType.Star);
                RadioBoxGrid.RowDefinitions.Add(rd);
                RowDefinition rd2 = new RowDefinition();
                rd2.Height = new GridLength(1.0, GridUnitType.Star);
                RadioBoxGrid.RowDefinitions.Add(rd2);
                Grid.SetRow(bottomLeftText, 2);
                Grid.SetRow(bottomLeftButton, 3);
                Grid.SetRow(bottomRightText, 2);
                Grid.SetRow(bottomRightButton, 3);
                Grid.SetColumn(bottomLeftText, 0);
                Grid.SetColumn(bottomLeftButton, 0);
                Grid.SetColumn(bottomRightText, 1);
                Grid.SetColumn(bottomRightButton, 1);

                chooseLocationTextbox.HorizontalAlignment = HorizontalAlignment.Center;
            }
            else if (smallView)
            {
                Frame.Navigate(typeof(MainPage));
            }
        }
        public void FillWaveForm(WaveForm wave)
        {
            Children.Clear();
            RowDefinitions.Clear();
            ColumnDefinitions.Clear();

            if (wave != null)
            {
                //create the waveform
                int index = 0;
                int sample;
                RowDefinition row1 = new RowDefinition();
                row1.Height = new GridLength(2, GridUnitType.Star);
                RowDefinitions.Add(row1);
                RowDefinition row2 = new RowDefinition();
                row1.Height = new GridLength(1, GridUnitType.Star);
                RowDefinitions.Add(row2);
                for (sample = 0; sample < wave.Samples.Length; sample = sample + 6)
                {
                    int s = sample / 6;
                    if((s & 1) == 0)
                    {
                        int i = wave.Samples[sample];
                        ColumnDefinition col = new ColumnDefinition();
                        col.Width = new GridLength(1, GridUnitType.Star);
                        ColumnDefinitions.Add(col);
                        Thickness margin = new Thickness();
                        margin.Bottom = 1;
                        margin.Top = 1;
                        Rectangle r = new Rectangle
                        {
                            Height = i / 2,
                            Margin = margin,
                            VerticalAlignment = VerticalAlignment.Bottom
                        };
                        Rectangle r2 = new Rectangle
                        {
                            Height = i / 4,
                            Margin = margin,
                            VerticalAlignment = VerticalAlignment.Top
                        };
                        r.SetValue(ColumnProperty, index);
                        r.SetValue(RowProperty, 0);
                        r2.SetValue(ColumnProperty, index);
                        r2.SetValue(RowProperty, 1);
                        r.Fill = new SolidColorBrush(Colors.White);
                        r2.Fill = new SolidColorBrush(Colors.White);
                        Children.Add(r);
                        Children.Add(r2);
                        index = index + 2;
                    }
                    else
                    {
                        ColumnDefinition col = new ColumnDefinition();
                        col.Width = new GridLength(1, GridUnitType.Star);
                        ColumnDefinitions.Add(col);
                    }
                    
                }
                _slider.Minimum = 0;
                _slider.StepFrequency = 1;
                _slider.IsThumbToolTipEnabled = false;
                _slider.Style = (Style) Application.Current.Resources["WaveFormSlider"];
                _slider.SetValue(ColumnSpanProperty, index);
                _slider.ValueChanged += Slider_ValueChanged;
                Children.Add(_slider);
                _playbackTimer.Start();
            }
        }
        public void parseHabitsResponce(String responce){
            Debug.WriteLine("Before Count: "+ this.mainGrid.Children.Count);
            foreach(UIElement inGRID in inGrid)
            {
                this.mainGrid.Children.Remove(inGRID);
            }
            Debug.WriteLine("After Count: " + this.mainGrid.Children.Count);
            this.mainGrid.UpdateLayout();

            int count;
            int limit;
            JsonArray array;
            JsonObject jobj = JsonObject.Parse(responce);
            
            JsonObject o = jobj.GetObject();
            count = (int)o.GetNamedNumber("habitCount");
            limit = (int)o.GetNamedNumber("habitLimit");
            array = o.GetNamedArray("habits");
            int loop = 1;
            Debug.WriteLine(array.Count);
            foreach(JsonValue habbitValue in array) {
                JsonObject habbit = habbitValue.GetObject();
                RowDefinition rowDef = new RowDefinition();
                rowDef.Height = new GridLength(25);
                this.mainGrid.RowDefinitions.Add(rowDef);
                //Check if active
                Debug.WriteLine(habbit);
               if(habbit.GetNamedBoolean("active")) {
                    
                    Button button = new Button();
                    button.Click += async (sender, args) => {
                        await sendRequest("/api/records/" + habbit.GetNamedString("_id"), "");
                        getHabits();
                    };


                    button.HorizontalAlignment = HorizontalAlignment.Center;
                    
                    button.VerticalAlignment = VerticalAlignment.Center;
                    button.Height = 25;
                    button.FontSize = 8;
                    switch(habbit.GetNamedString("status")) {
                        case "pending":
                            button.Background = new SolidColorBrush(Colors.Gray);
                            button.Content = "Did-it!";
                            break;
                        case "completed":
                            button.Background = new SolidColorBrush(Colors.Green);
                            button.Content = "Completed";
                            break;
                        case "failed":
                            button.Background = new SolidColorBrush(Colors.Red);
                            button.Content = "Failed";
                            break;
                        default:
                            button.Content = habbit.GetNamedString("status");
                            break;
                    }

                    //button.Content = "Checkin";
                    Grid.SetColumn(button, 1);
                    Grid.SetRow(button, loop);
                    this.mainGrid.Children.Add(button);
                    inGrid.Add(button);


                    //Habbit name
                    TextBlock habbitName = new TextBlock();
                    habbitName.Text = habbit.GetNamedString("habitName");
                    habbitName.HorizontalAlignment = HorizontalAlignment.Center;
                    habbitName.VerticalAlignment = VerticalAlignment.Center;
                    habbitName.FontSize = 10.667;
                    Grid.SetColumn(habbitName, 2);
                    Grid.SetRow(habbitName, loop);
                    this.mainGrid.Children.Add(habbitName);
                    inGrid.Add(habbitName);
                    //Debug.WriteLine(habbitName.Text + "" + loop);

                    //Reminder time
                    TextBlock RTime = new TextBlock();
                    DateTime rtime = System.DateTime.Parse(habbit.GetNamedString("reminderTime"));
                    RTime.Text = rtime.ToString("h:mm tt");
                    RTime.HorizontalAlignment = HorizontalAlignment.Center;
                    RTime.VerticalAlignment = VerticalAlignment.Center;
                    RTime.FontSize = 10.667;
                    Grid.SetColumn(RTime, 3);
                    Grid.SetRow(RTime, loop);
                    this.mainGrid.Children.Add(RTime);
                    inGrid.Add(RTime);
                    //Debug.WriteLine(RTime.Text + "" + loop);

                    //Setup notification
                    var time = DateTimeOffset.Parse(rtime.ToLocalTime().ToString());
                    if(time.ToUnixTimeSeconds() > DateTimeOffset.Now.ToUnixTimeSeconds())
                    {
                        Debug.WriteLine("Scheduled Toast");
                        Debug.WriteLine(time);
                        var xml = setupToastNotification(habbitName.Text+" is due by "+ System.DateTime.Parse(habbit.GetNamedString("reminderTime")).ToString("h:mm tt"));
                        ToastNotificationManager.CreateToastNotifier().AddToSchedule(new ScheduledToastNotification(xml, time));
                    } else
                    {
                        Debug.WriteLine("No need to schedule Toast");
                        Debug.WriteLine(time);
                    }
                    

                    //Due time
                    TextBlock DTime = new TextBlock();
                    DateTime dtime = System.DateTime.Parse(habbit.GetNamedString("dueTime"));
                    DTime.Text = dtime.ToString("h:mm tt");
                    DTime.HorizontalAlignment = HorizontalAlignment.Center;
                    DTime.VerticalAlignment = VerticalAlignment.Center;
                    DTime.FontSize = 10.667;
                    //fGrid.SetColumn(RTime, 4);
                    Grid.SetColumn(DTime, 4);
                    Grid.SetRow(DTime, loop);
                    this.mainGrid.Children.Add(DTime);
                    inGrid.Add(DTime);
                    //Debug.WriteLine(DTime.Text + "" + loop);

                    //Current Streak
                    TextBlock currentStreak = new TextBlock();
                    currentStreak.Text = "" + habbit.GetNamedNumber("streak");
                    currentStreak.HorizontalAlignment = HorizontalAlignment.Center;
                    currentStreak.VerticalAlignment = VerticalAlignment.Center;
                    currentStreak.FontSize = 10.667;
                    Grid.SetColumn(currentStreak, 5);
                    //Grid.SetColumn(currentStreak, 5);
                    Grid.SetRow(currentStreak, loop);
                    this.mainGrid.Children.Add(currentStreak);
                    inGrid.Add(currentStreak);
                    //Debug.WriteLine(currentStreak.Text + "" + loop);

                    //Record Streak
                    TextBlock recordStreak = new TextBlock();
                    recordStreak.Text = "" + habbit.GetNamedNumber("streakRecord");
                    recordStreak.HorizontalAlignment = HorizontalAlignment.Center;
                    recordStreak.VerticalAlignment = VerticalAlignment.Center;
                    recordStreak.FontSize = 10.667;
                    Grid.SetColumn(recordStreak, 6);
                    Grid.SetRow(recordStreak, loop);
                    this.mainGrid.Children.Add(recordStreak);
                    inGrid.Add(recordStreak);

                    //Edit
                    Button edit = new Button();
                    edit.Click += (sender, args) =>
                        Frame.Navigate(typeof(HabbitEdit), habbit);
                    edit.Content = "Edit!";
                    edit.HorizontalAlignment = HorizontalAlignment.Center;
                    edit.VerticalAlignment = VerticalAlignment.Center;
                    edit.Height = 25;
                    edit.FontSize = 8;
                    edit.Background = new SolidColorBrush(Colors.LightBlue);
                    Grid.SetColumn(edit, 0);
                    Grid.SetRow(edit, loop);
   
                    this.mainGrid.Children.Add(edit);
                    inGrid.Add(edit);
                    loop++;

                }
            }
        }
        protected void CreateControl()
        {
            var grid = new Grid();
            int rowIndex = 0;
            int columnIndex;

            var brightnessText = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.Brightness
            };

            Grid.SetRow(brightnessText, rowIndex++);

            var brightnessSlider = new Slider
            {
                StepFrequency = 0.01,
                Minimum = 0.0,
                Maximum = 1.0,
                Value = Filter.Brightness
            };
            brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;

            Grid.SetRow(brightnessSlider, rowIndex++);

            var saturationText = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.Saturation
            };

            Grid.SetRow(saturationText, rowIndex++);

            var saturationSlider = new Slider
            {
                StepFrequency = 0.01,
                Minimum = 0.0,
                Maximum = 1.0,
                Value = Filter.Saturation
            };
            saturationSlider.ValueChanged += saturationSlider_ValueChanged;

            Grid.SetRow(saturationSlider, rowIndex++);

            var margin = new Thickness { Left = 72 };
            rowIndex = 0;
            columnIndex = 1;

            var lomoVignettingText = new TextBlock
            {
                Margin = margin,
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.LomoVignetting
            };

            Grid.SetRow(lomoVignettingText, rowIndex++);
            Grid.SetColumn(lomoVignettingText, columnIndex);

            var highRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.High }
            };
            highRadioButton.Checked += highRadioButton_Checked;

            Grid.SetRow(highRadioButton, rowIndex++);
            Grid.SetColumn(highRadioButton, columnIndex);

            var medRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.Medium }
            };
            medRadioButton.Checked += medRadioButton_Checked;

            Grid.SetRow(medRadioButton, rowIndex++);
            Grid.SetColumn(medRadioButton, columnIndex);

            var lowRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.Low }
            };
            lowRadioButton.Checked += lowRadioButton_Checked;

            Grid.SetRow(lowRadioButton, rowIndex++);
            Grid.SetColumn(lowRadioButton, columnIndex);

            switch (Filter.LomoVignetting)
            {
                case LomoVignetting.Low: lowRadioButton.IsChecked = true; break;
                case LomoVignetting.Medium: medRadioButton.IsChecked = true; break;
                case LomoVignetting.High: highRadioButton.IsChecked = true; break;
            }

            for (int i = 0; i < rowIndex; ++i)
            {
                var rowDefinition = new RowDefinition();

                if (i < rowIndex - 1)
                {
                    rowDefinition.MinHeight = GridRowMinimumHeight;
                }
                else
                {
                    rowDefinition.Height = GridLength.Auto;
                }

                grid.RowDefinitions.Add(rowDefinition);
            }

            grid.ColumnDefinitions.Add(new ColumnDefinition { MaxWidth = 500 });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });

            grid.Children.Add(brightnessText);
            grid.Children.Add(brightnessSlider);
            grid.Children.Add(saturationText);
            grid.Children.Add(saturationSlider);
            grid.Children.Add(lomoVignettingText);
            grid.Children.Add(lowRadioButton);
            grid.Children.Add(medRadioButton);
            grid.Children.Add(highRadioButton);

            Control = grid;
        }
        /// <summary>
        /// Returns a grid containing line with exact length and in the rotation specified for LiDAR Map.
        /// </summary>
        /// <param name="Angle">Angle to be map</param>
        /// <param name="Distance">Distance to be map on specified angle</param>
        /// <returns>Returns the grid that contain line and an ellipse that will exactly of length 'Distance' on specified 'Angle'.</returns>
        public static Grid GetMapper(double Angle, int Distance)
        {
            /* Create a new composite transform for Rotation and set angle */
            _CompositeTransform = new CompositeTransform();
            _CompositeTransform.Rotation = Angle;

            /* Crete new grid object and apply transformation */
            _Grid = new Grid();
            _Grid.RenderTransform = _CompositeTransform;

            /* <RowDefination Height="Auto"/> */
            _RowDefination = new RowDefinition();
            _RowDefination.Height = GridLength.Auto;
            _Grid.RowDefinitions.Add(_RowDefination);

            /* <RowDefination Height="*"/> */
            _RowDefination = new RowDefinition();
            _Grid.RowDefinitions.Add(_RowDefination);

            _Grid.HorizontalAlignment = HorizontalAlignment.Center;
            _Grid.VerticalAlignment = VerticalAlignment.Bottom;

            _Grid.RenderTransformOrigin = new Windows.Foundation.Point(0, 1);

            int size = Distance / 10;

            /* Ellipse is the point that will be mapped on the specified distance from the origin */
            _Ellipse = new Ellipse();
            _Ellipse.Height = size;
            _Ellipse.Width = size;
            _Ellipse.RenderTransformOrigin = new Windows.Foundation.Point(0, 0);
            _Ellipse.Margin = new Thickness(-size, 0, -size, 0);

            Duration duration = new Duration(TimeSpan.FromSeconds(2.5));

            DoubleAnimation opacityAnimation = new DoubleAnimation();
            opacityAnimation.Duration = duration;
            opacityAnimation.To = 0;

            Storyboard justintimeStoryboard = new Storyboard();
            justintimeStoryboard.Duration = duration;
            justintimeStoryboard.Children.Add(opacityAnimation);

            Storyboard.SetTarget(opacityAnimation, _Ellipse);
            Storyboard.SetTargetProperty(opacityAnimation, "Opacity");

            _Grid.Resources.Add("justintimeStoryboard", justintimeStoryboard);   // Make the Storyboard a resource.
            justintimeStoryboard.Begin();   // Begin the animation.

            /* Apply different color for different region like < 50cm will be red and so on */
            if (Distance < 50)
            {
                _Ellipse.Fill = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
            }
            else if (Distance < 100)
            {
                _Ellipse.Fill = new SolidColorBrush(Color.FromArgb(255, 200, 100, 0));
            }
            else
            {
                _Ellipse.Fill = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
            }

            /* Add ellipse in Grid.Row=0 & Grid.Column=0 */
            _Grid.Children.Add(_Ellipse);

            /* Create new object of line*/
            _Line = new Line();

            /* Add line in Grid.Row=1 & Grid.Column=0 */
            Grid.SetRow(_Line, 1);

            /* Specify line starting and ending point */
            _Line.X1 = 0;
            _Line.X2 = 0;
            _Line.Y1 = Distance + 3;
            _Line.Y2 = 0;

            /* Line thickness. Set to ZERO if not needed */
            _Line.StrokeThickness = 0;
            _Line.Stroke = _Ellipse.Fill;

            /* Add line to grid created above */
            _Grid.Children.Add(_Line);

            /* Return the complete grid back so that it will be plotted */
            return _Grid;
        }
        //
        //ToDo:?  private void ShrinkGridIfRequired(int x, int y)
        //


        private void ExpandGridIfRequired(int x, int y)
        {
            //
            // The limits are absolute coordinates, while the incoming x and y are relative
            // coordinates.  When adjusting the grid column/row values, absolute coordinates
            // must be used.  When dealing with limits, relative coordinates must be used.
            //

            const int boardBufferSize = 3;
            var absX = x + _westLimit;
            var absY = y + _northLimit;


            //
            // Case: Expand in the East direction
            //

            while ((absX + boardBufferSize > _eastLimit) && (_eastLimit < GameBoardDimension - 1))
            {
                var column = new ColumnDefinition { Width = new GridLength(50) };
                GameBoard.ColumnDefinitions.Add(column);
                _eastLimit++;

                for (int i = 0; i <= _southLimit - _northLimit; i++)
                {
                    CreateBorder(_eastLimit - _westLimit, i);
                }
            }


            //
            // Case: Expand in the West direction
            //

            while ((absX - boardBufferSize < _westLimit) && (_westLimit > 0))
            {
                var column = new ColumnDefinition { Width = new GridLength(50) };
                GameBoard.ColumnDefinitions.Insert(0, column);


                //
                // Shift everything one position in the East direction.
                //

                foreach (var gridBorder in _gridBorders)
                {
                    var col = (int)gridBorder.GetValue(Grid.ColumnProperty);
                    gridBorder.SetValue(Grid.ColumnProperty, col + 1);
                }

                foreach (var tile in _playedTiles)
                {
                    var col = (int)tile.GetValue(Grid.ColumnProperty);
                    tile.SetValue(Grid.ColumnProperty, col + 1);
                }


                _westLimit--;

                for (int i = 0; i <= _southLimit - _northLimit; i++)
                {
                    CreateBorder(0, i);
                }
            }


            //
            // Case: Expand in the South direction
            //

            while ((absY + boardBufferSize > _southLimit) && (_southLimit < GameBoardDimension - 1))
            {
                var row = new RowDefinition { Height = new GridLength(50) };
                GameBoard.RowDefinitions.Add(row);
                _southLimit++;

                for (int i = 0; i <= _eastLimit - _westLimit; i++)
                {
                    CreateBorder(i, _southLimit - _northLimit);
                }
            }


            //
            // Case: Expand in the North direction
            //

            while ((absY - boardBufferSize < _northLimit) && (_northLimit > 0))
            {
                var row = new RowDefinition { Height = new GridLength(50) };
                GameBoard.RowDefinitions.Insert(0, row);


                //
                // Shift everything one position in the South direction.
                //

                foreach (var gridBorder in _gridBorders)
                {
                    var newRow = (int)gridBorder.GetValue(Grid.RowProperty);
                    gridBorder.SetValue(Grid.RowProperty, newRow + 1);
                }

                foreach (var tile in _playedTiles)
                {
                    var newRow = (int)tile.GetValue(Grid.RowProperty);
                    tile.SetValue(Grid.RowProperty, newRow + 1);
                }


                _northLimit--;

                for (int i = 0; i <= _eastLimit - _westLimit; i++)
                {
                    CreateBorder(i, 0);
                }
            }
        }
        /// <summary>
        /// Funkce obsluhujici zmeny v zobrazeni pri horizontalnim stavu. Jedna se hlavne o zmeny vlastnosti gridu, panelu
        /// a podobne.
        /// </summary>
        private void setLandscapeChanges()
        {
            

            //layoutroot zmeny 

            LayoutRoot.ColumnDefinitions.Clear();
            LayoutRoot.RowDefinitions.Clear();



            ColumnDefinition rowdef21 = new ColumnDefinition();
            rowdef21.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef21);
            ColumnDefinition rowdef22 = new ColumnDefinition();
            rowdef22.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef22);
            ColumnDefinition rowdef23 = new ColumnDefinition();
            rowdef23.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef23);
            ColumnDefinition rowdef24 = new ColumnDefinition();
            rowdef24.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef24);
            ColumnDefinition rowdef25 = new ColumnDefinition();
            rowdef25.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef25);
            ColumnDefinition rowdef26 = new ColumnDefinition();
            rowdef26.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef26);
            ColumnDefinition rowdef27 = new ColumnDefinition();
            rowdef27.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef27);
            ColumnDefinition rowdef28 = new ColumnDefinition();
            rowdef28.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef28);
            ColumnDefinition rowdef29 = new ColumnDefinition();
            rowdef29.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef29);
            ColumnDefinition rowdef210 = new ColumnDefinition();
            rowdef210.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef210);
            ColumnDefinition rowdef211 = new ColumnDefinition();
            rowdef211.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(rowdef211);



            RowDefinition coldef21 = new RowDefinition();
            coldef21.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef21);
            RowDefinition coldef22 = new RowDefinition();
            coldef22.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef22);
            RowDefinition coldef23 = new RowDefinition();
            coldef23.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef23);
            RowDefinition coldef24 = new RowDefinition();
            coldef24.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef24);
            RowDefinition coldef25 = new RowDefinition();
            coldef25.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef25);
            RowDefinition coldef26 = new RowDefinition();
            coldef26.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(coldef26);

            //layoutgrid zmeny

            LayoutGrid.ColumnDefinitions.Clear();
            LayoutGrid.RowDefinitions.Clear();

            Grid.SetRowSpan(LayoutGrid, 6);
            Grid.SetColumnSpan(LayoutGrid, 11);

            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef3);
            RowDefinition rowdef4 = new RowDefinition();
            rowdef4.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef4);
            RowDefinition rowdef5 = new RowDefinition();
            rowdef5.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef5);
            RowDefinition rowdef6 = new RowDefinition();
            rowdef6.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef6);
            



            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef5);
            ColumnDefinition coldef6 = new ColumnDefinition();
            coldef6.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef6);
            ColumnDefinition rowdef7 = new ColumnDefinition();
            rowdef7.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(rowdef7);
            ColumnDefinition rowdef8 = new ColumnDefinition();
            rowdef8.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(rowdef8);
            ColumnDefinition rowdef9 = new ColumnDefinition();
            rowdef9.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(rowdef9);
            ColumnDefinition rowdef10 = new ColumnDefinition();
            rowdef10.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(rowdef10);
            ColumnDefinition rowdef11 = new ColumnDefinition();
            rowdef11.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(rowdef11);

            Random random = new Random();

            foreach (FrameworkElement element in blankTileCollection)
            {

                Grid.SetColumn(element, blankTileCollection.IndexOf(element) % 11);
                Grid.SetRow(element, blankTileCollection.IndexOf(element) / 11);
            }

            foreach (FrameworkElement element in statusCollection)
            {

                Grid.SetColumn(element, random.Next(5, 9));
                Grid.SetRow(element, random.Next(1, 4));
            }
            
            Grid.SetRow(mainstatus, 2);
            Grid.SetColumn(mainstatus, 2);


            foreach (FrameworkElement element in imageCollection)
            {

                Grid.SetColumn(element, random.Next(1, 9));
                Grid.SetRow(element, random.Next(1, 4));
            }

            //zmeny na datapanelu

            Grid.SetColumn(DataPanel, 0);
            Grid.SetColumnSpan(DataPanel, 11);
            Grid.SetRow(DataPanel, 1);
            Grid.SetRowSpan(DataPanel, 5);

            DataPanel.RowDefinitions.Clear();
            DataPanel.ColumnDefinitions.Clear();

            ColumnDefinition rowdef12 = new ColumnDefinition();
            rowdef12.Width = new GridLength(1, GridUnitType.Star);
            DataPanel.ColumnDefinitions.Add(rowdef12);
            ColumnDefinition rowdef13 = new ColumnDefinition();
            rowdef13.Width = new GridLength(1, GridUnitType.Star);
            DataPanel.ColumnDefinitions.Add(rowdef13);
            ColumnDefinition rowdef14 = new ColumnDefinition();
            rowdef14.Width = new GridLength(9, GridUnitType.Star);
            DataPanel.ColumnDefinitions.Add(rowdef14);

            RowDefinition coldef11 = new RowDefinition();
            coldef11.Height = new GridLength(1, GridUnitType.Star);
            DataPanel.RowDefinitions.Add(coldef11);
            RowDefinition coldef12 = new RowDefinition();
            coldef12.Height = new GridLength(4, GridUnitType.Star);
            DataPanel.RowDefinitions.Add(coldef12);



            Grid.SetColumn(dataPanelScrl, 0);
            Grid.SetColumnSpan(dataPanelScrl, 3);
            Grid.SetRow(dataPanelScrl, 1);
            Grid.SetRowSpan(dataPanelScrl, 1);

            dataPanelStck.Orientation = Orientation.Horizontal;

            Grid.SetColumn(dataPanelButtonBackgroundPanel, 1);
            Grid.SetColumnSpan(dataPanelButtonBackgroundPanel, 1);
            Grid.SetRow(dataPanelButtonBackgroundPanel, 0);
            Grid.SetRowSpan(dataPanelButtonBackgroundPanel, 2);

            //menupanel zemny

            MenuPanel.ColumnDefinitions.Clear();
            MenuPanel.RowDefinitions.Clear();

            RowDefinition rowdef32 = new RowDefinition();
            rowdef32.Height = new GridLength(2, GridUnitType.Star);
            MenuPanel.RowDefinitions.Add(rowdef32);
            RowDefinition rowdef33 = new RowDefinition();
            rowdef33.Height = new GridLength(1, GridUnitType.Star);
            MenuPanel.RowDefinitions.Add(rowdef33);
            

            ColumnDefinition coldef31 = new ColumnDefinition();
            coldef31.Width = new GridLength(9, GridUnitType.Star);
            MenuPanel.ColumnDefinitions.Add(coldef31);
            ColumnDefinition coldef32 = new ColumnDefinition();
            coldef32.Width = new GridLength(1, GridUnitType.Star);
            MenuPanel.ColumnDefinitions.Add(coldef32);
            ColumnDefinition coldef33 = new ColumnDefinition();
            coldef33.Width = new GridLength(1, GridUnitType.Star);
            MenuPanel.ColumnDefinitions.Add(coldef33);

            Grid.SetColumn(MenuPanel, 0);
            Grid.SetColumnSpan(MenuPanel, 11);
            Grid.SetRow(MenuPanel, 0);
            Grid.SetRowSpan(MenuPanel, 3);

            MenuPanelSubGrid.ColumnDefinitions.Clear();
            MenuPanelSubGrid.RowDefinitions.Clear();

            ColumnDefinition coldef42 = new ColumnDefinition();
            coldef42.Width = new GridLength(6, GridUnitType.Star);
            MenuPanelSubGrid.ColumnDefinitions.Add(coldef42);
            ColumnDefinition coldef43 = new ColumnDefinition();
            coldef43.Width = new GridLength(5, GridUnitType.Star);
            MenuPanelSubGrid.ColumnDefinitions.Add(coldef43);

            Grid.SetColumn(MenuPanelSubGrid, 0);
            Grid.SetColumnSpan(MenuPanelSubGrid, 3);
            Grid.SetRow(MenuPanelSubGrid, 0);
            Grid.SetRowSpan(MenuPanelSubGrid, 1);

            menuPanelButtonGrid.ColumnDefinitions.Clear();
            menuPanelButtonGrid.RowDefinitions.Clear();

            ColumnDefinition rowdef52 = new ColumnDefinition();
            rowdef52.Width = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef52);
            ColumnDefinition rowdef53 = new ColumnDefinition();
            rowdef53.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef53);
            ColumnDefinition rowdef54 = new ColumnDefinition();
            rowdef54.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef54);
            ColumnDefinition rowdef55 = new ColumnDefinition();
            rowdef55.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef55);
            ColumnDefinition rowdef56 = new ColumnDefinition();
            rowdef56.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef56);
            ColumnDefinition rowdef57 = new ColumnDefinition();
            rowdef57.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef57);
            ColumnDefinition rowdef58 = new ColumnDefinition();
            rowdef58.Width = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(rowdef58);

            RowDefinition coldef50 = new RowDefinition();
            coldef50.Height = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(coldef50);
            RowDefinition coldef51 = new RowDefinition();
            coldef51.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(coldef51);
            RowDefinition coldef52 = new RowDefinition();
            RowDefinition coldef54 = new RowDefinition();
            coldef54.Height = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(coldef54);

            Grid.SetColumn(menuPanelButtonGrid, 0);
            Grid.SetColumnSpan(menuPanelButtonGrid, 1);
            Grid.SetRow(menuPanelButtonGrid, 0);
            Grid.SetRowSpan(menuPanelButtonGrid, 1);

            Grid.SetColumn(menuPanelButton1, 1);
            Grid.SetRow(menuPanelButton1, 1);
            Grid.SetColumn(menuPanelButton2, 2);
            Grid.SetRow(menuPanelButton2, 1);
            Grid.SetColumn(menuPanelButton3, 3);
            Grid.SetRow(menuPanelButton3, 1);
            Grid.SetColumn(menuPanelButton4, 4);
            Grid.SetRow(menuPanelButton4, 1);
            Grid.SetColumn(menuPanelButton5, 5);
            Grid.SetRow(menuPanelButton5, 1);

            Grid.SetColumn(menuPanelInfoGrid, 1);
            Grid.SetRow(menuPanelInfoGrid, 0);

            //mappanel zmeny

            Grid.SetColumn(MapPanel, 0);
            Grid.SetColumnSpan(MapPanel, 11);
            Grid.SetRow(MapPanel, 0);
            Grid.SetRowSpan(MapPanel, 6);

            MapPanel.RowDefinitions.Clear();
            MapPanel.ColumnDefinitions.Clear();

            RowDefinition rowdef62 = new RowDefinition();
            rowdef62.Height = new GridLength(1, GridUnitType.Star);
            MapPanel.RowDefinitions.Add(rowdef62);
            RowDefinition rowdef63 = new RowDefinition();
            rowdef63.Height = new GridLength(1, GridUnitType.Star);
            MapPanel.RowDefinitions.Add(rowdef63);
            RowDefinition rowdef64 = new RowDefinition();
            rowdef64.Height = new GridLength(4, GridUnitType.Star);
            MapPanel.RowDefinitions.Add(rowdef64);

            ColumnDefinition coldef61 = new ColumnDefinition();
            coldef61.Width = new GridLength(10, GridUnitType.Star);
            MapPanel.ColumnDefinitions.Add(coldef61);
            ColumnDefinition coldef62 = new ColumnDefinition();
            coldef62.Width = new GridLength(1, GridUnitType.Star);
            MapPanel.ColumnDefinitions.Add(coldef62);


            Grid.SetColumn(mapPanelSubGrid, 0);
            Grid.SetColumnSpan(mapPanelSubGrid, 1);
            Grid.SetRow(mapPanelSubGrid, 0);
            Grid.SetRowSpan(mapPanelSubGrid, 3);



            /////mappanel konec

            statusCOTxt.Text = Data.getString_CO();
            statusSOTxt.Text = Data.getString_SO2();
            statusPOTxt.Text = Data.getString_PM10();
            statusOTxt.Text = Data.getString_O3();
            statusNOTxt.Text = Data.getString_NO2();
            

            //POSUNUTI PANELU
            MapPanel.Margin = new Thickness(-((Window.Current.Bounds.Width / 11) * 10), 0, ((Window.Current.Bounds.Width / 11) * 10), 0);
            DataPanel.Margin = new Thickness(0, ((Window.Current.Bounds.Height / 6) * 4), 0, -((Window.Current.Bounds.Height / 6) * 4));
            MenuPanel.Margin = new Thickness(0, -((Window.Current.Bounds.Height / 6) * 2), 0, ((Window.Current.Bounds.Height / 6) * 2));

            //UMISTENI BUTTONU
            Grid.SetColumn(menubutton, 1);
            Grid.SetRow(menubutton, 1);
            Grid.SetColumn(databutton, 1);
            Grid.SetRow(databutton, 0);
            Grid.SetColumn(mapbutton, 1);
            Grid.SetRow(mapbutton, 1);


            //ZAROVNANI ELEMENTU DATAPANELU
            statuses.Height = dataPanelStck.Height;
            statuses.Width = dataPanelStck.Height;
            bars.Height = dataPanelStck.Height;
            bars.Width = dataPanelStck.Height;
            legend.Height = dataPanelStck.Height;
            legend.Width = dataPanelStck.Height;

            //MALE STATUSY a obrazky
            setStatusesLandscape();
            setImagesLandscape();

            //animace pro landscape
            setAnimationsLandscape();

            //infopanel
            Grid.SetRow(infoTile, 5);
            Grid.SetColumn(infoTile, 10);
            //Grid.SetRow(gpsTile, 5);
            //Grid.SetColumn(gpsTile, 8);
        }
        /// <summary>
        /// Funkce obsluhujici zmeny v zobrazeni pri vertikalnim stavu. Jedna se hlavne o zmeny vlastnosti gridu, panelu
        /// a podobne.
        /// </summary>
        private void setPortraitChanges() 
        {
            //layoutroot zmeny 

            LayoutRoot.ColumnDefinitions.Clear();
            LayoutRoot.RowDefinitions.Clear();



            RowDefinition rowdef21 = new RowDefinition();
            rowdef21.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef21);
            RowDefinition rowdef22 = new RowDefinition();
            rowdef22.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef22);
            RowDefinition rowdef23 = new RowDefinition();
            rowdef23.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef23);
            RowDefinition rowdef24 = new RowDefinition();
            rowdef24.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef24);
            RowDefinition rowdef25 = new RowDefinition();
            rowdef25.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef25);
            RowDefinition rowdef26 = new RowDefinition();
            rowdef26.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef26);
            RowDefinition rowdef27 = new RowDefinition();
            rowdef27.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef27);
            RowDefinition rowdef28 = new RowDefinition();
            rowdef28.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef28);
            RowDefinition rowdef29 = new RowDefinition();
            rowdef29.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef29);
            RowDefinition rowdef210 = new RowDefinition();
            rowdef210.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef210);
            RowDefinition rowdef211 = new RowDefinition();
            rowdef211.Height = new GridLength(1, GridUnitType.Star);
            LayoutRoot.RowDefinitions.Add(rowdef211);



            ColumnDefinition coldef21 = new ColumnDefinition();
            coldef21.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef21);
            ColumnDefinition coldef22 = new ColumnDefinition();
            coldef22.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef22);
            ColumnDefinition coldef23 = new ColumnDefinition();
            coldef23.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef23);
            ColumnDefinition coldef24 = new ColumnDefinition();
            coldef24.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef24);
            ColumnDefinition coldef25 = new ColumnDefinition();
            coldef25.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef25);
            ColumnDefinition coldef26 = new ColumnDefinition();
            coldef26.Width = new GridLength(1, GridUnitType.Star);
            LayoutRoot.ColumnDefinitions.Add(coldef26);

            
            
            //layoutgrid zmeny
            LayoutGrid.ColumnDefinitions.Clear();
            LayoutGrid.RowDefinitions.Clear();

            Grid.SetRowSpan(LayoutGrid, 11);
            Grid.SetColumnSpan(LayoutGrid, 6);

            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef3);
            RowDefinition rowdef4 = new RowDefinition();
            rowdef4.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef4);
            RowDefinition rowdef5 = new RowDefinition();
            rowdef5.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef5);
            RowDefinition rowdef6 = new RowDefinition();
            rowdef6.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef6);
            RowDefinition rowdef7 = new RowDefinition();
            rowdef7.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef7);
            RowDefinition rowdef8 = new RowDefinition();
            rowdef8.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef8);
            RowDefinition rowdef9 = new RowDefinition();
            rowdef9.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef9);
            RowDefinition rowdef10 = new RowDefinition();
            rowdef10.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef10);
            RowDefinition rowdef11 = new RowDefinition();
            rowdef11.Height = new GridLength(1, GridUnitType.Star);
            LayoutGrid.RowDefinitions.Add(rowdef11);



            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef5);
            ColumnDefinition coldef6 = new ColumnDefinition();
            coldef6.Width = new GridLength(1, GridUnitType.Star);
            LayoutGrid.ColumnDefinitions.Add(coldef6);
            


            Random random = new Random();

            foreach (FrameworkElement element in blankTileCollection)
            {

                Grid.SetColumn(element, blankTileCollection.IndexOf(element) / 11);
                Grid.SetRow(element, blankTileCollection.IndexOf(element) % 11);
            }

            foreach (FrameworkElement element in statusCollection)
            {

                Grid.SetColumn(element, random.Next(1, 4));
                Grid.SetRow(element, random.Next(5,9));
            }

            Grid.SetRow(mainstatus, 2);
            Grid.SetColumn(mainstatus, 2);
            
            foreach (FrameworkElement element in imageCollection)
            {

                Grid.SetColumn(element, random.Next(1,4));
                Grid.SetRow(element, random.Next(1, 9));
            }

            //zmeny na datapanelu
            Grid.SetColumn(DataPanel, 0);
            Grid.SetColumnSpan(DataPanel, 5);
            Grid.SetRow(DataPanel, 0);
            Grid.SetRowSpan(DataPanel, 11);

            DataPanel.RowDefinitions.Clear();
            DataPanel.ColumnDefinitions.Clear();

            RowDefinition rowdef12 = new RowDefinition();
            rowdef12.Height = new GridLength(1, GridUnitType.Star);
            DataPanel.RowDefinitions.Add(rowdef12);
            RowDefinition rowdef13 = new RowDefinition();
            rowdef13.Height = new GridLength(1, GridUnitType.Star);
            DataPanel.RowDefinitions.Add(rowdef13);
            RowDefinition rowdef14 = new RowDefinition();
            rowdef14.Height = new GridLength(9, GridUnitType.Star);
            DataPanel.RowDefinitions.Add(rowdef14);

            ColumnDefinition coldef11 = new ColumnDefinition();
            coldef11.Width = new GridLength(4, GridUnitType.Star);
            DataPanel.ColumnDefinitions.Add(coldef11);
            ColumnDefinition coldef12 = new ColumnDefinition();
            coldef12.Width = new GridLength(1, GridUnitType.Star);
            DataPanel.ColumnDefinitions.Add(coldef12);            


            Grid.SetColumn(dataPanelScrl, 0);
            Grid.SetColumnSpan(dataPanelScrl, 1);
            Grid.SetRow(dataPanelScrl, 0);
            Grid.SetRowSpan(dataPanelScrl, 3);

            dataPanelStck.Orientation = Orientation.Vertical;

            Grid.SetColumn(dataPanelButtonBackgroundPanel, 0);
            Grid.SetColumnSpan(dataPanelButtonBackgroundPanel, 2);
            Grid.SetRow(dataPanelButtonBackgroundPanel, 1);
            Grid.SetRowSpan(dataPanelButtonBackgroundPanel, 1);

            //menupanel zemny

            MenuPanel.ColumnDefinitions.Clear();
            MenuPanel.RowDefinitions.Clear();

            RowDefinition rowdef32 = new RowDefinition();
            rowdef32.Height = new GridLength(9, GridUnitType.Star);
            MenuPanel.RowDefinitions.Add(rowdef32);
            RowDefinition rowdef33 = new RowDefinition();
            rowdef33.Height = new GridLength(1, GridUnitType.Star);
            MenuPanel.RowDefinitions.Add(rowdef33);
            RowDefinition rowdef34 = new RowDefinition();
            rowdef34.Height = new GridLength(1, GridUnitType.Star);
            MenuPanel.RowDefinitions.Add(rowdef34);

            ColumnDefinition coldef31 = new ColumnDefinition();
            coldef31.Width = new GridLength(1, GridUnitType.Star);
            MenuPanel.ColumnDefinitions.Add(coldef31);
            ColumnDefinition coldef32 = new ColumnDefinition();
            coldef32.Width = new GridLength(2, GridUnitType.Star);
            MenuPanel.ColumnDefinitions.Add(coldef32);

            Grid.SetColumn(MenuPanel, 1);
            Grid.SetColumnSpan(MenuPanel, 3);
            Grid.SetRow(MenuPanel, 0);
            Grid.SetRowSpan(MenuPanel, 11);

            MenuPanelSubGrid.ColumnDefinitions.Clear();
            MenuPanelSubGrid.RowDefinitions.Clear();

            RowDefinition rowdef42 = new RowDefinition();
            rowdef42.Height = new GridLength(6, GridUnitType.Star);
            MenuPanelSubGrid.RowDefinitions.Add(rowdef42);
            RowDefinition rowdef43 = new RowDefinition();
            rowdef43.Height = new GridLength(5, GridUnitType.Star);
            MenuPanelSubGrid.RowDefinitions.Add(rowdef43);

            Grid.SetColumn(MenuPanelSubGrid, 1);
            Grid.SetColumnSpan(MenuPanelSubGrid, 1);
            Grid.SetRow(MenuPanelSubGrid, 0);
            Grid.SetRowSpan(MenuPanelSubGrid, 3);

            menuPanelButtonGrid.ColumnDefinitions.Clear();
            menuPanelButtonGrid.RowDefinitions.Clear();

            RowDefinition rowdef52 = new RowDefinition();
            rowdef52.Height = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef52);
            RowDefinition rowdef53 = new RowDefinition();
            rowdef53.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef53);
            RowDefinition rowdef54 = new RowDefinition();
            rowdef54.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef54);
            RowDefinition rowdef55 = new RowDefinition();
            rowdef55.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef55);
            RowDefinition rowdef56 = new RowDefinition();
            rowdef56.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef56);
            RowDefinition rowdef57 = new RowDefinition();
            rowdef57.Height = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef57);
            RowDefinition rowdef58 = new RowDefinition();
            rowdef58.Height = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.RowDefinitions.Add(rowdef58);

            ColumnDefinition coldef50 = new ColumnDefinition();
            coldef50.Width = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(coldef50);
            ColumnDefinition coldef51 = new ColumnDefinition();
            coldef51.Width = new GridLength(2, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(coldef51);            
            ColumnDefinition coldef54 = new ColumnDefinition();
            coldef54.Width = new GridLength(1, GridUnitType.Star);
            menuPanelButtonGrid.ColumnDefinitions.Add(coldef54);

            Grid.SetColumn(menuPanelButtonGrid, 0);
            Grid.SetColumnSpan(menuPanelButtonGrid, 1);
            Grid.SetRow(menuPanelButtonGrid, 0);
            Grid.SetRowSpan(menuPanelButtonGrid, 1);


            Grid.SetColumn(menuPanelButton1, 1);
            Grid.SetRow(menuPanelButton1, 1);
            Grid.SetColumn(menuPanelButton2, 1);
            Grid.SetRow(menuPanelButton2, 2);
            Grid.SetColumn(menuPanelButton3, 1);
            Grid.SetRow(menuPanelButton3, 3);
            Grid.SetColumn(menuPanelButton4, 1);
            Grid.SetRow(menuPanelButton4, 4);
            Grid.SetColumn(menuPanelButton5, 1);
            Grid.SetRow(menuPanelButton5, 5);


            Grid.SetColumn(menuPanelInfoGrid, 0);
            Grid.SetRow(menuPanelInfoGrid, 1);
            
            
            //naaktualizovani hodnot
            statusCOTxt.Text = Data.getString_CO();
            statusCOValue.Text = Data.getValue_CO().ToString();
            statusCOClr.Background = Data.getColorAndStatus(Data.getStatus_CO()).Item1;
            statusSOTxt.Text = Data.getString_SO2();
            statusSOValueTxt.Text = Data.getValue_SO2().ToString();
            statusSOClr.Background = Data.getColorAndStatus(Data.getStatus_SO2()).Item1;
            statusPOTxt.Text = Data.getString_PM10();
            statusPOValue.Text = Data.getValue_PM10().ToString();
            statusPOClr.Background = Data.getColorAndStatus(Data.getStatus_PM10()).Item1;
            statusOTxt.Text = Data.getString_O3();
            statusOValue.Text = Data.getValue_O3().ToString();
            statusOClr.Background = Data.getColorAndStatus(Data.getStatus_O3()).Item1;
            statusNOTxt.Text = Data.getString_NO2();
            statusNOValue.Text = Data.getValue_NO2().ToString();
            statusNOClr.Background = Data.getColorAndStatus(Data.getStatus_NO2()).Item1;

            mainStatusLbl.Background = Data.getMainColor();

            legendLabelB.Background = Data.getColorAndStatus(Data.StatusName.Bad).Item1;
            legendLabelG.Background = Data.getColorAndStatus(Data.StatusName.Good).Item1;
            legendLabelND.Background = Data.getColorAndStatus(Data.StatusName.NoData).Item1;
            legendLabelNM.Background = Data.getColorAndStatus(Data.StatusName.NoMeasurement).Item1;
            legendLabelSa.Background = Data.getColorAndStatus(Data.StatusName.Satisfying).Item1;
            legendLabelSu.Background = Data.getColorAndStatus(Data.StatusName.Suitable).Item1;
            legendLabelVB.Background = Data.getColorAndStatus(Data.StatusName.VeryBad).Item1;
            legendLabelVG.Background = Data.getColorAndStatus(Data.StatusName.VeryGood).Item1;

            menuPanelButton1.Background = Data.getColorAndStatus(Data.getMainMood()).Item1;
            menuPanelButton2.Background = Data.getColorAndStatus(Data.getMainMood()).Item1;
            menuPanelButton3.Background = Data.getColorAndStatus(Data.getMainMood()).Item1;
            menuPanelButton4.Background = Data.getColorAndStatus(Data.getMainMood()).Item1;
            menuPanelButton5.Background = Data.getColorAndStatus(Data.getMainMood()).Item1;

            //POSUNUTI PANELU
            MapPanel.Margin = new Thickness(0, -((Window.Current.Bounds.Height / 11) * 8), 0, ((Window.Current.Bounds.Height / 11) * 8));
            DataPanel.Margin = new Thickness(-((Window.Current.Bounds.Width / 6) * 4), 0, ((Window.Current.Bounds.Width / 6) * 4), 0);
            MenuPanel.Margin = new Thickness(((Window.Current.Bounds.Width / 6) * 4), 0, -((Window.Current.Bounds.Width / 6) * 4), 0);


            //UMISTENI BUTTONU
            Grid.SetColumn(menubutton, 0);
            Grid.SetRow(menubutton, 1);
            Grid.SetColumn(databutton, 1);
            Grid.SetRow(databutton, 1);
            Grid.SetColumn(mapbutton, 0);
            Grid.SetRow(mapbutton, 0);

            //ZAROVNANI ELEMENTU DATAPANELU
            statuses.Height = dataPanelStck.Width;
            statuses.Width = dataPanelStck.Width;
            bars.Height = dataPanelStck.Width;
            bars.Width = dataPanelStck.Width;
            legend.Height = dataPanelStck.Width;
            legend.Width = dataPanelStck.Width;

            //MALE STATUSY a obrazky
            setStatusesPortrait();
            setImagesPortrait();

            //animace pro portrait
            setAnimationsPortrait();

            //infopanel
            Grid.SetRow(infoTile, 10);
            Grid.SetColumn(infoTile, 0);
            //Grid.SetRow(gpsTile, 8);
            //Grid.SetColumn(gpsTile, 0);

        }
Beispiel #21
0
        private Button CrearBotonAccordion(string titulo, string descripcion)
        {
            Button botonAgregado = new Button();
            Grid grilla = new Grid();
            grilla.Style = App.Current.Resources["GridAccordion"] as Style;

            RowDefinition row = new RowDefinition();
            row.Height = GridLength.Auto;
            grilla.RowDefinitions.Add(row);

            row = new RowDefinition();
            row.Height = GridLength.Auto;
            grilla.RowDefinitions.Add(row);

            TextBlock txtBlockTitulo = new TextBlock();
            txtBlockTitulo.Style = App.Current.Resources["TextAccTitulo"] as Style;
            txtBlockTitulo.Text = titulo;

            TextBlock txtBlockDescripcion = new TextBlock();
            txtBlockDescripcion.Style = App.Current.Resources["TextAccDesc"] as Style;
            txtBlockDescripcion.Text = descripcion;

            Image imgAccordion = new Image();
            BitmapImage bmp = new BitmapImage(new Uri("ms-appx:/Assets/btn_displayagenda.png"));

            imgAccordion.Source = bmp;
            imgAccordion.Width = 25;
            imgAccordion.Style = App.Current.Resources["ImagenAccordion"] as Style;

            grilla.Children.Add(txtBlockTitulo);
            grilla.Children.Add(txtBlockDescripcion);
            grilla.Children.Add(imgAccordion);

            botonAgregado.Content = grilla;
            botonAgregado.Style = App.Current.Resources["BotonAccordionPpal"] as Style;

            return botonAgregado;
        }
        public SegoeSymbolsPage() {
            this.InitializeComponent();

            for (int row = 0; row < 34; row++) {
                RowDefinition rowdef = new RowDefinition();

                if (row == 0 || row % 2 == 1)
                    rowdef.Height = GridLength.Auto;
                else
                    rowdef.Height = new GridLength(CellSize, GridUnitType.Pixel);

                characterGrid.RowDefinitions.Add(rowdef);

                if (row != 0 && row % 2 == 0) {
                    TextBlock txtblk = new TextBlock {
                        Text = (row / 2 - 1).ToString("X1"),
                        VerticalAlignment = VerticalAlignment.Center
                    };
                    Grid.SetRow(txtblk, row);
                    Grid.SetColumn(txtblk, 0);
                    characterGrid.Children.Add(txtblk);
                }

                if (row % 2 == 1) {
                    Rectangle rectangle = new Rectangle {
                        Stroke = this.Foreground,
                        StrokeThickness = row == 1 || row == 33 ? 1.5 : 0.5,
                        Height = 1
                    };
                    Grid.SetRow(rectangle, row);
                    Grid.SetColumn(rectangle, 0);
                    Grid.SetColumnSpan(rectangle, 34);
                    characterGrid.Children.Add(rectangle);
                }
            }

            for (int col = 0; col < 34; col++) {
                ColumnDefinition coldef = new ColumnDefinition();

                if (col == 0 || col % 2 == 1)
                    coldef.Width = GridLength.Auto;
                else
                    coldef.Width = new GridLength(CellSize);

                characterGrid.ColumnDefinitions.Add(coldef);

                if (col != 0 && col % 2 == 0) {
                    TextBlock txtblk = new TextBlock {
                        Text = "00" + (col / 2 - 1).ToString("X1") + "_",
                        HorizontalAlignment = HorizontalAlignment.Center
                    };
                    Grid.SetRow(txtblk, 0);
                    Grid.SetColumn(txtblk, col);
                    characterGrid.Children.Add(txtblk);
                    txtblkColumnHeads[col / 2 - 1] = txtblk;
                }

                if (col % 2 == 1) {
                    Rectangle rectangle = new Rectangle {
                        Stroke = this.Foreground,
                        StrokeThickness = col == 1 || col == 33 ? 1.5 : 0.5,
                        Width = 1
                    };
                    Grid.SetRow(rectangle, 0);
                    Grid.SetColumn(rectangle, col);
                    Grid.SetRowSpan(rectangle, 34);
                    characterGrid.Children.Add(rectangle);
                }
            }

            for (int col = 0; col < 16; col++) {
                for (int row = 0; row < 16; row++) {
                    TextBlock txtblk = new TextBlock {
                        Text = ((char)(16 * col + row)).ToString(),
                        FontFamily = symbolFont,
                        FontSize = 24,
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment = VerticalAlignment.Center
                    };
                    Grid.SetRow(txtblk, 2 * row + 2);
                    Grid.SetColumn(txtblk, 2 * col + 2);
                    characterGrid.Children.Add(txtblk);
                    txtblkCharacters[col, row] = txtblk;
                }
            }
        }
Beispiel #23
0
        private void InsertOrders(OrderType type)
        {
            orderGrid.Children.Clear();
            orderGrid.RowDefinitions.Clear();
            orderGrid.ColumnDefinitions.Clear();
            List<OrderInfo> orders = null;
            switch(type)
            {
                case OrderType.NOT_PAY:
                    orders = notPayOrders;
                    break;
                case OrderType.PAYED:
                    orders = payedOrders;
                    break;
                case OrderType.COMPLETED:
                    orders = completedOrders;
                    break;
                default:
                    break;
            }
            if(null == orders)
            {
                return;
            }
            int count = orders.Count;
            for(int i=0; i<count; i++)
            {
                RowDefinition row = new RowDefinition();
                //row.Height = new GridLength(orderGridSizeInfo.orderGridHeight);
                orderGrid.RowDefinitions.Add(row);
            }
            int nRow = 0;
            foreach(var item in orders)
            {
                Grid oneOrderGrid = new Grid();
                oneOrderGrid.Background = new SolidColorBrush(Color.FromArgb(255,235,235,235));                          
                            
                //Init four panels
                RelativePanel topPanel = new RelativePanel();
                topPanel.Background = new SolidColorBrush(Color.FromArgb(255,241,241,241));
                topPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin;
                topPanel.Width = infoPanel.Width;
                Grid.SetColumn(topPanel, 0);
                Grid.SetRow(topPanel, 0);
                oneOrderGrid.Children.Add(topPanel);

                RelativePanel addressPanel = new RelativePanel();
                addressPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin;
                addressPanel.Width = infoPanel.Width;
                addressPanel.Background = new SolidColorBrush(Color.FromArgb(255, 241, 241, 241));
                Grid.SetColumn(addressPanel, 0);
                Grid.SetRow(addressPanel, 2);
                oneOrderGrid.Children.Add(addressPanel);

                //goods panel
                RelativePanel goodsGridPanel = new RelativePanel();              
                goodsGridPanel.Background = new SolidColorBrush(Color.FromArgb(255, 235, 235, 235));
                //goodsGridPanel.Width = infoPanel.Width;
                goodsGridPanel.Height = orderGridSizeInfo.goodsPicHeight + 4 * orderGridSizeInfo.margin + orderGridSizeInfo.infoPanelHeight*2;

                //SlidePanel slidePanel = new SlidePanel(infoPanel.Width);
                //slidePanel.Add(goodsGridPanel,orderGridSizeInfo.goodsPicWidth);
                //Grid.SetColumn(slidePanel, 0);
                //Grid.SetRow(slidePanel, 1);
                //oneOrderGrid.Children.Add(slidePanel);

                //Grid.SetColumn(goodsGridPanel, 0);
                //Grid.SetRow(goodsGridPanel, 1);
                //oneOrderGrid.Children.Add(goodsGridPanel);

                RelativePanel buttonPanel = new RelativePanel();
                buttonPanel.Background = new SolidColorBrush(Color.FromArgb(255, 241, 241, 241));
                buttonPanel.Width = infoPanel.Width;
                buttonPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin*2;
                Grid.SetColumn(buttonPanel, 0);
                Grid.SetRow(buttonPanel, 3);
                buttonPanel.VerticalAlignment = VerticalAlignment.Top;
                oneOrderGrid.Children.Add(buttonPanel);

                RowDefinition topRow = new RowDefinition();
                topRow.Height = new GridLength(topPanel.Height);
                oneOrderGrid.RowDefinitions.Add(topRow);
                RowDefinition goodsGridRow = new RowDefinition();
                goodsGridRow.Height = new GridLength(goodsGridPanel.Height);
                oneOrderGrid.RowDefinitions.Add(goodsGridRow);
                RowDefinition addressRow = new RowDefinition();
                addressRow.Height = new GridLength(addressPanel.Height);
                oneOrderGrid.RowDefinitions.Add(addressRow);
                RowDefinition buttonRow = new RowDefinition();
                buttonRow.Height = new GridLength(buttonPanel.Height + orderGridSizeInfo.margin);
                oneOrderGrid.RowDefinitions.Add(buttonRow);

                #region order info panel items
                TextBlock topLeft = new TextBlock();
                topLeft.Width = 80;
                topLeft.Height = orderGridSizeInfo.infoPanelHeight;
                topLeft.Text = "订单号";
                topLeft.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51));
                topLeft.Margin = new Thickness(20, 0, 0, 0);
                topLeft.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
                topLeft.SetValue(RelativePanel.AlignBottomWithPanelProperty, true);
                topPanel.Children.Add(topLeft);

                TextBlock topRight = new TextBlock();
                topRight.Width = 150;
                topRight.Height = orderGridSizeInfo.infoPanelHeight;
                topRight.Text = item.id;
                topRight.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51));
                topRight.Margin = new Thickness(0, 0, 20, 0);
                topRight.SetValue(RelativePanel.AlignRightWithPanelProperty, true);
                topRight.SetValue(RelativePanel.AlignBottomWithPanelProperty, true);
                topRight.TextAlignment = TextAlignment.Right;
                topPanel.Children.Add(topRight);
                #endregion

                #region address panel item
                TextBlock addressLeft = new TextBlock();
                addressLeft.Width = topPanel.Width / 2;
                addressLeft.Height = orderGridSizeInfo.infoPanelHeight;
                addressLeft.Margin = new Thickness(20,0,0,0);
                addressLeft.Text = "配送地址";
                addressLeft.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51));
                addressLeft.SetValue(RelativePanel.AlignLeftWithPanelProperty, true);
                addressLeft.SetValue(RelativePanel.AlignBottomWithPanelProperty, true);
                addressPanel.Children.Add(addressLeft);
               
                TextBlock addressRight = new TextBlock();
                addressRight.Width = 150;
                addressRight.Height = orderGridSizeInfo.infoPanelHeight;
                addressRight.Text = item.address;
                addressRight.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51));
                addressRight.Margin = new Thickness(0,0,20,0);
                addressRight.TextAlignment = TextAlignment.Right;
                addressRight.SetValue(RelativePanel.AlignRightWithPanelProperty, true);
                addressRight.SetValue(RelativePanel.AlignBottomWithPanelProperty, true);
                addressPanel.Children.Add(addressRight);
                #endregion

                #region button panel item
                TextBlock priceText = new TextBlock();
                priceText.Width = 12;
                priceText.Height = 20;
                priceText.Text = "¥";
                priceText.Name = "priceText";
                priceText.Foreground = new SolidColorBrush(Color.FromArgb(255,253,40,3));
                priceText.TextAlignment = TextAlignment.Left;
                priceText.SetValue(RelativePanel.AlignLeftWithPanelProperty, true);
                priceText.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true);
                priceText.Margin = new Thickness(17, 0, 0, -32);
                buttonPanel.Children.Add(priceText);

                TextBlock priceNumberText = new TextBlock();
                priceNumberText.Width = 70;
                priceNumberText.Height = orderGridSizeInfo.infoPanelHeight;
                priceNumberText.Text = item.price;
                priceNumberText.Foreground = new SolidColorBrush(Colors.Red);
                priceNumberText.FontSize = 20;
                priceNumberText.TextAlignment = TextAlignment.Left;
                priceNumberText.SetValue(RelativePanel.RightOfProperty, "priceText");
                priceNumberText.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true);
                priceNumberText.Margin = new Thickness(3, 0, 0, 0);
                buttonPanel.Children.Add(priceNumberText);

                Button btnPay = new Button();
                if (item.payed.Equals("true"))
                {
                    btnPay.Visibility = Visibility.Collapsed;
                }
                btnPay.Width = 100;
                btnPay.Height = orderGridSizeInfo.infoPanelHeight;
                btnPay.VerticalContentAlignment = VerticalAlignment.Center;
                btnPay.HorizontalContentAlignment = HorizontalAlignment.Center;
                btnPay.BorderThickness = new Thickness(0);
                btnPay.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 78, 0));
                btnPay.Name = "btnPay";
                TextBlock btnPayText = new TextBlock();
                btnPayText.Text = "进行付款";               
                btnPayText.Foreground = new SolidColorBrush(Colors.White);                
                btnPay.Content = btnPayText;
                //btnPay.Foreground = new SolidColorBrush(Colors.White);
                btnPay.Background = new SolidColorBrush(Color.FromArgb(255,255,78,0));
                btnPay.SetValue(RelativePanel.AlignRightWithPanelProperty,true);
                btnPay.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true);
                btnPay.Margin  = new Thickness(0, 0, 20, 0);
                buttonPanel.Children.Add(btnPay);           

                Button btnCancel = new Button();
                btnCancel.Width = 100;
                btnCancel.Height = orderGridSizeInfo.infoPanelHeight;
                btnCancel.VerticalContentAlignment = VerticalAlignment.Center;
                btnCancel.HorizontalContentAlignment = HorizontalAlignment.Center;
                //btnCancel.Content = "取消订单";
                TextBlock btnCancelText = new TextBlock();
                btnCancelText.Text = "取消订单";
                btnCancelText.Foreground = new SolidColorBrush(Colors.White);                
                btnCancel.Content = btnCancelText;
                btnCancel.BorderThickness = new Thickness(0);
                btnCancel.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 148, 148, 148));
                //btnCancel.Foreground = new SolidColorBrush(Colors.White);
                btnCancel.Background = new SolidColorBrush(Color.FromArgb(255,148,148,148));
                btnCancel.Margin = new Thickness(0, 0, 5, 0);
                btnCancel.SetValue(RelativePanel.LeftOfProperty, "btnPay");
                btnCancel.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true);
                buttonPanel.Children.Add(btnCancel);
                #endregion

                #region goods detail panel item                            
                int goodsCount = item.goodsList.Count;            
                double goodsGridPanelWidth = 0;
                for(int i=0; i< goodsCount; i++)
                {
                    RelativePanel goodsItemPanel = new RelativePanel();
                    goodsItemPanel.Background = new SolidColorBrush(Color.FromArgb(255,224,224,224));
                    goodsItemPanel.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
                    goodsItemPanel.Margin = new Thickness(goodsGridPanelWidth + orderGridSizeInfo.margin,0,0,0);
                    //goods name
                    TextBlock goodsNameText = new TextBlock();
                    goodsNameText.Width = 60;
                    goodsNameText.Height = orderGridSizeInfo.infoPanelHeight - 5;
                    goodsNameText.Text = item.goodsList[i].name;
                    goodsNameText.TextAlignment = TextAlignment.Left;
                    goodsNameText.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51));
                    goodsNameText.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
                    goodsNameText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
                    goodsNameText.Margin = new Thickness(orderGridSizeInfo.margin,0,0,orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(goodsNameText);

                    //goods number
                    TextBlock numberText = new TextBlock();
                    numberText.Height = orderGridSizeInfo.infoPanelHeight - 5;
                    numberText.Width = 25;
                    numberText.Name = "number";
                    numberText.TextAlignment = TextAlignment.Right;
                    numberText.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51));
                    numberText.Text = "x" + Convert.ToString(item.goodsList[i].count);
                    numberText.SetValue(RelativePanel.AlignRightWithPanelProperty,true);
                    numberText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
                    numberText.Margin = new Thickness(0,0, orderGridSizeInfo.margin, orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(numberText);

                    //goods price
                    TextBlock singlePriceText = new TextBlock();
                    singlePriceText.Height = orderGridSizeInfo.infoPanelHeight;
                    singlePriceText.Width = 30;
                    singlePriceText.Name = "singlePriceText";
                    singlePriceText.TextAlignment = TextAlignment.Left;
                    singlePriceText.FontSize = 20;
                    singlePriceText.Foreground = new SolidColorBrush(Color.FromArgb(255, 253, 40, 3));
                    singlePriceText.Text = item.goodsList[i].price;
                    singlePriceText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
                    singlePriceText.SetValue(RelativePanel.LeftOfProperty, "number");
                    singlePriceText.Margin = new Thickness(0,0,0, orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(singlePriceText);

                    TextBlock priceSymbol = new TextBlock();
                    priceSymbol.Height = orderGridSizeInfo.infoPanelHeight - 5;
                    priceSymbol.Width = 20;
                    priceSymbol.TextAlignment = TextAlignment.Right;
                    priceSymbol.FontSize = 16;
                    priceSymbol.Foreground = new SolidColorBrush(Color.FromArgb(255, 253, 40, 3));
                    priceSymbol.Text = "¥";
                    priceSymbol.SetValue(RelativePanel.AlignBottomWithPanelProperty,true);
                    priceSymbol.SetValue(RelativePanel.LeftOfProperty, "singlePriceText");
                    priceSymbol.Margin = new Thickness(0, 0, 0, orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(priceSymbol);

                    //pictrue name
                    TextBlock picNameText = new TextBlock();
                    picNameText.Name = "picNameText";
                    picNameText.Height = orderGridSizeInfo.infoPanelHeight;
                    picNameText.Width = orderGridSizeInfo.goodsPicWidth;
                    picNameText.Text = item.goodsList[i].imageName;
                    picNameText.TextAlignment = TextAlignment.Left;
                    picNameText.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51));
                    picNameText.FontSize = 18;
                    picNameText.SetValue(RelativePanel.AlignLeftWithPanelProperty,true);
                    picNameText.SetValue(RelativePanel.AboveProperty, "singlePriceText");
                    picNameText.Margin = new Thickness(orderGridSizeInfo.margin, 0, 0, orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(picNameText);

                    //goods picture
                    Grid picGrid = new Grid();
                    RowDefinition row = new RowDefinition();
                    row.Height = new GridLength(orderGridSizeInfo.goodsPicHeight);
                    ColumnDefinition col = new ColumnDefinition();
                    col.Width = new GridLength(orderGridSizeInfo.goodsPicWidth);
                    picGrid.RowDefinitions.Add(row);
                    picGrid.ColumnDefinitions.Add(col);
                    Border border = new Border();
                    border.BorderBrush = new SolidColorBrush(Colors.White);
                    border.BorderThickness = new Thickness(1);
                    border.CornerRadius = new CornerRadius(3, 3, 3, 3);
                    border.Background = item.goodsList[i].brush;
                    picGrid.Children.Add(border);
                    picGrid.SetValue(RelativePanel.AlignLeftWithPanelProperty, true);
                    picGrid.SetValue(RelativePanel.AlignRightWithPanelProperty,true);
                    picGrid.SetValue(RelativePanel.AlignTopWithPanelProperty,true);
                    picGrid.SetValue(RelativePanel.AboveProperty, "picNameText");
                    picGrid.Margin = new Thickness(orderGridSizeInfo.margin, orderGridSizeInfo.margin, orderGridSizeInfo.margin, orderGridSizeInfo.margin);
                    goodsItemPanel.Children.Add(picGrid);

                    goodsGridPanelWidth += (orderGridSizeInfo.goodsPicWidth + 3*orderGridSizeInfo.margin);
                    goodsGridPanel.Children.Add(goodsItemPanel);
                }              
                SlidePanel slidePanel = new SlidePanel(infoPanel.Width);
                goodsGridPanel.Width = goodsGridPanelWidth;
                slidePanel.Add(goodsGridPanel, orderGridSizeInfo.goodsPicWidth + orderGridSizeInfo.margin);
                Grid.SetColumn(slidePanel, 0);
                Grid.SetRow(slidePanel, 1);
                oneOrderGrid.Children.Add(slidePanel);
                #endregion



                Grid.SetColumn(oneOrderGrid, 0);
                Grid.SetRow(oneOrderGrid, nRow);
                orderGrid.Children.Add(oneOrderGrid);
                nRow++;
            }
        }
        private void CreateControl()
        {
            var grid = new Grid();
            int rowIndex = 0;

            var margin = new Thickness {Top = 24};

            grid.Margin = margin;

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

            Grid.SetRow(sketchModeText, rowIndex++);

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

            var grayRadioButton = new RadioButton { Padding = padding, GroupName = SketchModeGroup };

            var textBlock = new TextBlock { Text = _resourceLoader.GetString("Gray/Text") };

            grayRadioButton.Content = textBlock;
            grayRadioButton.Checked += grayRadioButton_Checked;
            Grid.SetRow(grayRadioButton, rowIndex++);

            var colorRadioButton = new RadioButton { Padding = padding, GroupName = SketchModeGroup };

            textBlock = new TextBlock { Text = _resourceLoader.GetString("Color/Text") };

            colorRadioButton.Content = textBlock;
            colorRadioButton.Checked += colorRadioButton_Checked;
            Grid.SetRow(colorRadioButton, rowIndex++);

            if (_sketchFilter.SketchMode == SketchMode.Gray)
            {
                grayRadioButton.IsChecked = true;
            }
            else
            {
                colorRadioButton.IsChecked = true;
            }

            for (int i = 0; i < rowIndex; ++i)
            {
                var rowDefinition = new RowDefinition();

                if (i == 0)
                {
                    rowDefinition.MinHeight = FilterControlTitleFontSize;
                    rowDefinition.MaxHeight = FilterControlTitleFontSize;
                }
                else if (i < rowIndex - 1)
                {
                    rowDefinition.MinHeight = GridRowMinimumHeight;
                    rowDefinition.MaxHeight = GridRowMaxHeight;
                }
                else
                {
                    rowDefinition.Height = GridLength.Auto;
                }

                grid.RowDefinitions.Add(rowDefinition);
            }

            grid.Children.Add(sketchModeText);
            grid.Children.Add(grayRadioButton);
            grid.Children.Add(colorRadioButton);

            Control = grid;
        }
        private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            ColumnDefinitionCollection colDefCol;
            ColumnDefinition colDef;
            RowDefinitionCollection rowDefCol;
            RowDefinition rowDef;

            if (e.NewSize.Width < 720)
            {
                colDefCol = baseGrid.ColumnDefinitions;
                colDefCol.Clear();
                colDef = new ColumnDefinition();
                colDefCol.Add(colDef);

                rowDefCol = baseGrid.RowDefinitions;
                rowDefCol.Clear();
                rowDef = new RowDefinition();
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDefCol.Add(rowDef);

                this.MyUserControl2.SetValue(Grid.ColumnProperty, 0);
                this.MyUserControl2.SetValue(Grid.RowProperty, 2);
                this.MyUserControl2.HorizontalAlignment = HorizontalAlignment.Stretch;
                this.MyUserControl3.SetValue(Grid.ColumnProperty, 0);
                this.MyUserControl3.SetValue(Grid.RowProperty, 3);
                this.MyUserControl3.HorizontalAlignment = HorizontalAlignment.Stretch;
                this.scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                this.scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                this.btnWebview.SetValue(Grid.ColumnProperty, 0);
                this.btnWebview.SetValue(Grid.RowProperty, 4);
                this.MyUserControl4.MinHeight = 400;
            }
            else if (e.NewSize.Width >= 720)
            {
                colDefCol = baseGrid.ColumnDefinitions;
                colDefCol.Clear();
                colDef = new ColumnDefinition();
                colDefCol.Add(colDef);
                colDef = new ColumnDefinition();
                colDefCol.Add(colDef);
                colDef = new ColumnDefinition();
                colDefCol.Add(colDef);

                rowDefCol = baseGrid.RowDefinitions;
                rowDefCol.Clear();
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(1, GridUnitType.Star);
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(8, GridUnitType.Star);
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(1, GridUnitType.Star);
                rowDefCol.Add(rowDef);

                this.MyUserControl2.SetValue(Grid.ColumnProperty, 2);
                this.MyUserControl2.SetValue(Grid.RowProperty, 1);
                this.MyUserControl2.HorizontalAlignment = HorizontalAlignment.Right;
                this.scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
                this.scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
                this.MyUserControl3.SetValue(Grid.ColumnProperty, 2);
                this.MyUserControl3.SetValue(Grid.RowProperty, 1);
                this.MyUserControl3.HorizontalAlignment = HorizontalAlignment.Right;
                this.btnWebview.SetValue(Grid.ColumnProperty, 0);
                this.btnWebview.SetValue(Grid.RowProperty, 2);

                this.MyUserControl4.MinHeight = 0;
            }

            if (e.NewSize.Height < 600 && e.NewSize.Width >= 720)
            {
                this.MyUserControl3.SetValue(Grid.ColumnProperty, 0);
                this.MyUserControl3.SetValue(Grid.RowProperty, 1);
                this.MyUserControl3.HorizontalAlignment = HorizontalAlignment.Left;
                this.MyUserControl3.VerticalAlignment = VerticalAlignment.Top;
                this.MyUserControl1.DresseurImage.Visibility = Visibility.Collapsed;
            }
            else if (e.NewSize.Height >= 600 && e.NewSize.Width >= 720)
            {
                rowDefCol = baseGrid.RowDefinitions;
                rowDefCol.Clear();
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(1, GridUnitType.Auto);
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(8, GridUnitType.Star);
                rowDefCol.Add(rowDef);
                rowDef = new RowDefinition();
                rowDef.Height = new GridLength(1, GridUnitType.Star);
                rowDefCol.Add(rowDef);

                this.MyUserControl3.SetValue(Grid.ColumnProperty, 2);
                this.MyUserControl3.SetValue(Grid.RowProperty, 1);
                this.MyUserControl3.HorizontalAlignment = HorizontalAlignment.Right;
                this.MyUserControl3.VerticalAlignment = VerticalAlignment.Bottom;
                this.MyUserControl1.DresseurImage.Visibility = Visibility.Visible;
            }
        }
Beispiel #26
0
		private void LayoutUpdate()
		{
			if (_loaded == false)
				return;

			_lastLayoutChildCount = Children.Count;

			ColumnDefinitions.Clear();
			RowDefinitions.Clear();

			int index = 0;
			foreach (UIElement child in Children)
			{
				FrameworkElement element = child as FrameworkElement;
				if (element == null)
					continue;

				GridLength length = GetLength(element);
				if (Orientation == Orientation.Horizontal)
				{
					ColumnDefinition definition = new ColumnDefinition { Width = length };
					//if (index == 0)
					//    ColumnDefinitions.Clear();
					ColumnDefinitions.Add(definition);
					SetColumn(element, index++);
					SetColumnSpan(element, 1);
				}
				else
				{
					RowDefinition definition = new RowDefinition { Height = length };
					//if (index == 0)
					//    RowDefinitions.Clear();
					RowDefinitions.Add(definition);
					SetRow(element, index++);
					SetRowSpan(element, 1);
				}
			}
		}
        /// <summary>
        /// Clears GridHighscores-grid, and then adds Textblocks for headers(Player & Score) and each score for its own line
        /// </summary>
        private void UpdateGridScores()
        {
            GridHighscores.Children.Clear();
            GridHighscores.Children.Add(TextBlockPlayer);
            GridHighscores.Children.Add(TextBlockScore);
            int row = 1;
            foreach (PlayerHighScoreItem o in listHighScores)
            {
                RowDefinition rd = new RowDefinition();
                rd.Height = GridLength.Auto;
                ColumnDefinition cd = new ColumnDefinition();
                cd.Width = GridLength.Auto;
                GridHighscores.RowDefinitions.Add(rd);
                GridHighscores.ColumnDefinitions.Add(cd);

                TextBlock name = new TextBlock();
                TextBlock score = new TextBlock();
                name.Text = o.Name;
                score.Text = "" + o.Score;
                name.FontSize = 18;
                score.FontSize = 18;
                Grid.SetRow(name, row);
                Grid.SetRow(score, row);
                Grid.SetColumn(name, 0);
                Grid.SetColumn(score, 1);
                name.Margin = new Thickness(5, 5, 25, 5);
                score.Margin = new Thickness(25, 5, 5, 5);

                row++;
                GridHighscores.Children.Add(name);
                GridHighscores.Children.Add(score);
            }
        }
Beispiel #28
0
        private void InitializeChessBoard()
        {
            ImageBrush whiteBoardBrush = new ImageBrush();   //new SolidColorBrush(Colors.BurlyWood);
            ImageBrush blackBoardBrush = new ImageBrush();   //new SolidColorBrush(Colors.Peru);
            whiteBoardBrush.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/marbleWhite.jpg"));
            blackBoardBrush.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/marbleBlack.jpg"));

            for (int i = 0; i < 8; i++)
            {
                ColumnDefinition columnDefinition = new ColumnDefinition();
                columnDefinition.Width = new GridLength(50);
                RowDefinition rowDefinition = new RowDefinition();
                rowDefinition.Height = new GridLength(50);

                ChessBoard.ColumnDefinitions.Add(columnDefinition);
                ChessBoard.RowDefinitions.Add(rowDefinition);
            }

            // Init black board
            bool isWhite = true;
            for (int row = 0; row < 8; row++)
            {
                for (int col = 0; col < 8; col++)
                {
                    Grid cell = new Grid();
                    cell.Visibility = Visibility.Visible;
                    cell.PointerPressed += new PointerEventHandler(OnCellPointerPressedHandler);

                    if (isWhite)
                    {
                        cell.Background = whiteBoardBrush;
                        ChessBoard.Children.Add(cell);
                    }
                    else
                    {
                        cell.Background = blackBoardBrush;
                        ChessBoard.Children.Add(cell);
                    }

                    isWhite = !isWhite;

                    Grid.SetColumn(cell, col);
                    Grid.SetRow(cell, row);
                }
                isWhite = !isWhite;
            }
        }
Beispiel #29
0
        public async Task <Stream> CreateBitmapAsync(string text, LanguageIndex languageIndex, PaperSizeIndex paperSizeIndex)
        {
            Dictionary <LanguageIndex, Dictionary <PaperSizeIndex, int> > sizeDictionary = new Dictionary <LanguageIndex, Dictionary <PaperSizeIndex, int> >()
            {
                { LanguageIndex.English, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 26 }, { PaperSizeIndex.ThreeInch, 30 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 28 }
                  } },
                { LanguageIndex.Japanese, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 24 }, { PaperSizeIndex.ThreeInch, 25 }, { PaperSizeIndex.FourInch, 26 }, { PaperSizeIndex.EscPosThreeInch, 24 }
                  } },
                { LanguageIndex.French, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 29 }, { PaperSizeIndex.ThreeInch, 30 }, { PaperSizeIndex.FourInch, 30 }, { PaperSizeIndex.EscPosThreeInch, 28 }
                  } },
                { LanguageIndex.Portuguese, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 29 }, { PaperSizeIndex.ThreeInch, 29 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 29 }
                  } },
                { LanguageIndex.Spanish, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 29 }, { PaperSizeIndex.ThreeInch, 30 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 29 }
                  } },
                { LanguageIndex.German, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 29 }, { PaperSizeIndex.ThreeInch, 30 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 29 }
                  } },
                { LanguageIndex.Russian, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 22 }, { PaperSizeIndex.ThreeInch, 25 }, { PaperSizeIndex.FourInch, 26 }, { PaperSizeIndex.EscPosThreeInch, 23 }
                  } },
                { LanguageIndex.SimplifiedChinese, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 24 }, { PaperSizeIndex.ThreeInch, 28 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 27 }
                  } },
                { LanguageIndex.TraditionalChinese, new Dictionary <PaperSizeIndex, int>()
                  {
                      { PaperSizeIndex.TwoInch, 24 }, { PaperSizeIndex.ThreeInch, 29 }, { PaperSizeIndex.FourInch, 29 }, { PaperSizeIndex.EscPosThreeInch, 29 }
                  } }
            };

            Dictionary <LanguageIndex, FontFamily> fontDictionary = new Dictionary <LanguageIndex, FontFamily>()
            {
                { LanguageIndex.English, new FontFamily("MS Gothic") },
                { LanguageIndex.Japanese, new FontFamily("MS Gothic") },
                { LanguageIndex.French, new FontFamily("MS Gothic") },
                { LanguageIndex.Portuguese, new FontFamily("MS Gothic") },
                { LanguageIndex.Spanish, new FontFamily("MS Gothic") },
                { LanguageIndex.German, new FontFamily("MS Gothic") },
                { LanguageIndex.Russian, new FontFamily("Courier New") },
                { LanguageIndex.SimplifiedChinese, new FontFamily("MS Gothic") },
                { LanguageIndex.TraditionalChinese, new FontFamily("MS Gothic") }
            };

            Windows.UI.Xaml.Controls.Grid grid = new Windows.UI.Xaml.Controls.Grid();

            Windows.UI.Xaml.Controls.RowDefinition rowDefinition = new Windows.UI.Xaml.Controls.RowDefinition();
            grid.RowDefinitions.Add(rowDefinition);

            TextBlock textdata = new TextBlock();

            textdata.Text         = text;
            textdata.FontSize     = sizeDictionary[languageIndex][paperSizeIndex];
            textdata.FontFamily   = fontDictionary[languageIndex];
            textdata.Width        = (uint)paperSizeIndex;
            textdata.TextWrapping = TextWrapping.Wrap;

            Windows.UI.Xaml.Controls.Grid.SetRow(textdata, 0);

            grid.Children.Add(textdata);

            StackPanel panel = new StackPanel();

            panel.Background        = new SolidColorBrush(Colors.White);
            panel.VerticalAlignment = VerticalAlignment.Top;
            panel.Orientation       = Orientation.Horizontal;
            panel.Children.Add(grid);

            Popup popup = new Popup();

            double h = Window.Current.Bounds.Height;
            double w = Window.Current.Bounds.Width;

            popup.HorizontalOffset = -h * 2;
            popup.VerticalOffset   = -w * 2;
            popup.Child            = panel;
            popup.IsOpen           = true;

            RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap();
            await renderTargetBitmap.RenderAsync(panel);

            popup.IsOpen = false;
            IBuffer pixelBuffer = await renderTargetBitmap.GetPixelsAsync();

            byte[] pixels = pixelBuffer.ToArray();

            InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream();
            BitmapEncoder encoder             = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);

            encoder.SetPixelData(
                BitmapPixelFormat.Bgra8,
                BitmapAlphaMode.Ignore,
                (uint)renderTargetBitmap.PixelWidth,
                (uint)renderTargetBitmap.PixelHeight,
                72,
                72,
                pixels);

            encoder.BitmapTransform.Rotation          = BitmapRotation.None;
            encoder.BitmapTransform.InterpolationMode = BitmapInterpolationMode.Cubic;
            await encoder.FlushAsync();

            return(stream.AsStream());
        }
Beispiel #30
0
        void InitializeFeaturePage(Grid grid, DependencyProperty chooserProperty, TypographyFeaturePage page)
        {
            if (page == null)
            {
                grid.Children.Clear();
                grid.RowDefinitions.Clear();
            }
            else
            {
                // Get the property value and metadata.
                object value = GetValue(chooserProperty);
                var metadata = (TypographicPropertyMetadata)chooserProperty.GetMetadata(typeof(FontChooser));

                // Look up the sample text.
                string sampleText = (metadata.SampleTextTag != null) ? LookupString(metadata.SampleTextTag) :
                                    _defaultSampleText;

                if (page == _currentFeaturePage)
                {
                    // Update the state of the controls.
                    for (int i = 0; i < page.Items.Length; ++i)
                    {
                        // Check the radio button if it matches the current property value.
                        if (page.Items[i].Value.Equals(value))
                        {
                            var radioButton = (RadioButton)grid.Children[i * 2];
                            radioButton.IsChecked = true;
                        }

                        // Apply properties to the sample text block.
                        var sample = (TextBlock)grid.Children[i * 2 + 1];
                        sample.Text = sampleText;
                        ApplyPropertiesToObjectExcept(sample, chooserProperty);
                        sample.SetValue(metadata.TargetProperty, page.Items[i].Value);
                    }
                }
                else
                {
                    grid.Children.Clear();
                    grid.RowDefinitions.Clear();

                    // Add row definitions.
                    for (int i = 0; i < page.Items.Length; ++i)
                    {
                        var row = new RowDefinition();
                        row.Height = GridLength.Auto;
                        grid.RowDefinitions.Add(row);
                    }

                    // Add the controls.
                    for (int i = 0; i < page.Items.Length; ++i)
                    {
                        string tag = page.Items[i].Tag;
                        var radioContent = new TextBlock(new Run(LookupString(tag)));
                        radioContent.TextWrapping = TextWrapping.Wrap;

                        // Add the radio button.
                        var radioButton = new RadioButton();
                        radioButton.Name = tag;
                        radioButton.Content = radioContent;
                        radioButton.Margin = new Thickness(5.0, 0.0, 0.0, 0.0);
                        radioButton.VerticalAlignment = VerticalAlignment.Center;
                        Grid.SetRow(radioButton, i);
                        grid.Children.Add(radioButton);

                        // Check the radio button if it matches the current property value.
                        if (page.Items[i].Value.Equals(value))
                        {
                            radioButton.IsChecked = true;
                        }

                        // Hook up the event.
						radioButton.Checked += featureRadioButton_Checked;

                        // Add the block with sample text.
                        var sample = new TextBlock(new Run(sampleText));
                        sample.Margin = new Thickness(5.0, 5.0, 5.0, 0.0);
                        sample.TextWrapping = TextWrapping.WrapWithOverflow;
                        ApplyPropertiesToObjectExcept(sample, chooserProperty);
                        sample.SetValue(metadata.TargetProperty, page.Items[i].Value);
                        Grid.SetRow(sample, i);
                        Grid.SetColumn(sample, 1);
                        grid.Children.Add(sample);
                    }

                    // Add borders between rows.
                    for (int i = 0; i < page.Items.Length; ++i)
                    {
                        var border = new Border();
                        border.BorderThickness = new Thickness(0.0, 0.0, 0.0, 1.0);
                        border.BorderBrush = SystemColors.ControlLightBrush;
                        Grid.SetRow(border, i);
                        Grid.SetColumnSpan(border, 2);
                        grid.Children.Add(border);
                    }
                }
            }

            _currentFeature = chooserProperty;
            _currentFeaturePage = page;
        }
        private void StartPreviewDragging(Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            this.isDraggingPreview = true;
            this.previewPopup = new Popup
            {
                Width = this.parentGrid.ActualWidth,
                Height = this.parentGrid.ActualHeight
            };

            this.previewPopup.IsOpen = true;
            this.previewPopupHostGrid = new Grid
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch
            };

            this.parentGrid.Children.Add(this.previewPopupHostGrid);
            if (this.parentGrid.RowDefinitions.Count > 0)
                Grid.SetRowSpan(this.previewPopupHostGrid, this.parentGrid.RowDefinitions.Count);
            if (this.parentGrid.ColumnDefinitions.Count > 0)
                Grid.SetColumnSpan(this.previewPopupHostGrid, this.parentGrid.ColumnDefinitions.Count);
            this.previewPopupHostGrid.Children.Add(this.previewPopup);

            this.previewGrid = new Grid
            {
                Width = this.parentGrid.ActualWidth,
                Height = this.parentGrid.ActualHeight
            };

            this.previewPopup.Child = this.previewGrid;

            foreach (var definition in this.parentGrid.RowDefinitions)
            {
                var definitionCopy = new RowDefinition
                {
                    Height = definition.Height,
                    MaxHeight = definition.MaxHeight,
                    MinHeight = definition.MinHeight
                };

                this.previewGrid.RowDefinitions.Add(definitionCopy);
            }

            foreach (var definition in this.parentGrid.ColumnDefinitions)
            {
                var w = definition.Width;
                var mxw = definition.MaxWidth;
                var mnw = definition.MinWidth;

                var definitionCopy = new ColumnDefinition();

                definitionCopy.Width = w;
                definition.MinWidth = mnw;
                if (!double.IsInfinity(definition.MaxWidth))
                {
                    definition.MaxWidth = mxw;
                }
                //{
                //    Width = definition.Width,
                //    MaxWidth = definition.MaxWidth,
                //    MinWidth = definition.MinWidth
                //};

                this.previewGrid.ColumnDefinitions.Add(definitionCopy);
            }

            this.previewGridSplitter = new CustomGridSplitter
            {
                Opacity = 0.0,
                ShowsPreview = false,
                Width = this.Width,
                Height = this.Height,
                Margin = this.Margin,
                VerticalAlignment = this.VerticalAlignment,
                HorizontalAlignment = this.HorizontalAlignment,
                ResizeBehavior = this.ResizeBehavior,
                ResizeDirection = this.ResizeDirection,
                KeyboardIncrement = this.KeyboardIncrement
            };

            Grid.SetColumn(this.previewGridSplitter, Grid.GetColumn(this));
            var cs = Grid.GetColumnSpan(this);
            if (cs > 0)
                Grid.SetColumnSpan(this.previewGridSplitter, cs);
            Grid.SetRow(this.previewGridSplitter, Grid.GetRow(this));
            var rs = Grid.GetRowSpan(this);
            if (rs > 0)
                Grid.SetRowSpan(this.previewGridSplitter, rs);
            this.previewGrid.Children.Add(this.previewGridSplitter);

            this.previewControlBorder = new Border
            {
                Width = this.Width,
                Height = this.Height,
                Margin = this.Margin,
                VerticalAlignment = this.VerticalAlignment,
                HorizontalAlignment = this.HorizontalAlignment,
            };

            Grid.SetColumn(this.previewControlBorder, Grid.GetColumn(this));
            if (cs > 0)
                Grid.SetColumnSpan(this.previewControlBorder, cs);
            Grid.SetRow(this.previewControlBorder, Grid.GetRow(this));
            if (rs > 0)
                Grid.SetRowSpan(this.previewControlBorder, rs);
            this.previewGrid.Children.Add(this.previewControlBorder);

            this.previewControl = new GridSplitterPreviewControl();
            if (this.PreviewStyle != null)
                this.previewControl.Style = this.PreviewStyle;
            this.previewControlBorder.Child = this.previewControl;

            this.previewPopup.Child = this.previewGrid;
            //await this.previewGridSplitter.WaitForLoadedAsync();

            //this.previewGridSplitter.OnPointerPressed(e);
            this.previewGridSplitter.dragPointer = e.Pointer.PointerId;
            this.previewGridSplitter.effectiveResizeDirection = this.DetermineEffectiveResizeDirection();
            this.previewGridSplitter.parentGrid = this.previewGrid;
            this.previewGridSplitter.lastPosition = e.GetCurrentPoint(this.previewGrid).Position;
            this.previewGridSplitter.isDragging = true;
            this.previewGridSplitter.StartDirectDragging(e);
            this.previewGridSplitter.DraggingCompleted += previewGridSplitter_DraggingCompleted;
        }
 private void AlignElements()
 {
     if (Window.Current.Bounds.Width < 600 && !smallView)
     {
         MySplitView.DisplayMode = SplitViewDisplayMode.Overlay;
         CompactHamburgerButton.Visibility = Visibility.Visible;
         smallView = true;
         embedContent.Width = Window.Current.Bounds.Width - 50;
         RadioBoxGrid.ColumnDefinitions.Remove(RadioBoxGrid.ColumnDefinitions.First());
         RadioBoxGrid.ColumnDefinitions.Remove(RadioBoxGrid.ColumnDefinitions.First());
         RowDefinition rd = new RowDefinition();
         rd.Height = new GridLength(1.0, GridUnitType.Star);
         RadioBoxGrid.RowDefinitions.Add(rd);
         RowDefinition rd2 = new RowDefinition();
         rd2.Height = new GridLength(1.0, GridUnitType.Star);
         RadioBoxGrid.RowDefinitions.Add(rd2);
         Grid.SetRow(bottomLeftText, 2);
         Grid.SetRow(bottomLeftButton, 3);
         Grid.SetRow(bottomRightText, 2);
         Grid.SetRow(bottomRightButton, 3);
         Grid.SetColumn(bottomLeftText, 0);
         Grid.SetColumn(bottomLeftButton, 0);
         Grid.SetColumn(bottomRightText, 1);
         Grid.SetColumn(bottomRightButton, 1);
         chooseLocationTextbox.HorizontalAlignment = HorizontalAlignment.Center;
         leaveBlankIfUnknownTextbox.HorizontalAlignment = HorizontalAlignment.Center;
     }
     else if (smallView)
     {
         Frame.Navigate(typeof(DetectionPage));
     }
 }