Esempio n. 1
0
 private void ButtonHideControls_OnClick(object sender, RoutedEventArgs e)
 {
     ButtonHideControls.Visibility = Visibility.Collapsed;
     ButtonShowControls.Visibility = Visibility.Visible;
     ControlsHeight = RowControls.Height;
     RowControls.Height = new GridLength(0);
 }
Esempio n. 2
0
        public void Redraw()
        {
            BoardGrid.Children.Clear();
            System.Windows.GridLength g = new GridLength(40);
            
            for (int v = 0; v < 15; v++)
            {
                BoardGrid.RowDefinitions.Add(new RowDefinition() { Height = g });
                for (int h = 0; h < 15; h++)
                {
                    BoardGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = g });
                    BoardSquare square = _allSquares[h, v];
                    if (v == 7 && h == 7)
                    {
                        square.Background = this.Resources["CenterSquare"] as Brush;
                    }
                    if (square.PlacedTile != null)
                    {
                        square.Redraw();
                    }

                    square.MyCoords = new Point(h, v);
                    
                    BoardGrid.Children.Add(square);

                    //horiz(x), vert(y)
                    Grid.SetColumn(square, h);
                    Grid.SetRow(square, v);
                }
            }

        }
Esempio n. 3
0
 private void myMainGridToggleButton_Checked(object sender, RoutedEventArgs e)
 {
     if (myMainGridFirstColumn.ActualWidth > myMainGridFirstColumn.MinWidth)
         _gridLength = myMainGridFirstColumn.Width;
     myMainGridFirstColumn.Width = new GridLength(myMainGridFirstColumn.MinWidth);
     this.myNavigationPaneButton.Visibility = Visibility.Visible;
 }
Esempio n. 4
0
        private void AddCardColumn(GridLength columnWidth, IEnumerable<Card> cardGroup)
        {
            foreach (Card c in cardGroup) {
                matrix.ColumnDefinitions.Add(new ColumnDefinition() { Width = columnWidth });
                TextBlock cardBlock = new TextBlock() {
                    Style = (Style)Resources["VerticalText"]
                };
                cardBlock.DataContext = c;
                cardBlock.SetBinding(TextBlock.TextProperty, new Binding("Name"));
                cardBlock.SetValue(Grid.ColumnProperty, matrix.ColumnDefinitions.Count - 1);
                cardBlock.SetValue(Grid.RowProperty, 1);
                matrix.Children.Add(cardBlock);

                // Fill in the individual nodes for this card.
                foreach (Player player in game.Players) {
                    Node node = game.Nodes.Where(n => n.CardHolder == player && n.Card == c).First();
                    Label nodeLabel = new Label();
                    nodeLabel.SetValue(Grid.ColumnProperty, matrix.ColumnDefinitions.Count - 1);
                    nodeLabel.SetValue(Grid.RowProperty, game.Players.IndexOf(player) + 2);
                    nodeLabel.DataContext = node;
                    nodeLabel.SetBinding(Label.ContentProperty, new Binding("IsSelected"));
                    matrix.Children.Add(nodeLabel);
                }
            }
        }
Esempio n. 5
0
        private void ShowPannel(object sender, EventArgs e)
        {
            BitmapImage logo = new BitmapImage();

            logo.BeginInit();
            if (!isPannelShow)
            {
                spliterWidth = new GridLength(panelSize);
                isPannelShow = true;
                logo.UriSource = new Uri(@"Images\HidePannel.png", UriKind.Relative);
                PannelDrag.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                spliterWidth = new GridLength(0.0);
                isPannelShow = false;
                logo.UriSource = new Uri(@"Images\ShowPannel.png", UriKind.Relative);
                PannelDrag.Visibility = System.Windows.Visibility.Hidden;
            }
            logo.EndInit();

            this.ShowPannelButton.Source = logo;
            PannelGrid.Width = spliterWidth.Value;
            MediaGrid.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value, 0);
            LibraryGrid.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value, 0);
            PannelDrag.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value - 2, 0);
        }
Esempio n. 6
0
        public QueryPage(IQueryEngineFacade engine)
        {
            InitializeComponent();

            this.engine = engine;
            textEditor.SyntaxHighlighting = 
                HighlightingManager.Instance.GetDefinitionByExtension(engine.DefaultExt);

            height1 = layout.RowDefinitions[3].Height;
            height2 = layout.RowDefinitions[4].Height;
            
            filePath = String.Empty;
            fileName = String.Empty;
            HasContent = false;
            ShowResultPane = false;
            hasModified = false;
            
            xmlGrid = new EmbeddedGrid();
            xmlGrid.Dock = System.Windows.Forms.DockStyle.Fill;
            xmlGrid.Location = new System.Drawing.Point(0, 100);
            xmlGrid.Name = "xmlGridView1";
            xmlGrid.Size = new System.Drawing.Size(100, 100);
            xmlGrid.TabIndex = 0;
            xmlGrid.AutoHeightCells = true;            
            windowsFormsHost.Child = xmlGrid;

            // see http://community.sharpdevelop.net/forums/t/10312.aspx          
            bracketSearcher = new BracketSearcher();
            bracketRenderer = new BracketHighlightRenderer(textEditor.TextArea.TextView);
            textEditor.TextArea.Caret.PositionChanged += new EventHandler(Caret_PositionChanged);            
        }
 private void UpdateCategoryWidth()
 {
     if (_categoryWidth.Value != _viewModel.CategoryColumnWidthRate)
     {
         _categoryWidth = new GridLength(_viewModel.CategoryColumnWidthRate, GridUnitType.Star);
         _menuSectionWidth = new GridLength(100 - _categoryWidth.Value, GridUnitType.Star);
     }
 }
 public LinkViewLayoutManager()
 {
     FirstColumnWidth = new GridLength(1, GridUnitType.Star);
     SecondColumnWidth = new GridLength(PictureColumnWidth, GridUnitType.Pixel);
     PictureColumn = 1;
     TextColumn = 0;
     Messenger.Default.Register<SettingsChangedMessage>(this, OnSettingsChanged);
 }
Esempio n. 9
0
 public static RowDefinition AddRow(this Grid grid, GridLength height)
 {
     var row = new RowDefinition
     {
         Height = height
     };
     grid.RowDefinitions.Add(row);
     return row;
 }
Esempio n. 10
0
 public static ColumnDefinition AddColumn(this Grid grid, GridLength width)
 {
     var column = new ColumnDefinition
     {
         Width = width
     };
     grid.ColumnDefinitions.Add(column);
     return column;
 }
 private void SetColumnDefinition(bool hasParameters)
 {
     var column = ParametersGridColumn;
     if (column.Width.IsStar)
     {
         _lastGridLength = column.Width;
     }
     column.Width = hasParameters ? _lastGridLength : new GridLength(0, GridUnitType.Pixel);
 }
Esempio n. 12
0
 public MainWindow()
 {
     InitializeComponent();
       Loaded += switchLobby_Click;
       lobby.EnterSucceed += (user) =>
     new BattleWindow(user).Show();
       GL0 = new GridLength(0);
       GLMIN = new GridLength(lobby.MinWidth);
       editor.Init();
 }
Esempio n. 13
0
        internal Grid getAnswers(List<bool> AnsweredList)
        {
            int RadioBtnCount = -1;

            Grid g = new Grid();
            g.Name = "AnswerGrid";
            g.Background = new SolidColorBrush(Colors.LightGray);

            ColumnDefinition col1 = new ColumnDefinition();
            GridLength gl = new GridLength(50);
            col1.Width = gl;
            ColumnDefinition col2 = new ColumnDefinition();
            g.ColumnDefinitions.Add(col1);
            g.ColumnDefinitions.Add(col2);

            for (int i = 0; i <AnswList.Count; i++)
            {
                RowDefinition r = new RowDefinition();
                g.RowDefinitions.Add(r);
            }
            int rowCount = 0;

            //building Grid
            foreach (KeyValuePair<string,bool> pairs in AnswList)
            {
                RadioBtnCount++;
                RadioButton rb = new RadioButton();
                if (AnsweredList == null) rb.IsChecked = false;
                else rb.IsChecked = AnsweredList[RadioBtnCount];

                RadioBtnList.Add(rb);
                rb.Click += rb_Click;
                rb.HorizontalAlignment = HorizontalAlignment.Center;
                rb.VerticalAlignment = VerticalAlignment.Center;
                Grid.SetColumn(rb, 0);
                Grid.SetRow(rb, rowCount);
                g.Children.Add(rb);

                TextBlock tb = new TextBlock();
                tb.MaxWidth = 710;
                tb.FontFamily = new FontFamily("Arial");
                tb.FontSize = 14;
                tb.TextWrapping = TextWrapping.Wrap;
                tb.Text = pairs.Key;
                tb.Margin = new Thickness(5, 3, 5, 3);

                Grid.SetColumn(tb, 1);
                Grid.SetRow(tb, rowCount);
                g.Children.Add(tb);
                rowCount++;
            }
            return g;
        }
Esempio n. 14
0
        public void SetSize(byte size)
        {
            size = Math.Max(size, MinSize);
            size = Math.Min(size, MaxSize);

            var marginGridLength = new GridLength((FullGridSize - size) / 2, GridUnitType.Star);
            var iconGridLength = new GridLength(size, GridUnitType.Star);

            LeftMarginColumn.Width = marginGridLength;
            RightMarginColumn.Width = marginGridLength;
            IconColumn.Width = iconGridLength;
        }
Esempio n. 15
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (layoutGrid.ColumnDefinitions[2].Width.Value > 0)
     {
         prevSidebarWidth = layoutGrid.ColumnDefinitions[2].Width;
         layoutGrid.ColumnDefinitions[2].Width = new GridLength(0);
     }
     else
     {
         layoutGrid.ColumnDefinitions[2].Width = prevSidebarWidth;
     }
 }
        public void BehaviorTest()
        {
            #region Init

            var behavior = new GridColumnConditionalWidthsBehavior();

            var columnWidth1 = new GridLength(1, GridUnitType.Star);
            var columnWidth2 = new GridLength(200d);
            var columnWidth3 = GridLength.Auto;
            var columnNewWidth1 = new GridLength(1, GridUnitType.Star);
            var columnNewWidth2 = new GridLength(1, GridUnitType.Star);
            var columnNewWidth3 = new GridLength(100d);
            var conditionalWidth = new GridLength(2, GridUnitType.Star);

            var column1 = new ColumnDefinition() { Width = columnWidth1};
            var column2 = new ColumnDefinition() { Width = columnWidth2 };
            var column3 = new ColumnDefinition() { Width = columnWidth3 };
            var grid = new Grid {Width = 1000d};
            grid.ColumnDefinitions.Add(column1);
            grid.ColumnDefinitions.Add(column2);
            grid.ColumnDefinitions.Add(column3);

            behavior.Column = 2;
            behavior.ConditionalWidth = conditionalWidth;
            behavior.Attach(grid);

            #endregion Init

            behavior.Condition = true;

            //test ConditionalWidth
            Assert.AreEqual(column2.Width.Value, 200d);

            // grid layout changes
            column1.Width = columnNewWidth1;
            column2.Width = columnNewWidth2;
            column3.Width = columnNewWidth3;

            // test restore
            behavior.Condition = false;

            Assert.AreEqual(column1.Width, columnWidth1);
            Assert.AreEqual(column2.Width, columnWidth2);
            Assert.AreEqual(column3.Width, columnWidth3);

            // test saved
            behavior.Condition = true;

            Assert.AreEqual(column1.Width, columnNewWidth1);
            Assert.AreEqual(column2.Width, columnNewWidth2);
            Assert.AreEqual(column3.Width, columnNewWidth3);
        }
Esempio n. 17
0
 internal static string ToString (GridLength length, CultureInfo culture = null)
 {
     if (culture == null)
         culture = CultureInfo.InvariantCulture;
     if (length.IsAuto)
         return Auto;
     else if (length.IsAbsolute)
         return length.Value.ToString(culture);
     else if (length.Value == 1)
         return Asterisk;
     else
         return length.Value.ToString(culture) + Asterisk;
 }
Esempio n. 18
0
 internal void ToggleFindDisplayed()
 {
     if (m_savedFindHeight.Value > 0)
     {
         FindRow.Height = m_savedFindHeight;
         findText.Focus();
         m_savedFindHeight = new GridLength(-1);
     }
     else
     {
         m_savedFindHeight = FindRow.Height;
         FindRow.Height = new GridLength(0);
     }
 }
Esempio n. 19
0
        private void AddTranslationButton_Click(object sender, RoutedEventArgs e)
        {
            if (AddTranslationTextBox.Text != "Новый перевод" && AddTranslationTextBox.Text != " " && AddTranslationTextBox.Text != "" && AddTranslationTextBox.Text!="Введите новый перевод")
            {
                //LoginGrid.Children.Remove(LoginTextBox);

                RowDefinition NewRow   = new RowDefinition();
                var height             = new GridLength(35);
                var translationTextBox = new DoubleTextBlock();
                int i = 20;                                         // Магические числа? Продефайнь, где можно, пожалуйста.

                int currentRowNumber = Grid.GetRow((Button)sender);
                TranslationLocation.RowDefinitions[currentRowNumber + 2].Height = height;
                TranslationLocation.RowDefinitions.Add(NewRow);
                translationTextBox.MainText    = AddTranslationTextBox.Text;
                translationTextBox.CommentText = AddCommentTextBox.Text;
                while (translationTextBox.ChangeCommentTextBlockLinesNumber(height.Value) && height.Value < 75)
                {
                    height = new GridLength(35 + i);
                    TranslationLocation.RowDefinitions[currentRowNumber].Height = height;
                    i += 20;
                }
                translationTextBox.ToolTip = AddCommentTextBox.Text;
                TranslationLocation.Children.Add(translationTextBox);
                translationTextBox.SetValue(Grid.RowProperty, currentRowNumber);
                translationTextBox.SetValue(Grid.ColumnProperty, 0);
                var MinBut1    = new Button();
                MinBut1.Style  = (Style) Application.Current.Resources["DialogButtonStyle"];
                TranslationLocation.Children.Add(MinBut1);
                MinBut1.Height = 30;
                MinBut1.Width  = 30;
                Image image    = new Image();
                BitmapImage bitmapImage = new BitmapImage(new Uri("Minus.png", UriKind.Relative));
                image.Source    = bitmapImage;
                MinBut1.Content = image;
                MinBut1.SetValue(Grid.RowProperty, currentRowNumber);
                MinBut1.SetValue(Grid.ColumnProperty, 1);
                this.AddTranslationTextBox.SetValue(Grid.RowProperty, currentRowNumber + 1);
                this.AddTranslationButton.SetValue(Grid.RowProperty, currentRowNumber + 1);
                AddCommentTextBox.SetValue(Grid.RowProperty, currentRowNumber + 2);
                AddTranslationTextBox.Text = "Новый перевод";
                AddCommentTextBox.Text     = "Новый коментарий";
            }
            else
            {
                AddTranslationTextBox.Text = "Введите новый перевод";
            }
        }
        public MediaFileBrowserView(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            Microsoft.Practices.Prism.Regions.RegionManager.SetRegionManager(this, regionManager);

            InitializeComponent();

            RegionManager = regionManager;
            EventAggregator = eventAggregator;

            RegionManager.Regions[RegionNames.MediaFileBrowserContentRegion].NavigationService.Navigating += mediaFileBrowserContentRegion_Navigating;
            RegionManager.Regions[RegionNames.MediaFileBrowserContentRegion].NavigationService.Navigated += mediaFileBrowserContentRegion_Navigated;

            EventAggregator.GetEvent<ToggleFullScreenEvent>().Subscribe(toggleFullScreen);

            leftColumnWidth = mainGrid.ColumnDefinitions[0].Width;
            rightColumnWidth = mainGrid.ColumnDefinitions[2].Width;
        }
Esempio n. 21
0
        public ZPairWindow(
            ZWindowManager manager,
            FontAndColorService fontAndColorService,
            ZWindow child1,
            ZWindow child2,
            ZWindowPosition child2Position,
            GridLength child2Size)
            : base(manager, fontAndColorService)
        {
            this.child1 = child1;
            this.child2 = child2;

            switch (child2Position)
            {
                case ZWindowPosition.Left:
                    this.ColumnDefinitions.Add(new ColumnDefinition { Width = child2Size });
                    this.ColumnDefinitions.Add(new ColumnDefinition());
                    SetColumn(this.child1, 1);
                    SetColumn(this.child2, 0);
                    break;
                case ZWindowPosition.Right:
                    this.ColumnDefinitions.Add(new ColumnDefinition());
                    this.ColumnDefinitions.Add(new ColumnDefinition { Width = child2Size });
                    SetColumn(this.child1, 0);
                    SetColumn(this.child2, 1);
                    break;
                case ZWindowPosition.Above:
                    this.RowDefinitions.Add(new RowDefinition { Height = child2Size });
                    this.RowDefinitions.Add(new RowDefinition());
                    SetRow(this.child1, 1);
                    SetRow(this.child2, 0);
                    break;
                case ZWindowPosition.Below:
                    this.RowDefinitions.Add(new RowDefinition());
                    this.RowDefinitions.Add(new RowDefinition { Height = child2Size });
                    SetRow(this.child1, 0);
                    SetRow(this.child2, 1);
                    break;
            }

            child1.SetParentWindow(this);
            child2.SetParentWindow(this);

            this.Children.Add(child1);
            this.Children.Add(child2);
        }
Esempio n. 22
0
 public void loadAllPairs(PairMapper pairmapper)
 {
     GridPairs.Children.Clear();
     List<Model.Pair> pairs = pairmapper.FindAllUnplanned();
     int i = 0;
     foreach (Model.Pair pair in pairs)
     {
         CustomLabel label = new CustomLabel();
         label.Id = pair.ID;
         string content = "";
         if (pair.Student2 != null)
         {
             content = pair.Student1.Firstname + " " + pair.Student1.Surname + "\n" +
                              pair.Student2.Firstname + " " + pair.Student2.Surname + "\n\n";
         }
         else
         {
             content = pair.Student1.Firstname + " " + pair.Student1.Surname + "\n\n";
         }
         string teachers = "";
         string experts = "";
         foreach (Model.User attachment in pair.Attachments)
         {//TODO: find out why attachment shows up if there isnt any...
             string name = attachment.Firstname + " " + attachment.Surname + "\n";
             if (attachment.User_type == "teacher")
                 teachers += name;
             else
                 experts += name;
         }
         label.Content = content + teachers + "\n" + experts;
         label.BorderBrush = Brushes.LightGray;
         label.BorderThickness = new Thickness(2);
         label.Margin = new Thickness(1, 1, 1, 1);
         label.MouseMove += new MouseEventHandler(pair_MouseMove);
         Grid.SetRow(label, i);
         if (GridPairs.RowDefinitions.Count != pairs.Count)
         {
             RowDefinition row = new RowDefinition();
             GridLength height = new GridLength(145);
             row.Height = height;
             GridPairs.RowDefinitions.Add(row);
         }
         GridPairs.Children.Add(label);
         i++;
     }
 }
Esempio n. 23
0
        private void TheSplitterDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var myDoubleAnimation = new GridLengthAnimation {From = leftColumn.Width};

            if (leftColumn.Width.Value - 60 < 0)
            {
                myDoubleAnimation.To = _previousWidth;
            }
            else
            {
                myDoubleAnimation.To = new GridLength(0.0);
                _previousWidth = leftColumn.Width;
            }
            myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5));
            myDoubleAnimation.AccelerationRatio = 0.95;
            leftColumn.BeginAnimation(ColumnDefinition.WidthProperty, myDoubleAnimation);
        }
 protected override void OnInitialized(EventArgs e)
 {
     base.OnInitialized(e);
        // Application.Current.MainWindow.Height  = System.Windows.SystemParameters.PrimaryScreenHeight;
     //    Application.Current.MainWindow.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
     int length = 20;
     String[] args = System.Environment.GetCommandLineArgs();
     if (args.Count() > 1)
     {
         length = Int32.Parse(args[1]);
     }
     GridLength g = new GridLength(length, GridUnitType.Pixel);
     C2.Width = g;
     C1.Width = g;
     R1.Height = g;
     R2.Height = g;
 }
Esempio n. 25
0
        private void SetPannelSize(object sender, DragDeltaEventArgs e)
        {
            panelSize = -e.HorizontalChange + PannelDrag.Margin.Right;

            if (panelSize >= 150.0 && panelSize < ((PlayerWindow.Width / 10) * 6))
            {
                MediaGrid.Margin = new System.Windows.Thickness(0, 0, panelSize, 0);
                LibraryGrid.Margin = new System.Windows.Thickness(0, 0, panelSize, 0);
                PannelDrag.Margin = new System.Windows.Thickness(0, 0, panelSize - 2, 0);
                spliterWidth = new GridLength(PannelDrag.Margin.Right);
                PannelGrid.Width = panelSize;
            }
            else if (panelSize < 50.0)
            {
                panelSize = 225.0;
                ShowPannel(sender, e);
            }
        }
        public InHouseMediaPlayer()
        {
            InitializeComponent();
            GridLength gridlength = new GridLength(0, GridUnitType.Pixel);
            clmEpisodeSelector.Width = gridlength;
            clmEpisodeSelectorContentBorder.Width = gridlength;
            gridlength = new GridLength(4, GridUnitType.Pixel);

            table.Columns.Add("EpisodeID");
            table.Columns.Add("EpisodeName");
            table.Columns.Add("Season");
            table.Columns.Add("seen");
            table.Columns.Add("Gezien");

            InitializeComponent();
            fillComboBox();
            combSerieList.SelectedIndex = 0;
        }
Esempio n. 27
0
        /// <summary>
        /// get answers in Grid
        /// </summary>
        /// <returns></returns>
        internal Grid getAnswersUIElem(int QuestID)
        {
            Grid g = new Grid();
            g.ShowGridLines = true;
            g.Width = 550;

            ColumnDefinition col1 = new ColumnDefinition();
            GridLength gl = new GridLength(50);
            col1.Width = gl;
            ColumnDefinition col2 = new ColumnDefinition();
            GridLength gl2 = new GridLength(500);
            col2.Width = gl2;
            g.ColumnDefinitions.Add(col1);
            g.ColumnDefinitions.Add(col2);

            List<TestAnswer> answers = LoadData.TestAnswerTable.Where(n => n.questionID == QuestID).ToList();
            //creating rows for current answers
            for (int i = 0; i < answers.Count; i++)
            {
                RowDefinition r = new RowDefinition();
                g.RowDefinitions.Add(r);
            }
            int rowCount = 0;

            //building Grid
            foreach (TestAnswer ans in answers)
            {
                CheckBox chBox = new CheckBox();
                chBox.Click += chBox_Click;
                chBox.HorizontalAlignment = HorizontalAlignment.Center;
                chBox.VerticalAlignment = VerticalAlignment.Center;
                Grid.SetColumn(chBox, 0);
                Grid.SetRow(chBox, rowCount);
                g.Children.Add(chBox);

                StackPanel sp = ParsingAnswersForRow(g, rowCount, ans);
                Grid.SetColumn(sp, 1);
                Grid.SetRow(sp, rowCount);
                g.Children.Add(sp);
                rowCount++;
            }
            return g;
        }
Esempio n. 28
0
		private void LoadSettings()
		{
			_isArticlesPanelOpen = Properties.Settings.Default.IsArticlesPanelOpen;
			_articlesPanelWidth = Properties.Settings.Default.ArticlesPanelWidth;
			//if(_articlesPanelWidth.Equals(GridLength.Auto))
			_articlesPanelWidth = new GridLength(0.2, GridUnitType.Star);

			if (_isArticlesPanelOpen) {
				column1.Width = _articlesPanelWidth;
				ArticlesPanel.Visibility = Visibility.Visible;
				gs.Visibility = Visibility.Visible;
				ArticlesPanelBtn.IsChecked = true;
			} else {
				ArticlesPanel.Visibility = Visibility.Collapsed;
				gs.Visibility = Visibility.Collapsed;
				column1.Width = GridLength.Auto;
			}
			Debug.WriteLine("Settings loaded");
			Debug.WriteLine("Width={0}, {1}", column1.Width, _articlesPanelWidth);
		}
Esempio n. 29
0
        static GutterGrid() {
            NumberOfRowsProperty = DependencyProperty.Register("NumberOfRows", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(1, GridLayoutChanged));
            NumberOfColumnsProperty = DependencyProperty.Register("NumberOfColumns", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(1, GridLayoutChanged));
            ColumnGutterWidthProperty = DependencyProperty.Register("ColumnGutterWidth", typeof(GridLength),
                typeof(GutterGrid), new PropertyMetadata(DefaultGutter, GridLayoutChanged));
            RowGutterWidthProperty = DependencyProperty.Register("RowGutterWidth", typeof(GridLength),
                typeof(GutterGrid), new PropertyMetadata(DefaultGutter, GridLayoutChanged));
            RowProperty = DependencyProperty.RegisterAttached("Row", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(ChildElementRowChanged));
            ColumnProperty = DependencyProperty.RegisterAttached("Column", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(ChildElementColumnChanged));
            RowSpanProperty = DependencyProperty.RegisterAttached("RowSpan", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(1, ChildElementRowSpanChanged));
            ColumnSpanProperty = DependencyProperty.RegisterAttached("ColumnSpan", typeof(int), typeof(GutterGrid),
                new PropertyMetadata(1, ChildElementColumnSpanChanged));

            DefaultGutter = new GridLength(10, GridUnitType.Pixel);
        }
Esempio n. 30
0
		private void ArticlesPanelBtn_Click(object sender, RoutedEventArgs e)
		{
			if (ArticlesPanelBtn.IsLoaded == true) {
				if (ArticlesPanelBtn.IsChecked == true) {
					ArticlesPanel.Visibility = Visibility.Visible;
					gs.Visibility = Visibility.Visible;
					column1.Width = _articlesPanelWidth;
					_isArticlesPanelOpen = true;
				} else {
					_articlesPanelWidth = column1.Width;
					column1.Width = GridLength.Auto;
					ArticlesPanel.Visibility = Visibility.Collapsed;
					gs.Visibility = Visibility.Collapsed;

					_isArticlesPanelOpen = false;
					//column3.Width = new GridLength(100, GridUnitType.Star);
				}
			}

		}
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            e.Handled = true;
            Focus();
            adornerPanel.Children.Remove(previewAdorner);
            if (orientation == Orientation.Vertical)
            {
                double             insertionPosition = e.GetPosition(this).Y;
                DesignItemProperty rowCollection     = gridItem.Properties["RowDefinitions"];

                DesignItem currentRow = null;

                using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid row")) {
                    if (rowCollection.CollectionElements.Count == 0)
                    {
                        DesignItem firstRow = gridItem.Services.Component.RegisterComponentForDesigner(new RowDefinition());
                        rowCollection.CollectionElements.Add(firstRow);
                        grid.UpdateLayout();                         // let WPF assign firstRow.ActualHeight

                        currentRow = firstRow;
                    }
                    else
                    {
                        RowDefinition current = grid.RowDefinitions
                                                .FirstOrDefault(r => insertionPosition >= r.Offset &&
                                                                insertionPosition <= (r.Offset + r.ActualHeight));
                        if (current != null)
                        {
                            currentRow = gridItem.Services.Component.GetDesignItem(current);
                        }
                    }

                    if (currentRow == null)
                    {
                        currentRow = gridItem.Services.Component.GetDesignItem(grid.RowDefinitions.Last());
                    }

                    unitSelector.SelectedItem = currentRow;
                    for (int i = 0; i < grid.RowDefinitions.Count; i++)
                    {
                        RowDefinition row = grid.RowDefinitions[i];
                        if (row.Offset > insertionPosition)
                        {
                            continue;
                        }
                        if (row.Offset + row.ActualHeight < insertionPosition)
                        {
                            continue;
                        }

                        // split row
                        GridLength oldLength = (GridLength)row.GetValue(RowDefinition.HeightProperty);
                        GridLength newLength1, newLength2;
                        SplitLength(oldLength, insertionPosition - row.Offset, row.ActualHeight, out newLength1, out newLength2);
                        DesignItem newRowDefinition = gridItem.Services.Component.RegisterComponentForDesigner(new RowDefinition());
                        rowCollection.CollectionElements.Insert(i + 1, newRowDefinition);
                        rowCollection.CollectionElements[i].Properties[RowDefinition.HeightProperty].SetValue(newLength1);
                        newRowDefinition.Properties[RowDefinition.HeightProperty].SetValue(newLength2);
                        grid.UpdateLayout();
                        FixIndicesAfterSplit(i, Grid.RowProperty, Grid.RowSpanProperty, insertionPosition);
                        grid.UpdateLayout();
                        changeGroup.Commit();
                        break;
                    }
                }
            }
            else
            {
                double             insertionPosition = e.GetPosition(this).X;
                DesignItemProperty columnCollection  = gridItem.Properties["ColumnDefinitions"];

                DesignItem currentColumn = null;

                using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid column")) {
                    if (columnCollection.CollectionElements.Count == 0)
                    {
                        DesignItem firstColumn = gridItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition());
                        columnCollection.CollectionElements.Add(firstColumn);
                        grid.UpdateLayout();                         // let WPF assign firstColumn.ActualWidth

                        currentColumn = firstColumn;
                    }
                    else
                    {
                        ColumnDefinition current = grid.ColumnDefinitions
                                                   .FirstOrDefault(r => insertionPosition >= r.Offset &&
                                                                   insertionPosition <= (r.Offset + r.ActualWidth));
                        if (current != null)
                        {
                            currentColumn = gridItem.Services.Component.GetDesignItem(current);
                        }
                    }

                    if (currentColumn == null)
                    {
                        currentColumn = gridItem.Services.Component.GetDesignItem(grid.ColumnDefinitions.Last());
                    }

                    unitSelector.SelectedItem = currentColumn;
                    for (int i = 0; i < grid.ColumnDefinitions.Count; i++)
                    {
                        ColumnDefinition column = grid.ColumnDefinitions[i];
                        if (column.Offset > insertionPosition)
                        {
                            continue;
                        }
                        if (column.Offset + column.ActualWidth < insertionPosition)
                        {
                            continue;
                        }

                        // split column
                        GridLength oldLength = (GridLength)column.GetValue(ColumnDefinition.WidthProperty);
                        GridLength newLength1, newLength2;
                        SplitLength(oldLength, insertionPosition - column.Offset, column.ActualWidth, out newLength1, out newLength2);
                        DesignItem newColumnDefinition = gridItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition());
                        columnCollection.CollectionElements.Insert(i + 1, newColumnDefinition);
                        columnCollection.CollectionElements[i].Properties[ColumnDefinition.WidthProperty].SetValue(newLength1);
                        newColumnDefinition.Properties[ColumnDefinition.WidthProperty].SetValue(newLength2);
                        grid.UpdateLayout();
                        FixIndicesAfterSplit(i, Grid.ColumnProperty, Grid.ColumnSpanProperty, insertionPosition);
                        changeGroup.Commit();
                        grid.UpdateLayout();
                        break;
                    }
                }
            }
            InvalidateVisual();
        }
Esempio n. 32
0
        public void Parse_Should_Parse_Star_Value()
        {
            var result = GridLength.Parse("2*");

            Assert.Equal(new GridLength(2, GridUnitType.Star), result);
        }
Esempio n. 33
0
        public void Parse_Should_Parse_Pixel_Value()
        {
            var result = GridLength.Parse("2");

            Assert.Equal(new GridLength(2, GridUnitType.Pixel), result);
        }
Esempio n. 34
0
 public void Parse_Should_Throw_FormatException_For_Invalid_String()
 {
     Assert.Throws <FormatException>(() => GridLength.Parse("2x"));
 }
Esempio n. 35
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            /* TODO:
             * 1. Horizontal splitter
             */
            if (SkipRender(context))
            {
                return;
            }
            var spl = new TagBuilder("div", "splitter");

            onRender?.Invoke(spl);
            spl.MergeAttribute("key", Guid.NewGuid().ToString());             // disable vue reusing
            MergeAttributes(spl, context);
            if (Height != null)
            {
                spl.MergeStyle("height", Height.Value);
            }
            if (MinWidth != null)
            {
                spl.MergeStyle("min-width", MinWidth.Value);
            }
            spl.AddCssClass(Orientation.ToString().ToLowerInvariant());
            // width
            GridLength p1w = GetWidth(Children[0]) ?? GridLength.Fr1();
            GridLength p2w = GetWidth(Children[1]) ?? GridLength.Fr1();

            String rowsCols = Orientation == Orientation.Vertical ? "grid-template-columns" : "grid-template-rows";

            spl.MergeStyle(rowsCols, $"{p1w} 5px {p2w}");

            spl.RenderStart(context);

            // first part
            var p1 = new TagBuilder("div", "spl-part spl-first");

            p1.RenderStart(context);
            Children[0].RenderElement(context);
            p1.RenderEnd(context);

            new TagBuilder("div", "spl-handle")
            .MergeAttribute(Orientation == Orientation.Vertical ? "v-resize" : "h-resize", String.Empty)
            //.MergeAttribute("key", Guid.NewGuid().ToString()) // disable vue reusing
            .MergeAttribute("first-pane-width", p1w?.Value.ToString())
            .MergeAttribute("data-min-width", GetMinWidth(Children[0])?.Value.ToString())
            .MergeAttribute("second-min-width", GetMinWidth(Children[1])?.Value.ToString())
            .Render(context);

            // second part
            var p2 = new TagBuilder("div", "spl-part spl-second");

            p2.RenderStart(context);
            Children[1].RenderElement(context);
            p2.RenderEnd(context);

            // drag-handle
            new TagBuilder("div", "drag-handle")
            .Render(context);

            spl.RenderEnd(context);
        }
 public GridLengthAnimation(GridLength from, GridLength to, Duration duration)
 {
     From     = from;
     To       = to;
     Duration = duration;
 }
Esempio n. 37
0
 /// <summary>
 /// Helper for setting SuffixWidth property on a UIElement.
 /// </summary>
 /// <param name="element">UIElement to set SuffixWidth property on.</param>
 /// <param name="value">SuffixWidth property value.</param>
 public static void SetSuffixWidth(this UIElement element, GridLength value)
 {
     element.SetValue(SuffixWidthProperty, value);
 }
Esempio n. 38
0
 public Item(object source, GridLength rowGridLength, bool directContent = false)
 {
     Source        = source;
     RowGridLength = rowGridLength;
     DirectContent = directContent;
 }
Esempio n. 39
0
        public void Parse_Should_Parse_Auto_Lowercase()
        {
            var result = GridLength.Parse("auto");

            Assert.Equal(GridLength.Auto, result);
        }
Esempio n. 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ColumnDefinition"/> class.
 /// </summary>
 /// <param name="value">The width of the column.</param>
 /// <param name="type">The width unit of the column.</param>
 public ColumnDefinition(double value, GridUnitType type)
 {
     Width = new GridLength(value, type);
 }
Esempio n. 41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ColumnDefinition"/> class.
 /// </summary>
 /// <param name="width">The width of the column.</param>
 public ColumnDefinition(GridLength width)
 {
     Width = width;
 }
Esempio n. 42
0
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            GridLength val = (GridLength)value;

            return(val.Value);
        }
Esempio n. 43
0
 // For designer
 public TrackerModel()
     : base()
 {
     Title            = "Kinect for Azure #123456";
     DepthColumnWidth = ColorColumnWidth = new GridLength(1, GridUnitType.Star);
 }
Esempio n. 44
0
 public static StackedContentChildInfo CreateHorizontal(GridLength length, double?min = null, double?max = null) => new StackedContentChildInfo
 {
     Horizontal = new GridChildLength(length, min, max),
 };
Esempio n. 45
0
        public SelectPage()
        {
#pragma warning restore 1591
            Title = "112 Zgłoś Zdarzenie";
            var star     = new GridLength(1, GridUnitType.Star);
            var mainGrid = new Grid {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = star
                    },
                    new RowDefinition {
                        Height = star
                    },
                    new RowDefinition {
                        Height = star
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = star
                    },
                    new ColumnDefinition {
                        Width = star
                    },
                    new ColumnDefinition {
                        Width = star
                    }
                }
            };
            mainGrid.Children.Add(
                ImageButton.Create(
                    "Ustawienia", "ustawienia.png", 64,
                    new Command(() => ShowMessage("Ustawienia"))),
                1, 0
                );
            mainGrid.Children.Add(
                ImageButton.Create(
                    "Historia", "historia.png", 64,
                    new Command(() => Navigation.PushAsync(new Pages.HistoryPage()))),
                0, 1
                );
            mainGrid.Children.Add(
                ImageButton.Create(
                    "Zgłoś zdarzenie", "zglos.png", 192,
                    new Command(() => Navigation.PushAsync(new ZglosPage()))),
                1, 1
                );
            mainGrid.Children.Add(
                ImageButton.Create(
                    "Użyszkodnik", "uzytkownik.png", 64,
                    new Command(() => ShowMessage("Użyszkodnik"))),
                2, 1
                );
            mainGrid.Children.Add(
                ImageButton.Create(
                    "Pomoc", "pomoc.png", 64,
                    new Command(() => ShowMessage("Pomoc"))),
                1, 2
                );
            Padding = new Thickness(0, 0);
            Content = mainGrid;
        }
Esempio n. 46
0
        private void LoadListColumn()
        {
            GridLength temp = new GridLength(0);

            if (!Properties.Settings.Default.ListName)
            {
                CombatantView.Columns.Remove(NameColumn); CNameHC.Width = temp;
            }
            if (Properties.Settings.Default.Variable)
            {
                if (Properties.Settings.Default.ListPct)
                {
                    CPercentHC.Width = new GridLength(0.4, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(PercentColumn); CPercentHC.Width = temp;
                }
                if (Properties.Settings.Default.ListTS)
                {
                    CTScoreHC.Width = new GridLength(0.4, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(TScoreColumn); CTScoreHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDmg)
                {
                    CDmgHC.Width = new GridLength(0.8, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(DamageColumn); CDmgHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDmgd)
                {
                    CDmgDHC.Width = new GridLength(0.6, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(DamagedColumn); CDmgDHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDPS)
                {
                    CDPSHC.Width = new GridLength(0.6, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(DPSColumn); CDPSHC.Width = temp;
                }
                if (Properties.Settings.Default.ListJA)
                {
                    CJAHC.Width = new GridLength(0.4, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(JAColumn); CJAHC.Width = temp;
                }
                if (Properties.Settings.Default.ListCri)
                {
                    CCriHC.Width = new GridLength(0.4, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(CriColumn); CCriHC.Width = temp;
                }
                if (Properties.Settings.Default.ListHit)
                {
                    CMdmgHC.Width = new GridLength(0.6, GridUnitType.Star);
                }
                else
                {
                    CombatantView.Columns.Remove(HColumn); CMdmgHC.Width = temp;
                }
            }
            else
            {
                if (!Properties.Settings.Default.ListPct)
                {
                    CombatantView.Columns.Remove(PercentColumn); CPercentHC.Width = temp;
                }
                if (!Properties.Settings.Default.ListTS)
                {
                    CombatantView.Columns.Remove(TScoreColumn); CTScoreHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDmg)
                {
                    if (Properties.Settings.Default.DamageSI)
                    {
                        CDmgHC.Width = new GridLength(50);
                    }
                }
                else
                {
                    CombatantView.Columns.Remove(DamageColumn); CDmgHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDmgd)
                {
                    if (Properties.Settings.Default.DamagedSI)
                    {
                        CDmgDHC.Width = new GridLength(50);
                    }
                }
                else
                {
                    CombatantView.Columns.Remove(DamagedColumn); CDmgDHC.Width = temp;
                }
                if (Properties.Settings.Default.ListDPS)
                {
                    if (Properties.Settings.Default.DPSSI)
                    {
                        CDPSHC.Width = new GridLength(50);
                    }
                }
                else
                {
                    CombatantView.Columns.Remove(DPSColumn); CDPSHC.Width = temp;
                }
                if (!Properties.Settings.Default.ListJA)
                {
                    CombatantView.Columns.Remove(JAColumn); CJAHC.Width = temp;
                }
                if (!Properties.Settings.Default.ListCri)
                {
                    CombatantView.Columns.Remove(CriColumn); CCriHC.Width = temp;
                }
                if (Properties.Settings.Default.ListHit)
                {
                    if (Properties.Settings.Default.MaxSI)
                    {
                        CMdmgHC.Width = new GridLength(50);
                    }
                }
                else
                {
                    CombatantView.Columns.Remove(HColumn); CMdmgHC.Width = temp;
                }
            }
            if (!Properties.Settings.Default.ListAtk)
            {
                CombatantView.Columns.Remove(MaxHitColumn); CAtkHC.Width = temp;
            }
            if (!Properties.Settings.Default.ListTab)
            {
                TabHC.Width = temp; CTabHC.Width = temp;
            }
        }
Esempio n. 47
0
 public static void SetGeneratedColumnWidth(DependencyObject obj, GridLength value)
 {
     obj.SetValue(GeneratedColumnWidthProperty, value);
 }
 protected PropertyBase(ReadOnlyCollection <IProperty> container, GridLength rowHeight)
 {
     mContainer = container;
     RowHeight  = rowHeight;
     Navigate   = new Command(HyperlinkOnRequestNavigate);
 }
Esempio n. 49
0
        private static Grid JsonToGrid(JToken jprops, int iteration)
        {
            // HERE BE DRAGONS
            iteration++;

            ConsoleColor gridColor = ConsoleColor.White;
            GridLength   col1Width = GridLength.Auto;
            GridLength   col2Width = GridLength.Auto;

            switch (iteration)
            {
            case 1:
                gridColor = ConsoleColor.Gray;
                break;

            case 2:
                gridColor = ConsoleColor.Gray;
                break;

            default:
                gridColor = ConsoleColor.DarkGray;
                break;
            }

            Grid grid = new Grid
            {
                Color   = ConsoleColor.White,
                Columns =
                {
                    new Column {
                        Width = col1Width, MinWidth = 5, MaxWidth = 20
                    },
                    new Column {
                        Width = col2Width, MinWidth = 20
                    }
                },
                Stroke      = LineThickness.Single,
                StrokeColor = gridColor
            };

            foreach (JProperty jprop in jprops)
            {
                string name  = jprop.Name;
                JToken value = jprop.Value;
                if ((value.Count() == 1) || (!value.Any()))
                {
                    if (jprop.Value is JArray)
                    {
                        foreach (JToken arrayItem in jprop.Value)
                        {
                            grid.Children.Add(new Cell(name), new Cell(JsonToGrid(arrayItem, iteration)));
                        }
                    }
                    else if (jprop.Value is JObject)
                    {
                        grid.Children.Add(new Cell(jprop.Name), new Cell(JsonToGrid(jprop.Value, iteration)));
                    }
                    else
                    {
                        grid.Children.Add(new Cell(jprop.Name), new Cell(jprop.Value.ToString()));
                    }
                }
                else if (value.Count() > 1)
                {
                    if (value is JArray)
                    {
                        Grid subGrid = new Grid
                        {
                            Color       = ConsoleColor.White,
                            Columns     = { GridLength.Auto },
                            Stroke      = LineThickness.Single,
                            StrokeColor = gridColor
                        };
                        foreach (JToken arrayItem in value)
                        {
                            subGrid.Children.Add(new Cell(arrayItem.ToString()));
                        }
                        grid.Children.Add(new Cell(name), new Cell(subGrid));
                    }
                    else
                    {
                        Grid subGrid = JsonToGrid(value, iteration);
                        grid.Children.Add(new Cell(name), subGrid);
                    }
                }
            }
            return(grid);
        }
Esempio n. 50
0
        private void ZeichneAdminGrid(string typ)
        {
            Bedienleiste.AnmeldefeldTimer.Stop();
            grdMain.Children.Clear();

            ColumnDefinition def1 = new ColumnDefinition();
            GridLength       len  = new GridLength(1000);

            def1.Width = len;
            grdMain.ColumnDefinitions.Add(def1);

            RowDefinition rd   = new RowDefinition();
            GridLength    len2 = new GridLength(50);

            rd.Height = len2;
            grdMain.RowDefinitions.Add(rd);

            RowDefinition rd2 = new RowDefinition();

            grdMain.RowDefinitions.Add(rd2);

            Bedienleiste.SetValue(Grid.ColumnSpanProperty, sgtPlätze.Count > 4 ? 10 : sgtPlätze.Count + 2);
            Grid.SetRow(Bedienleiste, 0);
            Grid.SetColumn(Bedienleiste, 0);
            grdMain.Children.Add(Bedienleiste);

            if (typ.Equals("Turnierspiele"))
            {
                UserControlTurnierspiele ctr = new UserControlTurnierspiele();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                ctr.SetValue(Grid.ColumnSpanProperty, 6);
                ctr.ZeichneGrid(sgtPlätze);
                grdMain.Children.Add(ctr);
            }

            if (typ.Equals("Rechte"))
            {
                UserControlRechte ctr = new UserControlRechte();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                ctr.SetValue(Grid.ColumnSpanProperty, 8);
                ctr.SetValue(Grid.RowSpanProperty, 3);
                grdMain.Children.Add(ctr);
            }

            if (typ.Equals("Buchungen"))
            {
                UserControlAdminBuchung ctr = new UserControlAdminBuchung();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                ctr.SetValue(Grid.ColumnSpanProperty, 6);
                grdMain.Children.Add(ctr);
            }

            if (typ.Equals("Spieler"))
            {
                UserControlSpieler ctr = new UserControlSpieler();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                ctr.SetValue(Grid.ColumnSpanProperty, 3);
                grdMain.Children.Add(ctr);
            }

            if (typ.Equals("FesteBuchungen"))
            {
                UserControlFesteBuchung ctr = new UserControlFesteBuchung();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                ctr.SetValue(Grid.ColumnSpanProperty, 6);
                ctr.ZeichneGrid(sgtPlätze);
                grdMain.Children.Add(ctr);
            }

            if (typ.Equals("Buchung"))
            {
                if (Rechte == null)
                {
                    ZeichneMainGrid();
                }
                else
                {
                    UserControlPlatzbuchung ctr = new UserControlPlatzbuchung();
                    Grid.SetRow(ctr, 1);
                    Grid.SetColumn(ctr, 1);
                    ctr.SetValue(Grid.ColumnSpanProperty, 8);
                    ctr.SetValue(Grid.RowSpanProperty, 3);
                    ctr.btnAbbrechen.Click        += BtnPlatzbuchungAbbrechen_Click;
                    ctr.btnBuchungSpeichern.Click += BtnPlatzbuchungSpeichern_Click;
                    ctr.InitializeData(_ap, Rechte.Id);
                    grdMain.Children.Add(ctr);
                }
            }

            if (typ.Equals("Platzsperre"))
            {
                UserControlPlatzsperre ctr = new UserControlPlatzsperre();
                Grid.SetRow(ctr, 1);
                Grid.SetColumn(ctr, 1);
                grdMain.Children.Add(ctr);
                ctr.ZeichneGrid(sgtPlätze);
            }

            StoppeDenAnzeigeTimer();
        }
Esempio n. 51
0
        public static bool ConvertType(object value, Type targetType, out object result)
        {
            result = value;
            if (value == null)
            {
                return(true);
            }
            if (value is string && targetType == typeof(Type))
            {
                string typeName = (string)value;
                Type   type;
                if (!_objectClassRegistrations.TryGetValue(typeName, out type))
                {
                    type = Type.GetType(typeName);
                }
                if (type != null)
                {
                    result = type;
                    return(true);
                }
            }
            // Don't convert LateBoundValue (or superclass ValueWrapper) here... instances of
            // LateBoundValue must stay unchanged until some code part explicitly converts them!
            if (value is ResourceWrapper)
            {
                object resource = ((ResourceWrapper)value).Resource;
                if (TypeConverter.Convert(resource, targetType, out result))
                {
                    if (ReferenceEquals(resource, result))
                    {
                        // Resource must be copied because setters and other controls most probably need a copy of the resource.
                        // If we don't copy it, Setter is not able to check if we already return a copy because our input value differs
                        // from the output value, even if we didn't do a copy here.
                        result = MpfCopyManager.DeepCopyCutLVPs(result);
                    }
                    return(true);
                }
            }
            if (value is string && targetType == typeof(FrameworkElement))
            {
                // It doesn't suffice to have an implicit data template declaration which returns a label for a string.
                // If you try to build a ResourceWrapper with a string and assign that ResourceWrapper to a Button's Content property
                // with a StaticResource, for example, the ResourceWrapper will be assigned directly without the data template being
                // applied. To make it sill work, we need this explicit type conversion here.
                result = new Label {
                    Content = (string)value, Color = Color.White
                };
                return(true);
            }
            if (targetType == typeof(Transform))
            {
                string   v     = value.ToString();
                string[] parts = v.Split(new[] { ',' });
                if (parts.Length == 6)
                {
                    float[] f = new float[parts.Length];
                    for (int i = 0; i < parts.Length; ++i)
                    {
                        object obj;
                        TypeConverter.Convert(parts[i], typeof(double), out obj);
                        f[i] = (float)obj;
                    }
                    System.Drawing.Drawing2D.Matrix matrix2D = new System.Drawing.Drawing2D.Matrix(f[0], f[1], f[2], f[3], f[4], f[5]);
                    Static2dMatrix matrix = new Static2dMatrix();
                    matrix.Set2DMatrix(matrix2D);
                    result = matrix;
                    return(true);
                }
            }
            else if (targetType == typeof(Vector2))
            {
                result = Convert2Vector2(value.ToString());
                return(true);
            }
            else if (targetType == typeof(Vector3))
            {
                result = Convert2Vector3(value.ToString());
                return(true);
            }
            else if (targetType == typeof(Vector4))
            {
                result = Convert2Vector4(value.ToString());
                return(true);
            }
            else if (targetType == typeof(Thickness))
            {
                Thickness t;
                float[]   numberList = ParseFloatList(value.ToString());

                if (numberList.Length == 1)
                {
                    t = new Thickness(numberList[0]);
                }
                else if (numberList.Length == 2)
                {
                    t = new Thickness(numberList[0], numberList[1]);
                }
                else if (numberList.Length == 4)
                {
                    t = new Thickness(numberList[0], numberList[1], numberList[2], numberList[3]);
                }
                else
                {
                    throw new ArgumentException("Invalid # of parameters");
                }
                result = t;
                return(true);
            }
            else if (targetType == typeof(Color))
            {
                Color color;
                if (ColorConverter.ConvertColor(value, out color))
                {
                    result = color;
                    return(true);
                }
            }
            else if (targetType == typeof(Brush) && value is string || value is Color)
            {
                try
                {
                    Color color;
                    if (ColorConverter.ConvertColor(value, out color))
                    {
                        SolidColorBrush b = new SolidColorBrush
                        {
                            Color = color
                        };
                        result = b;
                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else if (targetType == typeof(GridLength))
            {
                string text = value.ToString();
                if (text == "Auto")
                {
                    result = new GridLength(GridUnitType.Auto, 0.0);
                }
                else if (text == "AutoStretch")
                {
                    result = new GridLength(GridUnitType.AutoStretch, 1.0);
                }
                else if (text.IndexOf('*') >= 0)
                {
                    int pos = text.IndexOf('*');
                    text = text.Substring(0, pos);
                    if (text.Length > 0)
                    {
                        object obj;
                        TypeConverter.Convert(text, typeof(double), out obj);
                        result = new GridLength(GridUnitType.Star, (double)obj);
                    }
                    else
                    {
                        result = new GridLength(GridUnitType.Star, 1.0);
                    }
                }
                else
                {
                    double v = double.Parse(text);
                    result = new GridLength(GridUnitType.Pixel, v);
                }
                return(true);
            }
            else if (targetType == typeof(string) && value is IResourceString)
            {
                result = ((IResourceString)value).Evaluate();
                return(true);
            }
            else if (targetType.IsAssignableFrom(typeof(IExecutableCommand)) && value is ICommand)
            {
                result = new CommandBridge((ICommand)value);
                return(true);
            }
            else if (targetType == typeof(Key) && value is string)
            {
                string str = (string)value;
                // Try a special key
                result = Key.GetSpecialKeyByName(str);
                if (result == null)
                {
                    if (str.Length != 1)
                    {
                        throw new ArgumentException(string.Format("Cannot convert '{0}' to type Key", str));
                    }
                    else
                    {
                        result = new Key(str[0]);
                    }
                }
                return(true);
            }
            else if (targetType == typeof(string) && value is IEnumerable)
            {
                result = StringUtils.Join(", ", (IEnumerable)value);
                return(true);
            }
            result = value;
            return(false);
        }
Esempio n. 52
0
 public GridChildLength(GridLength length, double?min = null, double?max = null)
 {
     GridLength = length;
     MinLength  = min;
     MaxLength  = max;
 }
Esempio n. 53
0
 public static void SetGeneratedRowHeight(DependencyObject obj, GridLength value)
 {
     obj.SetValue(GeneratedRowHeightProperty, value);
 }
Esempio n. 54
0
        public MainWindow()
        {
            if (WpfUtil.IsInDesignMode)
            {
                return;
            }

            this.MinHeight = 430;
            this.MinWidth  = 640;
            this.Width     = AppStatic.MainWindowWidth;
            this.Height    = AppStatic.MainWindowHeight;
#if DEBUG
            NTStopwatch.Start();
#endif
            ConsoleWindow.Instance.Show();
            ConsoleWindow.Instance.MouseDown += (sender, e) => {
                MoveConsoleWindow();
            };
            ConsoleWindow.Instance.Hide();
            this.Owner = ConsoleWindow.Instance;
            SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
            this.Loaded += (sender, e) => {
                MoveConsoleWindow();
                hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource;
                hwndSource.AddHook(new HwndSourceHook(Win32Proc.WindowProc));
            };
            InitializeComponent();
            _leftDrawerGripWidth    = LeftDrawerGrip.Width;
            _btnLeftDrawerGripBrush = BtnLeftDrawerGrip.Background;
            NTMinerRoot.RefreshArgsAssembly.Invoke();
            // 下面几行是为了看见设计视图
            this.ResizeCursors.Visibility = Visibility.Visible;
            this.HideLeftDrawerGrid();
            // 上面几行是为了看见设计视图

            DateTime lastGetServerMessageOn = DateTime.MinValue;
            // 切换了主界面上的Tab时
            this.MainArea.SelectionChanged += (sender, e) => {
                // 延迟创建,以加快主界面的启动
                #region
                var selectedItem = MainArea.SelectedItem;
                if (selectedItem == TabItemSpeedTable)
                {
                    if (SpeedTableContainer.Child == null)
                    {
                        SpeedTableContainer.Child = GetSpeedTable();
                    }
                }
                else if (selectedItem == TabItemMessage)
                {
                    if (MessagesContainer.Child == null)
                    {
                        MessagesContainer.Child = new Messages();
                    }
                }
                else if (selectedItem == TabItemToolbox)
                {
                    if (ToolboxContainer.Child == null)
                    {
                        ToolboxContainer.Child = new Toolbox();
                    }
                }
                else if (selectedItem == TabItemMinerProfileOption)
                {
                    if (MinerProfileOptionContainer.Child == null)
                    {
                        MinerProfileOptionContainer.Child = new MinerProfileOption();
                    }
                }
                VirtualRoot.SetIsServerMessagesVisible(selectedItem == TabItemMessage);
                if (selectedItem == TabItemMessage)
                {
                    if (lastGetServerMessageOn.AddSeconds(10) < DateTime.Now)
                    {
                        lastGetServerMessageOn = DateTime.Now;
                        VirtualRoot.Execute(new LoadNewServerMessageCommand());
                    }
                }
                #endregion
            };
            this.IsVisibleChanged += (sender, e) => {
                #region
                if (this.IsVisible)
                {
                    NTMinerRoot.IsUiVisible = true;
                }
                else
                {
                    NTMinerRoot.IsUiVisible = false;
                }
                MoveConsoleWindow();
                #endregion
            };
            this.ConsoleRectangle.IsVisibleChanged += (sender, e) => {
                MoveConsoleWindow();
            };
            this.StateChanged += (s, e) => {
                #region
                if (Vm.MinerProfile.IsShowInTaskbar)
                {
                    ShowInTaskbar = true;
                }
                else
                {
                    if (WindowState == WindowState.Minimized)
                    {
                        ShowInTaskbar = false;
                    }
                    else
                    {
                        ShowInTaskbar = true;
                    }
                }
                if (WindowState == WindowState.Maximized)
                {
                    ResizeCursors.Visibility = Visibility.Collapsed;
                }
                else
                {
                    ResizeCursors.Visibility = Visibility.Visible;
                }
                MoveConsoleWindow();
                #endregion
            };
            this.ConsoleRectangle.SizeChanged += (s, e) => {
                MoveConsoleWindow();
            };
            this.SizeChanged += (s, e) => {
                #region
                if (this.Width < 860)
                {
                    this.CloseLeftDrawer();
                }
                else
                {
                    this.OpenLeftDrawer();
                }
                if (!this.ConsoleRectangle.IsVisible)
                {
                    if (e.WidthChanged)
                    {
                        ConsoleWindow.Instance.Width = e.NewSize.Width;
                    }
                    if (e.HeightChanged)
                    {
                        ConsoleWindow.Instance.Height = e.NewSize.Height;
                    }
                }
                #endregion
            };
            NotiCenterWindow.Instance.Bind(this, ownerIsTopMost: true);
            this.LocationChanged += (sender, e) => {
                MoveConsoleWindow();
            };
            VirtualRoot.AddCmdPath <CloseMainWindowCommand>(action: message => {
                UIThread.Execute(() => () => {
                    if (message.IsAutoNoUi)
                    {
                        SwitchToNoUi();
                    }
                    else
                    {
                        this.Close();
                    }
                });
            }, location: this.GetType());
            this.AddEventPath <PoolDelayPickedEvent>("从内核输出中提取了矿池延时时展示到界面", LogEnum.DevConsole,
                                                     action: message => {
                UIThread.Execute(() => () => {
                    if (message.IsDual)
                    {
                        Vm.StateBarVm.DualPoolDelayText = message.PoolDelayText;
                    }
                    else
                    {
                        Vm.StateBarVm.PoolDelayText = message.PoolDelayText;
                    }
                });
            }, location: this.GetType());
            this.AddEventPath <MineStartedEvent>("开始挖矿后将清空矿池延时", LogEnum.DevConsole,
                                                 action: message => {
                UIThread.Execute(() => () => {
                    Vm.StateBarVm.PoolDelayText     = string.Empty;
                    Vm.StateBarVm.DualPoolDelayText = string.Empty;
                });
            }, location: this.GetType());
            this.AddEventPath <MineStopedEvent>("停止挖矿后将清空矿池延时", LogEnum.DevConsole,
                                                action: message => {
                UIThread.Execute(() => () => {
                    Vm.StateBarVm.PoolDelayText     = string.Empty;
                    Vm.StateBarVm.DualPoolDelayText = string.Empty;
                });
            }, location: this.GetType());
            this.AddEventPath <Per1MinuteEvent>("挖矿中时自动切换为无界面模式", LogEnum.DevConsole,
                                                action: message => {
                if (NTMinerRoot.IsUiVisible && NTMinerRoot.Instance.MinerProfile.IsAutoNoUi && NTMinerRoot.Instance.IsMining)
                {
                    if (NTMinerRoot.MainWindowRendedOn.AddMinutes(NTMinerRoot.Instance.MinerProfile.AutoNoUiMinutes) < message.BornOn)
                    {
                        VirtualRoot.ThisLocalInfo(nameof(MainWindow), $"挖矿中界面展示{NTMinerRoot.Instance.MinerProfile.AutoNoUiMinutes}分钟后自动切换为无界面模式,可在选项页调整配置");
                        VirtualRoot.Execute(new CloseMainWindowCommand(isAutoNoUi: true));
                    }
                }
            }, location: this.GetType());
            this.AddEventPath <CpuPackageStateChangedEvent>("CPU包状态变更后刷新Vm内存", LogEnum.None,
                                                            action: message => {
                UpdateCpuView();
            }, location: this.GetType());
#if DEBUG
            var elapsedMilliseconds = NTStopwatch.Stop();
            if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds)
            {
                Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor");
            }
#endif
        }
Esempio n. 55
0
        public static bool TryConvert(AstTransformationContext context, IXamlAstValueNode node, string text, IXamlType type, AvaloniaXamlIlWellKnownTypes types, out IXamlAstValueNode result)
        {
            if (type.FullName == "System.TimeSpan")
            {
                var tsText = text.Trim();

                if (!TimeSpan.TryParse(tsText, CultureInfo.InvariantCulture, out var timeSpan))
                {
                    // // shorthand seconds format (ie. "0.25")
                    if (!tsText.Contains(":") && double.TryParse(tsText,
                                                                 NumberStyles.Float | NumberStyles.AllowThousands,
                                                                 CultureInfo.InvariantCulture, out var seconds))
                    {
                        timeSpan = TimeSpan.FromSeconds(seconds);
                    }
                    else
                    {
                        throw new XamlX.XamlLoadException($"Unable to parse {text} as a time span", node);
                    }
                }

                result = new XamlStaticOrTargetedReturnMethodCallNode(node,
                                                                      type.FindMethod("FromTicks", type, false, types.Long),
                                                                      new[] { new XamlConstantNode(node, types.Long, timeSpan.Ticks) });
                return(true);
            }

            if (type.Equals(types.FontFamily))
            {
                result = new AvaloniaXamlIlFontFamilyAstNode(types, text, node);
                return(true);
            }

            if (type.Equals(types.Thickness))
            {
                try
                {
                    var thickness = Thickness.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor,
                                                                         new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a thickness", node);
                }
            }

            if (type.Equals(types.Point))
            {
                try
                {
                    var point = Point.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor,
                                                                         new[] { point.X, point.Y });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a point", node);
                }
            }

            if (type.Equals(types.Vector))
            {
                try
                {
                    var vector = Vector.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor,
                                                                         new[] { vector.X, vector.Y });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a vector", node);
                }
            }

            if (type.Equals(types.Size))
            {
                try
                {
                    var size = Size.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor,
                                                                         new[] { size.Width, size.Height });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a size", node);
                }
            }

            if (type.Equals(types.Matrix))
            {
                try
                {
                    var matrix = Matrix.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor,
                                                                         new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a matrix", node);
                }
            }

            if (type.Equals(types.CornerRadius))
            {
                try
                {
                    var cornerRadius = CornerRadius.Parse(text);

                    result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor,
                                                                         new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft });

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a corner radius", node);
                }
            }

            if (type.Equals(types.Color))
            {
                if (!Color.TryParse(text, out Color color))
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a color", node);
                }

                result = new XamlStaticOrTargetedReturnMethodCallNode(node,
                                                                      type.GetMethod(
                                                                          new FindMethodMethodSignature("FromUInt32", type, types.UInt)
                {
                    IsStatic = true
                }),
                                                                      new[] { new XamlConstantNode(node, types.UInt, color.ToUint32()) });

                return(true);
            }

            if (type.Equals(types.GridLength))
            {
                try
                {
                    var gridLength = GridLength.Parse(text);

                    result = new AvaloniaXamlIlGridLengthAstNode(node, types, gridLength);

                    return(true);
                }
                catch
                {
                    throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a grid length", node);
                }
            }

            if (type.Equals(types.Cursor))
            {
                if (TypeSystemHelpers.TryGetEnumValueNode(types.StandardCursorType, text, node, out var enumConstantNode))
                {
                    var cursorTypeRef = new XamlAstClrTypeReference(node, types.Cursor, false);

                    result = new XamlAstNewClrObjectNode(node, cursorTypeRef, types.CursorTypeConstructor, new List <IXamlAstValueNode> {
                        enumConstantNode
                    });

                    return(true);
                }
            }

            if (type.Equals(types.ColumnDefinitions))
            {
                return(ConvertDefinitionList(node, text, types, types.ColumnDefinitions, types.ColumnDefinition, "column definitions", out result));
            }

            if (type.Equals(types.RowDefinitions))
            {
                return(ConvertDefinitionList(node, text, types, types.RowDefinitions, types.RowDefinition, "row definitions", out result));
            }

            if (type.Equals(types.Classes))
            {
                var classes    = text.Split(' ');
                var classNodes = classes.Select(c => new XamlAstTextNode(node, c, type: types.XamlIlTypes.String)).ToArray();

                result = new AvaloniaXamlIlAvaloniaListConstantAstNode(node, types, types.Classes, types.XamlIlTypes.String, classNodes);
                return(true);
            }

            if (types.IBrush.IsAssignableFrom(type))
            {
                if (Color.TryParse(text, out Color color))
                {
                    var brushTypeRef = new XamlAstClrTypeReference(node, types.ImmutableSolidColorBrush, false);

                    result = new XamlAstNewClrObjectNode(node, brushTypeRef,
                                                         types.ImmutableSolidColorBrushConstructorColor,
                                                         new List <IXamlAstValueNode> {
                        new XamlConstantNode(node, types.UInt, color.ToUint32())
                    });

                    return(true);
                }
            }

            if (type.Equals(types.TextTrimming))
            {
                foreach (var property in types.TextTrimming.Properties)
                {
                    if (property.PropertyType == types.TextTrimming && property.Name.Equals(text, StringComparison.OrdinalIgnoreCase))
                    {
                        result = new XamlStaticOrTargetedReturnMethodCallNode(node, property.Getter, Enumerable.Empty <IXamlAstValueNode>());

                        return(true);
                    }
                }
            }

            if (type.Equals(types.TextDecorationCollection))
            {
                foreach (var property in types.TextDecorations.Properties)
                {
                    if (property.PropertyType == types.TextDecorationCollection && property.Name.Equals(text, StringComparison.OrdinalIgnoreCase))
                    {
                        result = new XamlStaticOrTargetedReturnMethodCallNode(node, property.Getter, Enumerable.Empty <IXamlAstValueNode>());

                        return(true);
                    }
                }
            }

            result = null;
            return(false);
        }
Esempio n. 56
0
        public SettingsPage(string name = null)
        {
            InitializeComponent();
            SetLocationDate();
            SetCalendarSwitch(calendarSwitch);
            SerGoalsSwitch(goalSwitch);

            setting       = false;
            height        = mainStackLayoutRow.Height;
            lastRowHeight = barStackLayoutRow.Height;

            mainGridLayout.BackgroundColor = MainPage.account.backgroundColor;
            frameColor.BackgroundColor     = MainPage.account.headerColor;

            scheduleFrame.BackgroundColor = MainPage.account.headerColor;
            lobbyFrame.BackgroundColor    = MainPage.account.headerColor;
            supportFrame.BackgroundColor  = MainPage.account.headerColor;

            title.Text = "Settings";
            if (Device.RuntimePlatform == Device.iOS)
            {
                titleGrid.Margin = new Thickness(0, 10, 0, 0);
            }


            NavigationPage.SetHasNavigationBar(this, false);

            parentName = name;


            string version = "";
            string build   = "";

            version = DependencyService.Get <IAppVersionAndBuild>().GetVersionNumber();
            build   = DependencyService.Get <IAppVersionAndBuild>().GetBuildNumber();

            appVersion.Text = "App version: " + version + ", App build: " + build;


            var colorTheme = MainPage.account.colorScheme;

            if (colorTheme == "retro")
            {
                retroScheme.BackgroundColor   = Color.FromHex("#0C1E21");
                vibrantScheme.BackgroundColor = Color.Transparent;
                coolScheme.BackgroundColor    = Color.Transparent;
                cottonScheme.BackgroundColor  = Color.Transparent;
                classicScheme.BackgroundColor = Color.Transparent;
                retroLabel.TextColor          = Color.FromHex("#FFFFFF");
                vibrantLabel.TextColor        = Color.FromHex("#0C1E21");
                coolLabel.TextColor           = Color.FromHex("#0C1E21");
                cottonLabel.TextColor         = Color.FromHex("#0C1E21");
                classicLabel.TextColor        = Color.FromHex("#0C1E21");
            }
            else if (colorTheme == "vibrant")
            {
                retroScheme.BackgroundColor   = Color.Transparent;
                vibrantScheme.BackgroundColor = Color.FromHex("#0C1E21");
                coolScheme.BackgroundColor    = Color.Transparent;
                cottonScheme.BackgroundColor  = Color.Transparent;
                classicScheme.BackgroundColor = Color.Transparent;
                retroLabel.TextColor          = Color.FromHex("#0C1E21");
                vibrantLabel.TextColor        = Color.FromHex("#FFFFFF");
                coolLabel.TextColor           = Color.FromHex("#0C1E21");
                cottonLabel.TextColor         = Color.FromHex("#0C1E21");
                classicLabel.TextColor        = Color.FromHex("#0C1E21");
            }
            else if (colorTheme == "cool")
            {
                retroScheme.BackgroundColor   = Color.Transparent;
                vibrantScheme.BackgroundColor = Color.Transparent;
                coolScheme.BackgroundColor    = Color.FromHex("#0C1E21");
                cottonScheme.BackgroundColor  = Color.Transparent;
                classicScheme.BackgroundColor = Color.Transparent;
                retroLabel.TextColor          = Color.FromHex("#0C1E21");
                vibrantLabel.TextColor        = Color.FromHex("#0C1E21");
                coolLabel.TextColor           = Color.FromHex("#FFFFFF");
                cottonLabel.TextColor         = Color.FromHex("#0C1E21");
                classicLabel.TextColor        = Color.FromHex("#0C1E21");
            }
            else if (colorTheme == "cotton")
            {
                retroScheme.BackgroundColor   = Color.Transparent;
                vibrantScheme.BackgroundColor = Color.Transparent;
                coolScheme.BackgroundColor    = Color.Transparent;
                cottonScheme.BackgroundColor  = Color.FromHex("#0C1E21");
                classicScheme.BackgroundColor = Color.Transparent;
                retroLabel.TextColor          = Color.FromHex("#0C1E21");
                vibrantLabel.TextColor        = Color.FromHex("#0C1E21");
                coolLabel.TextColor           = Color.FromHex("#0C1E21");
                cottonLabel.TextColor         = Color.FromHex("#FFFFFF");
                classicLabel.TextColor        = Color.FromHex("#0C1E21");
            }
            else if (colorTheme == "classic")
            {
                retroScheme.BackgroundColor   = Color.Transparent;
                vibrantScheme.BackgroundColor = Color.Transparent;
                coolScheme.BackgroundColor    = Color.Transparent;
                cottonScheme.BackgroundColor  = Color.Transparent;
                classicScheme.BackgroundColor = Color.FromHex("#0C1E21");
                retroLabel.TextColor          = Color.FromHex("#0C1E21");
                vibrantLabel.TextColor        = Color.FromHex("#0C1E21");
                coolLabel.TextColor           = Color.FromHex("#0C1E21");
                cottonLabel.TextColor         = Color.FromHex("#0C1E21");
                classicLabel.TextColor        = Color.FromHex("#FFFFFF");
            }
        }
Esempio n. 57
0
        private void UpdateSplitterVisibility()
        {
            bool isFirstChildVisible  = FirstChild != null && FirstChild.IsVisible;
            bool isSecondChildVisible = SecondChild != null && SecondChild.IsVisible;
            bool areBothVisible       = isFirstChildVisible && isSecondChildVisible;

            gridSplitter.IsVisible = areBothVisible;

            if (Orientation == Orientation.Horizontal)
            {
                if (ColumnDefinitions.Count == 3)
                {
                    if (isFirstChildVisible)
                    {
                        if (oldFirstSize == default(GridLength) || oldFirstSize == zero)
                        {
                            oldFirstSize = FirstChildRelativeSize;
                        }

                        if (ColumnDefinitions[0].Width == zero)
                        {
                            ColumnDefinitions[0].Width = oldFirstSize;
                        }
                    }
                    else
                    {
                        if (ColumnDefinitions[0].Width != zero)
                        {
                            oldFirstSize = ColumnDefinitions[0].Width;
                        }

                        ColumnDefinitions[0].Width = zero;
                    }

                    if (areBothVisible)
                    {
                        ColumnDefinitions[1].Width = separatorSize;
                    }
                    else
                    {
                        ColumnDefinitions[1].Width = zero;
                    }

                    if (isSecondChildVisible)
                    {
                        if (oldSecondSize == default(GridLength) || oldSecondSize == zero)
                        {
                            oldSecondSize = SecondChildRelativeSize;
                        }

                        if (ColumnDefinitions[2].Width == zero)
                        {
                            ColumnDefinitions[2].Width = oldSecondSize;
                        }
                    }
                    else
                    {
                        if (ColumnDefinitions[2].Width != zero)
                        {
                            oldSecondSize = ColumnDefinitions[2].Width;
                        }

                        ColumnDefinitions[2].Width = zero;
                    }
                }
            }
        }
Esempio n. 58
0
 /// <summary>
 /// Helper for setting HeaderWidth property on a UIElement.
 /// </summary>
 /// <param name="element">UIElement to set HeaderWidth property on.</param>
 /// <param name="value">HeaderWidth property value.</param>
 public static void SetHeaderWidth(this UIElement element, GridLength value)
 {
     element.SetValue(HeaderWidthProperty, value);
 }