Inheritance: Windows.UI.Xaml.DependencyObject, IColumnDefinition
コード例 #1
0
ファイル: ArtistDetails.g.i.cs プロジェクト: sagar-sm/Mu
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ArtistDetails.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
            itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
            itemDetailTitlePanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("itemDetailTitlePanel");
            ArtistContentTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("ArtistContentTb");
            itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
            itemSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemSubtitle");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
        }
コード例 #2
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SplitPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (NoelBlogReader.Common.LayoutAwarePage)this.FindName("pageRoot");
            itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("itemsViewSource");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
            itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
            itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
            contentViewBorder = (Windows.UI.Xaml.Controls.Border)this.FindName("contentViewBorder");
            contentView = (Windows.UI.Xaml.Controls.WebView)this.FindName("contentView");
            contentViewRect = (Windows.UI.Xaml.Shapes.Rectangle)this.FindName("contentViewRect");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://wikipediaquerytoolxaml/Files/SplitPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            PortraitDetail = (Windows.UI.Xaml.VisualState)this.FindName("PortraitDetail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            SnappedDetail = (Windows.UI.Xaml.VisualState)this.FindName("SnappedDetail");
            PrimaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("PrimaryColumn");
            TitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("TitlePanel");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            ItemDetail = (Windows.UI.Xaml.Controls.ContentControl)this.FindName("ItemDetail");
            ItemStackPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("ItemStackPanel");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
コード例 #5
0
ファイル: Tweet.g.i.cs プロジェクト: sagar-sm/Mu
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
            PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
            itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
            TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
            TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
            PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
            VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
            TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
            RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
        }
コード例 #6
0
ファイル: PollutionGrid.xaml.cs プロジェクト: Qerts/Pollution
        /// <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);

            
            

        }
コード例 #7
0
 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);
         }
     }
 }
コード例 #8
0
ファイル: PicturePanel.cs プロジェクト: DXChinaTE/O2OApp
 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);
 }
コード例 #9
0
ファイル: GoodsPanel.cs プロジェクト: DXChinaTE/O2OApp
        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);
        }
コード例 #10
0
ファイル: Editor.xaml.cs プロジェクト: m-gagne/MetroMarkdown
        public Editor()
        {
            this.InitializeComponent();

            // Record the current window size
            this._windowsBounds = Window.Current.Bounds;

            this._editorColumn = Layout.ColumnDefinitions[0];
            this._previewColumn = Layout.ColumnDefinitions[1];

            // Wire up custom settings
            SettingsPane.GetForCurrentView().CommandsRequested += this.CommandsRequested;

            this.BottomAppBar.Opened += BottomAppBarOpened;
            this.BottomAppBar.Closed += BottomAppBarClosed;

            // Monitor preference changes
            UserPreferences.Instance.PropertyChange += UserPreferencesChange;
        }
コード例 #11
0
            Log("Pressed", args);
            base.OnPointerPressed(args);
        }

        protected override void OnPointerReleased(PointerRoutedEventArgs args)
        {
            Log("Released", args);
            base.OnPointerReleased(args);
        }

        protected override void OnPointerWheelChanged(PointerRoutedEventArgs args)
        {
            Log("WheelChanged", args);
            base.OnPointerWheelChanged(args);
        }

        void Log(string eventName, PointerRoutedEventArgs args)
        {
            uint id = args.Pointer.PointerId;
            PointerInfo pointerInfo;
            string event_string = "";
            string header_string = "";
            DateTime eventTime = DateTime.Now;
コード例 #12
0
ファイル: MainPage.xaml.cs プロジェクト: 745322878/Code
 async void MainPage_Load(object sender, RoutedEventArgs e)
 {
     Files.Items.Clear();
    
     //获取应用程序的本地存储文件NoteList
     StorageFolder storage = await ApplicationData.Current.LocalFolder.CreateFolderAsync("NoteList", CreationCollisionOption.OpenIfExists);
     //获取当前文件夹的文件
     var files = await storage.GetFilesAsync();
     {
         //便利 获取所有文件
         foreach (StorageFile file in files)
         {
             //初始化一个Grid类
             Grid a = new Grid();
             //列的属性
             ColumnDefinition col = new ColumnDefinition();
             //宽度200
             GridLength gl = new GridLength(200);
             col.Width = gl;
             //添加col
             a.ColumnDefinitions.Add(col);
             //定义第二列
             ColumnDefinition col2 = new ColumnDefinition();
             GridLength gl2 = new GridLength(100);
             col2.Width = gl2;//////////////
             a.ColumnDefinitions.Add(col2);
             //定义第三列
             ColumnDefinition col3 = new ColumnDefinition();
             GridLength g13 = new GridLength(100);
             col3.Width = g13;
             a.ColumnDefinitions.Add(col3);
             //添加一个TextBlock显示记事本名到第一列
             TextBlock txbx = new TextBlock();
             txbx.Text = file.DisplayName;
             txbx.FontSize = 20;
             //把txbx设置到Grid 0号位置
             Grid.SetColumn(txbx, 0);
             //添加一个HyperlinkButton链接到记事本页面,这是第二列
             //HyperlinkButton 可跳转Button
             HyperlinkButton btn = new HyperlinkButton();
             btn.Width = 80;
             btn.Content = "删除";
             btn.Foreground  = new SolidColorBrush(Colors.Blue );
             btn.FontSize = 20;
             btn.Name = file.DisplayName;
             //Lambda表达式
             //事件添加一个Lambda表达式
             //等价于下面btn_Click方法
             btn.Click += (s ,ea) =>
                 {
                     Frame.Navigate(typeof(DeleteItem ),file );
                 };
             Grid.SetColumn(btn ,1);
             //添加一个HyperlinkButton链接到记事本页面,这是第三列
             HyperlinkButton btn1 = new HyperlinkButton();
             btn1.Width = 80;
             btn1.Content = "打开";
             btn1.FontSize = 20;
             btn1.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
             btn1.Name = file.DisplayName;
             btn1.Click += (s, ea) =>
             {
                 Frame.Navigate(typeof(AddItem), file);
             };
             Grid.SetColumn(btn1, 2);
             //给Grid a 添加子元素
             a.Children.Add(txbx);
             a.Children.Add(btn);
             a.Children.Add(btn1);
             //将 a 添加到Files中
             Files.Items.Add(a);
         }
     }
 }
コード例 #13
0
        private async void initPdfGrid(int pageNum)
        {
            ColumnDefinition cd = new ColumnDefinition();
            ud_pdfContainer.ColumnDefinitions.Add(cd);
            DependencyProperty dp = DependencyProperty.RegisterAttached("visibilityProperty", typeof(Visibility), typeof(Image), new Windows.UI.Xaml.PropertyMetadata(Visibility.Collapsed, ud_visibilityChanged));
            for (int count = 0;count < pageNum;count++)
            {
                RowDefinition rd = new RowDefinition();
                ud_pdfContainer.RowDefinitions.Add(rd);

                Image img = new Image();
                img.Name = "" + count;
                img.Stretch = Stretch.Uniform;
                img.Width = m_iRenderAreaSizeX;

                img.Height = m_iRenderAreaSizeY + shadowHeight;
                img.PointerPressed += GetBeginLocation;
                img.PointerMoved += GetMoveLocation;
                img.PointerReleased += GetEndLocation;

                Binding bd= new Binding();
                bd.Source = img;
                bd.Path = new PropertyPath("Visibility");
                img.SetBinding(dp, bd);
                
                ud_pdfContainer.Children.Add(img);
                Grid.SetColumn(img, 0);
                Grid.SetRow(img, count);

            }

            //await ImportWordList();
            /*string[] testStr = new string[WordNumber];
            testStr = Wordlist;
            wordInfo wInfo;
            for (int count = 0; count < testStr.Length; count++)
            {
                bool[] testData = new bool[pageNum];
                for (int count1 = 0; count1 < testData.Length; count1++)
                {
                    testData[count1] = false;
                }
                wInfo.word = testStr[count];
                wInfo.annotFlag = testData;
                wordInfoList.Add(wInfo);
            }*/
        }
コード例 #14
0
ファイル: environment.cs プロジェクト: MohammedAbuissa/SET
        public static void hostTableDef()
        {
            HostGrid = new Grid();
            ColumnDefinition c0 = new ColumnDefinition();
            c0.Width = new GridLength(1.25, GridUnitType.Star);
            HostGrid.ColumnDefinitions.Add(c0);
            ColumnDefinition c1 = new ColumnDefinition();
            c1.Width = new GridLength(3.5, GridUnitType.Star);
            ColumnDefinition c2 = new ColumnDefinition();
            c2.Width = new GridLength(1.25, GridUnitType.Star);
            HostGrid.ColumnDefinitions.Add(c1);
            HostGrid.ColumnDefinitions.Add(c2);

            RowDefinition r0 = new RowDefinition();
            r0.Height = new GridLength(0.25,GridUnitType.Star);
            HostGrid.RowDefinitions.Add(r0);
            RowDefinition r1 = new RowDefinition();
            r1.Height = new GridLength(5,GridUnitType.Star);
            HostGrid.RowDefinitions.Add(r1);
            RowDefinition r2 = new RowDefinition();
            r2.Height = new GridLength(0.5,GridUnitType.Star);
            HostGrid.RowDefinitions.Add(r2);
            ImageBrush x = new ImageBrush();
            x.ImageSource = (new BitmapImage(new Uri(@"ms-appx:///Assets/iron_texture47.jpg")));
            HostGrid.Background = x;
        }
コード例 #15
0
        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();
            }
        }
コード例 #16
0
ファイル: Profesori.xaml.cs プロジェクト: nikolaz5/DOT
        public void dodajStavkuListe(ProfesorC p)
        {
            StackPanel sp = new StackPanel();
            sp.Tag = p.idProfesor;
            Grid g = new Grid();
            Rectangle r = new Rectangle();
            TextBlock tb = new TextBlock();

            

            ColumnDefinition c = new ColumnDefinition();
            c.Width = new GridLength(1, GridUnitType.Auto);

            ColumnDefinition c1 = new ColumnDefinition();
            c1.Width = new GridLength(1, GridUnitType.Star);

            g.ColumnDefinitions.Add(c);
            g.ColumnDefinitions.Add(c1);

            r.Height = 70;
            r.Width = 70;
            ImageBrush imageBrush = new ImageBrush();
            string putanja = "ms-appx://" + p.slika;

            imageBrush.ImageSource = new BitmapImage(new Uri(putanja, UriKind.RelativeOrAbsolute));
            r.Fill = imageBrush;
            r.Margin = new Thickness(5, 5, 5, 5);

            tb.Text = p.titula + " " + p.imePrezime;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.FontSize = 20;
            tb.Margin = new Thickness(15, 0, 0, 0);

            g.Children.Add(r);
            g.Children.Add(tb);
            Grid.SetColumn(r, 0);
            Grid.SetColumn(tb, 1);

            sp.Children.Add(g);
            if (lvProfesori.Items.Count == maxCnt)
            {
                lvProfesori = new ListView();
                lvProfesori.Width = 500;
                lvProfesori.HorizontalAlignment = HorizontalAlignment.Left;
                lvProfesori.Tapped += lvProfesori_Tapped;
                spProfesori.Children.Add(lvProfesori);
            }
            lvProfesori.Items.Add(sp);

        }
コード例 #17
0
ファイル: Rating.cs プロジェクト: arashadm/WpToWinrt
        /// <summary>
        /// Adjusts the RowDefinition and ColumnDefinition collections on a Grid to be consistent with the
        /// number of RatingItems present in the collections, and finally adds these RatingItems to the 
        /// grid's Children, setting their Row and Column dependency properties. 
        /// </summary>
        /// <param name="grid">The grid to fix up.</param>
        /// <param name="ratingItemList">A rating list source to add to the grid.</param>
        private void SynchronizeGrid(Grid grid, IList<RatingItem> ratingItemList)
        {
            if (grid == null)
            {
                return;
            }

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

            if (Orientation ==Orientation.Horizontal)
            {

                while (grid.ColumnDefinitions.Count < ratingItemList.Count)
                {
                    ColumnDefinition cD = new ColumnDefinition();
                    cD.Width = new GridLength(1, GridUnitType.Star);
                    grid.ColumnDefinitions.Add(cD);
                }

                grid.Children.Clear();
                for (int i = 0; i < ratingItemList.Count; i++)
                {
                    grid.Children.Add(ratingItemList[i]);
                    Grid.SetColumn(ratingItemList[i], i);
                    Grid.SetRow(ratingItemList[i], 0);
                }
            }
            else
            {
                while (grid.RowDefinitions.Count < ratingItemList.Count)
                {
                    RowDefinition rD = new RowDefinition();
                    rD.Height = new GridLength(1, GridUnitType.Star);
                    grid.RowDefinitions.Add(rD);
                }

                grid.Children.Clear();
                for (int i = 0; i < ratingItemList.Count; i++)
                {
                    grid.Children.Add(ratingItemList[i]);
                    Grid.SetRow(ratingItemList[i], i);
                    Grid.SetColumn(ratingItemList[i], 0);
                }

            }
        }
コード例 #18
0
        private void Table_MessageBox(double X, double Y)
        {
            Style style = new Style(typeof(Border));
            style.BasedOn = new Style(typeof(Border));
            Setter BorderBrushProp = new Setter()
            {
                Property = BorderBrushProperty,
                Value = new SolidColorBrush(Colors.Black)
            };
            Setter BorderThicknessProp = new Setter()
            {
                Property = BorderThicknessProperty,
                Value = 2
            };
            Setter BackgroundProp = new Setter()
            {
                Property = BackgroundProperty,
                Value = new SolidColorBrush(Colors.White)
            };
            Setter PaddingProp = new Setter()
            {
                Property = PaddingProperty,
                Value = 5
            };
            style.Setters.Add(BorderBrushProp);
            style.Setters.Add(BorderThicknessProp);
            style.Setters.Add(BackgroundProp);
            style.Setters.Add(PaddingProp);

            Grid table_input = new Grid()
            {
                Width = 150,
                Height = 140
            };

            GridLength length_40 = new GridLength(40);
            GridLength length_10 = new GridLength(10);
            GridLength length_70 = new GridLength(70);

            RowDefinition row1 = new RowDefinition();
            row1.Height = length_40;
            RowDefinition row2 = new RowDefinition();
            row2.Height = length_10;
            RowDefinition row3 = new RowDefinition();
            row3.Height = length_40;
            RowDefinition row4 = new RowDefinition();
            row4.Height = length_10;
            RowDefinition row5 = new RowDefinition();
            row5.Height = length_40;
            
            ColumnDefinition col1 = new ColumnDefinition();
            col1.Width = length_70;
            ColumnDefinition col2 = new ColumnDefinition();
            col2.Width = length_10;
            ColumnDefinition col3 = new ColumnDefinition();
            col3.Width = length_70;
            ColumnDefinition temp1 = new ColumnDefinition();
            ColumnDefinition temp2 = new ColumnDefinition();
            table_input.RowDefinitions.Add(row1);
            table_input.RowDefinitions.Add(row2);
            table_input.RowDefinitions.Add(row3);
            table_input.RowDefinitions.Add(row4);
            table_input.RowDefinitions.Add(row5);
            table_input.ColumnDefinitions.Add(temp1);
            table_input.ColumnDefinitions.Add(col1);
            table_input.ColumnDefinitions.Add(col2);
            table_input.ColumnDefinitions.Add(col3);
            table_input.ColumnDefinitions.Add(temp2);
            
            TextBox row = new TextBox()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                Text = "행 : ",
                FontSize = 20,
                TextAlignment = TextAlignment.Center
            };
            Grid.SetRow(row, 0);
            Grid.SetColumn(row, 1);
            TextBox row_input = new TextBox()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                Background = new SolidColorBrush(Colors.LightGray),
                FontSize = 20,
                TextAlignment = TextAlignment.Center
            };
            Grid.SetRow(row_input, 0);
            Grid.SetColumn(row_input, 3);
            TextBox col = new TextBox()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                Text = "열 : ",
                FontSize = 20,
                TextAlignment = TextAlignment.Center
            };
            Grid.SetRow(col, 2);
            Grid.SetColumn(col, 1);
            TextBox column_input = new TextBox()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                Background = new SolidColorBrush(Colors.LightGray),
                FontSize = 20,
                TextAlignment = TextAlignment.Center
            };
            Grid.SetRow(column_input, 2);
            Grid.SetColumn(column_input, 3);
            Button Ok = new Button()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                BorderBrush = new SolidColorBrush(Colors.Black),
                Background = new SolidColorBrush(Colors.LightGray),
                Content = "확인",
                FontSize = 15
            };
            Grid.SetRow(Ok, 4);
            Grid.SetColumn(Ok, 1);
            Button Cancel = new Button()
            {
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                Width = 70,
                Height = 38,
                BorderBrush = new SolidColorBrush(Colors.Black),
                Background = new SolidColorBrush(Colors.LightGray),
                Content = "취소",
                FontSize = 15,
            };
            Grid.SetRow(Cancel, 4);
            Grid.SetColumn(Cancel, 3);

            table_input.Children.Add(row);
            table_input.Children.Add(row_input);
            table_input.Children.Add(col);
            table_input.Children.Add(column_input);
            table_input.Children.Add(Ok);
            table_input.Children.Add(Cancel);

            Ok.Click += Ok_Click;
            Cancel.Click += Cancel_Click;
            Canvas.SetLeft(table_input, X - 100);
            Canvas.SetTop(table_input, Y - 50);
            MyCanvas.Children.Add(table_input);

            //table_input.Style = style;

            havetobeclosed = true;
        }
コード例 #19
0
ファイル: Orders.xaml.cs プロジェクト: DXChinaTE/O2OApp
        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++;
            }
        }
コード例 #20
0
        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;
                }
            }
        }
コード例 #21
0
        //
        //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);
                }
            }
        }
コード例 #22
0
        private void GenerateGrid()
        {
            for (int i = 0; i < StartingBoardDimension; i++)
            {
                var row = new RowDefinition { Height = new GridLength(50) };
                GameBoard.RowDefinitions.Add(row);

                var column = new ColumnDefinition { Width = new GridLength(50) };
                GameBoard.ColumnDefinitions.Add(column);
            }

            for (var i = 0; i < StartingBoardDimension; i++)
            {
                for (var j = 0; j < StartingBoardDimension; j++)
                {
                    CreateBorder(i, j);
                }
            }

            //
            // Set the boundaries of the grid.
            //
            _northLimit = _westLimit = (GameBoardDimension / 2) - (StartingBoardDimension - 1) / 2;
            _southLimit = _eastLimit = (GameBoardDimension / 2) + (StartingBoardDimension - 1) / 2;

        }
コード例 #23
0
        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;
            }
        }
コード例 #24
0
        /// <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);

        }
コード例 #25
0
        private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (!previewselected)
            {
                if (penselected || triangleselected || rectangleselected || polygonselected || lineselected || imageselected || tablelayoutinserted)
                {
                    if (e.Pointer.PointerId == _penID)
                    {
                        TranslateTransform posTransform = new TranslateTransform();
                        posTransform.X = -400;
                        posTransform.Y = -400;
                        MainRadialMenu.RenderTransform = posTransform;

                        PointerPoint pt = e.GetCurrentPoint(MyCanvas);

                        // Render a red line on the canvas as the pointer moves. 
                        // Distance() is an application-defined function that tests
                        // whether the pointer has moved far enough to justify 
                        // drawing a new line.

                        #region 펜 그리기
                        if (penselected)
                        {
                            currentContactPt = pt.Position;
                            x1 = _previousContactPt.X;
                            y1 = _previousContactPt.Y;
                            x2 = currentContactPt.X;
                            y2 = currentContactPt.Y;
                            //if (Distance(x1, y1, x2, y2) > 2.0) // We need to developp this method now 
                            //{
                            Line line = new Line()
                            {
                                X1 = x1,
                                Y1 = y1,
                                X2 = x2,
                                Y2 = y2,
                                StrokeThickness = 4.0,
                                Stroke = new SolidColorBrush(pencolor)
                            };

                            _previousContactPt = currentContactPt;

                            // Draw the line on the canvas by adding the Line object as
                            // a child of the Canvas object.
                            MyCanvas.Children.Add(line);

                            // Pass the pointer information to the InkManager.
                            _inkKhaled.ProcessPointerUpdate(pt);
                            //}
                        }
                        #endregion

                        #region 삼각형 그리기
                        else if (triangleselected)
                        {
                            if (Distance(x1, y1, x2, y2) > 2.0) // We need to developp this method now 
                            {
                                Line line = new Line()
                                {
                                    X1 = x1,
                                    Y1 = y1,
                                    X2 = x2,
                                    Y2 = y2,
                                    StrokeThickness = 4.0,
                                    Stroke = new SolidColorBrush(Colors.Green)
                                };
                                _previousContactPt = currentContactPt;

                                // Draw the line on the canvas by adding the Line object as
                                // a child of the Canvas object.
                                MyCanvas.Children.Add(line);

                                // Pass the pointer information to the InkManager.
                                _inkKhaled.ProcessPointerUpdate(pt);
                            }
                        }
                        #endregion

                        #region 사각형 그리기
                        else if (rectangleselected)
                        {
                            int area1 = 0, area2 = 0, area3 = 0, area4 = 0;
                            currentContactPt = pt.Position;
                            x1 = _previousContactPt.X;
                            y1 = _previousContactPt.Y;
                            x2 = currentContactPt.X;
                            y2 = currentContactPt.Y;
                            Rectangle rectangle = new Rectangle();
                            if (x1 < x2) { rectangle.Width = x2 - x1; area1 = 1; area4 = 1; }
                            else { rectangle.Width = x1 - x2; area2 = 1; area3 = 1; }
                            if (y1 < y2)
                            {
                                rectangle.Height = y2 - y1;
                                area3 = 0;
                                area4 = 0;
                            }
                            else
                            {
                                rectangle.Height = y1 - y2;
                                area1 = 0;
                                area2 = 0;
                            }
                            rectangle.StrokeThickness = 4.0;
                            rectangle.Stroke = new SolidColorBrush(Colors.Green);
                            if (area1 == 1) { Canvas.SetLeft(rectangle, x1); Canvas.SetTop(rectangle, y1); }
                            else if (area2 == 1) { Canvas.SetLeft(rectangle, x2); Canvas.SetTop(rectangle, y1); }
                            else if (area3 == 1) { Canvas.SetLeft(rectangle, x2); Canvas.SetTop(rectangle, y2); }
                            else { Canvas.SetLeft(rectangle, x1); Canvas.SetTop(rectangle, y2); }

                            // Draw the line on the canvas by adding the Line object as
                            // a child of the Canvas object.

                            if (rec_prevcount != -1)
                                MyCanvas.Children.RemoveAt(rec_prevcount);
                            MyCanvas.Children.Add(rectangle);
                            rec_prevcount = MyCanvas.Children.IndexOf(rectangle);
                            // Pass the pointer information to the InkManager.
                            _inkKhaled.ProcessPointerUpdate(pt);
                        }
                        #endregion

                        #region 다각형 그리기
                        else if (polygonselected && (poly_previtem == 0))
                        {

                            if ((Distance(pt.Position.X, pt.Position.Y, poly_startPoint.X, poly_startPoint.Y) < 7.0) && (poly_edgecount > 1))
                            {
                                currentContactPt = poly_startPoint;
                                poly_startget = true;
                            }
                            else
                            {
                                currentContactPt = pt.Position;
                                poly_startget = false;
                            }
                            x1 = _previousContactPt.X;
                            y1 = _previousContactPt.Y;
                            x2 = currentContactPt.X;
                            y2 = currentContactPt.Y;

                            Line line = new Line()
                            {
                                X1 = x1,
                                Y1 = y1,
                                X2 = x2,
                                Y2 = y2,
                                StrokeThickness = 4.0,
                                Stroke = new SolidColorBrush(Colors.Black)
                            };

                            // Draw the line on the canvas by adding the Line object as
                            // a child of the Canvas object.

                            if (poly_prevcount != -1)
                                MyCanvas.Children.RemoveAt(poly_prevcount);

                            MyCanvas.Children.Add(line);
                            poly_prevcount = MyCanvas.Children.IndexOf(line);

                            // Pass the pointer information to the InkManager.
                            _inkKhaled.ProcessPointerUpdate(pt);
                        }
                        #endregion

                        #region 선 그리기
                        else if (lineselected)
                        {
                            currentContactPt = pt.Position;
                            x1 = _previousContactPt.X;
                            y1 = _previousContactPt.Y;
                            x2 = currentContactPt.X;
                            y2 = currentContactPt.Y;
                            Line line = new Line()
                            {
                                X1 = x1,
                                Y1 = y1,
                                X2 = x2,
                                Y2 = y2,
                                StrokeThickness = 4.0,
                                Stroke = new SolidColorBrush(Colors.Black)
                            };


                            // Draw the line on the canvas by adding the Line object as
                            // a child of the Canvas object.

                            if (line_prevcount != -1)
                                MyCanvas.Children.RemoveAt(line_prevcount);

                            MyCanvas.Children.Add(line);
                            line_prevcount = MyCanvas.Children.IndexOf(line);

                            // Pass the pointer information to the InkManager.
                            _inkKhaled.ProcessPointerUpdate(pt);
                        }
                        #endregion

                        #region 이미지 그리기
                        else if (imageselected)
                        {
                            currentContactPt = pt.Position;

                            Image temp_img = new Image();
                            temp_img = (Image)MyCanvas.Children.Last();
                            var location = temp_img.TransformToVisual(Window.Current.Content);
                            Point location_img = location.TransformPoint(new Point(0, 0));
                            double change_x = currentContactPt.X - _previousContactPt.X;
                            double change_y = currentContactPt.Y - _previousContactPt.Y;
                            temp_img.Stretch = Stretch.Fill;
                            if (img_move)
                            {
                                temp_img.Width = temp_img.ActualWidth;
                                temp_img.Height = temp_img.ActualHeight;
                                Canvas.SetLeft(temp_img, location_img.X + change_x);
                                Canvas.SetTop(temp_img, location_img.Y + change_y);

                                MyCanvas.Children.RemoveAt(MyCanvas.Children.Count - 1);
                                MyCanvas.Children.Add(temp_img);

                                _previousContactPt = currentContactPt;

                                _inkKhaled.ProcessPointerUpdate(pt);
                            }
                            else if (img_left || img_right || img_top || img_bottom)
                            {

                                if (img_left)
                                {
                                    if (img_prev_left == 0)
                                        img_prev_left = temp_img.ActualWidth + location_img.X;
                                    temp_img.Width = img_prev_left - currentContactPt.X;
                                    Canvas.SetLeft(temp_img, currentContactPt.X);
                                }
                                else if (img_right)
                                {
                                    temp_img.Width = currentContactPt.X - location_img.X;
                                    Canvas.SetLeft(temp_img, location_img.X);
                                }
                                else
                                {
                                    temp_img.Width = temp_img.ActualWidth;
                                    Canvas.SetLeft(temp_img, location_img.X);
                                }
                                if (img_top)
                                {
                                    if (img_prev_top == 0)
                                        img_prev_top = temp_img.ActualHeight + location_img.Y;
                                    temp_img.Height = img_prev_top - currentContactPt.Y;
                                    Canvas.SetTop(temp_img, currentContactPt.Y);
                                }
                                else if (img_bottom)
                                {
                                    temp_img.Height = currentContactPt.Y - location_img.Y;
                                    Canvas.SetTop(temp_img, location_img.Y);
                                }
                                else
                                {
                                    temp_img.Height = temp_img.ActualHeight;
                                    Canvas.SetTop(temp_img, location_img.Y);
                                }
                                MyCanvas.Children.RemoveAt(MyCanvas.Children.Count - 1);
                                MyCanvas.Children.Add(temp_img);
                                //_previousContactPt = currentContactPt;
                                _inkKhaled.ProcessPointerUpdate(pt);
                            }
                        }
                        #endregion

                        #region 표 그리기
                        else if (tablelayoutinserted)
                        {
                            int area1 = 0, area2 = 0, area3 = 0, area4 = 0;
                            currentContactPt = pt.Position;
                            x1 = _previousContactPt.X;
                            y1 = _previousContactPt.Y;
                            x2 = currentContactPt.X;
                            y2 = currentContactPt.Y;
        
                            Grid newGrid = new Grid()
                            {
                                Background = new SolidColorBrush(Colors.Wheat)
                            };

                            /////////////////////
                            int row_count = 0, column_count = 0;
                            
                            while (row_count < table_row)
                            {
                                RowDefinition row_new = new RowDefinition();
                                newGrid.RowDefinitions.Add(row_new);
                                row_count++;
                            }

                            while (column_count < table_column)
                            {
                                ColumnDefinition column_new = new ColumnDefinition();
                                newGrid.ColumnDefinitions.Add(column_new);
                                column_count++;
                            }
                            Style style_temp1 = new Style(typeof(Border));
                            Setter BorderBrushProp = new Setter()
                            {
                                Property = BorderBrushProperty,
                                Value = new SolidColorBrush(Colors.Black)
                            };
                            Setter BorderThicknessProp = new Setter()
                            {
                                Property = BorderThicknessProperty,
                                Value = 2
                            };
                            Setter BackgroundProp = new Setter()
                            {
                                Property = BackgroundProperty,
                                Value = new SolidColorBrush(Colors.White)
                            };
                            Setter PaddingProp = new Setter()
                            {
                                Property = PaddingProperty,
                                Value = 5
                            };
                            style_temp1.Setters.Add(BorderBrushProp);
                            style_temp1.Setters.Add(BorderThicknessProp);
                            style_temp1.Setters.Add(BackgroundProp);
                            style_temp1.Setters.Add(PaddingProp);

                            Style style_temp2 = new Style(typeof(TextBlock));
                            Setter ForegroundProp = new Setter()
                            {
                                Property = ForegroundProperty,
                                Value = new SolidColorBrush(Colors.Black)
                            };
                            style_temp2.Setters.Add(ForegroundProp);

                            double current_width, current_height;
                            if(currentContactPt.X > _previousContactPt.X)
                                current_width = currentContactPt.X - _previousContactPt.X;
                            else
                                current_width = _previousContactPt.X - currentContactPt.X;
                            if (currentContactPt.Y > _previousContactPt.Y)
                                current_height = currentContactPt.Y - _previousContactPt.Y;
                            else
                                current_height = _previousContactPt.Y - currentContactPt.Y;
                            
                            int table_entry_x = 0, table_entry_y=0;
                            while (table_entry_x*table_entry_y != table_row * table_column)
                            {
                                TextBox textbox_new = new TextBox()
                                {
                                    HorizontalAlignment = HorizontalAlignment.Stretch,
                                    VerticalAlignment = VerticalAlignment.Stretch,
                                    TextAlignment = TextAlignment.Center,
                                    BorderBrush = new SolidColorBrush(Colors.Black),
                                    Background = new SolidColorBrush(Colors.LightGray),
                                    TextWrapping = TextWrapping.Wrap,
                                    FontStyle = Windows.UI.Text.FontStyle.Normal,
                                    Width = current_width / table_column,
                                    Height = current_height / table_row
                                };
                               /* double width1_result = textbox_new.Width / 7;
                                if (textbox_new.Height / width1_result < 2.8)
                                    textbox_new.FontSize = width1_result * 2.4 / (textbox_new.Height / width1_result);
                                else
                                    textbox_new.FontSize = width1_result * 1.2;*/
                                Grid.SetRow(textbox_new, table_entry_x);
                                Grid.SetColumn(textbox_new, table_entry_y);
                                if (table_entry_y == table_column - 1)
                                {
                                    table_entry_y = 0;
                                    table_entry_x++;
                                }
                                else
                                    table_entry_y++;
                                newGrid.Children.Add(textbox_new);
                            }
                            
                            ////////////////


                            if (x1 < x2) { newGrid.Width = x2 - x1; area1 = 1; area4 = 1; }
                            else { newGrid.Width = x1 - x2; area2 = 1; area3 = 1; }
                            if (y1 < y2)
                            {
                                newGrid.Height = y2 - y1;
                                area3 = 0;
                                area4 = 0;
                            }
                            else
                            {
                                newGrid.Height = y1 - y2;
                                area1 = 0;
                                area2 = 0;
                            }
                            if (area1 == 1) { Canvas.SetLeft(newGrid, x1); Canvas.SetTop(newGrid, y1); }
                            else if (area2 == 1) { Canvas.SetLeft(newGrid, x2); Canvas.SetTop(newGrid, y1); }
                            else if (area3 == 1) { Canvas.SetLeft(newGrid, x2); Canvas.SetTop(newGrid, y2); }
                            else { Canvas.SetLeft(newGrid, x1); Canvas.SetTop(newGrid, y2); }

                            // Draw the line on the canvas by adding the Line object as
                            // a child of the Canvas object.

                            if (table_prevcount != -1)
                                MyCanvas.Children.RemoveAt(table_prevcount);
                            MyCanvas.Children.Add(newGrid);
                            table_prevcount = MyCanvas.Children.IndexOf(newGrid);
                            // Pass the pointer information to the InkManager.
                            _inkKhaled.ProcessPointerUpdate(pt);
                            tableselected = true;
                        }
                        #endregion
                    }
                    
                    if (imageselected)
                    {
                        currentContactPt = e.GetCurrentPoint(MyCanvas).Position;
                        Image temp_img = (Image)MyCanvas.Children.Last();
                        var location = temp_img.TransformToVisual(Window.Current.Content);
                        Point location_img = location.TransformPoint(new Point(0, 0));
                        double left = location_img.X,
                            right = location_img.X + temp_img.ActualWidth,
                            top = location_img.Y,
                            bottom = location_img.Y + temp_img.ActualHeight;

                        if (Math.Abs(currentContactPt.X - left) < 3)
                        {
                            if (Math.Abs(currentContactPt.Y - top) < 3)
                                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthwestSoutheast, 1);
                            else if (Math.Abs(currentContactPt.Y - bottom) < 3)
                                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNortheastSouthwest, 1);
                            else
                                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeWestEast, 1);
                        }

                        else if (Math.Abs(currentContactPt.X - right) < 3)
                        {
                            if (Math.Abs(currentContactPt.Y - top) < 3)
                                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNortheastSouthwest, 1);
                            else if (Math.Abs(currentContactPt.Y - bottom) < 3)
                                Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthwestSoutheast, 1);
                            else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeWestEast, 1);
                        }

                        else if ((Math.Abs(currentContactPt.Y - top) < 3) || (Math.Abs(currentContactPt.Y - bottom) < 3))
                            Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthSouth, 1);

                        else if (((currentContactPt.X - left >= 3) && (right - currentContactPt.X >= 3))
                            && ((currentContactPt.Y - top >= 3) && (bottom - currentContactPt.Y >= 3)))
                            Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeAll, 1);

                        else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
                    }
                    else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
                }
                int i = textbox_list.Count;
                /*while (i != 0)
                {
                    if (textbox_list.ElementAt(i - 1).Focus(Windows.UI.Xaml.FocusState.Pointer))
                        textbox_list.ElementAt(i - 1).Background = new SolidColorBrush(Colors.Green);
                    else textbox_list.ElementAt(i - 1).Background = new SolidColorBrush(Colors.LightGray);
                    i--;
                }*/
                if ((textbox_list.Count != 0) && textboxselected && (textbox_list.Last().Text != null))
                    textbox_list.Last().Focus(Windows.UI.Xaml.FocusState.Pointer);
            }
        }
コード例 #26
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);
        }
コード例 #27
0
        /// <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);
            }
        }
コード例 #28
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);
				}
			}
		}
コード例 #29
0
        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;
        }
コード例 #30
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;
            }
        }