当前位置: 首页>>代码示例>>C#>>正文


C# TextBox.GetType方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.GetType方法的具体用法?C# TextBox.GetType怎么用?C# TextBox.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.TextBox的用法示例。


在下文中一共展示了TextBox.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveDataOfCard

        public async void SaveDataOfCard()
        {
            SaveAndLoad DataSaverLoader = new SaveAndLoad();
            CardObj DataToBeSaved = new CardObj();
            StackPanel Tmp_SP = new StackPanel();
            TextBox Tmp_TX = new TextBox();

            //First time loop through to delete and correct empty entries
            foreach (UIElement IngredientEntry in this.recipePanel.Children)
            {
               
                if (IngredientEntry.GetType() == Tmp_SP.GetType())
                {
                    
                    StackPanel ThisEntry = (StackPanel)IngredientEntry;
                    //this entry could be empty
                    NumberSelector NS = (NumberSelector)ThisEntry.Children[0];
                    UnitSelector US = (UnitSelector)ThisEntry.Children[1];
                    TextBox TX = (TextBox)ThisEntry.Children[2];
                    //non empty entry
                    if (NS.getSelectedValue() != "" && TX.Text.ToString() != "Drag and drop ingredient here")
                    {
                        TextBox FinalEntryBox = new TextBox();
                        FinalEntryBox.Text = NS.getSelectedValue() + " " + US.getSelectedValue() + " " + TX.Text;
                        /******INSERT TAG******/
                        DataToBeSaved.TagsList.Add(TX.Text);
                        /******INSERT TAG******/
                        FinalEntryBox.Width = width;
                        ThisEntry.Children.Clear();
                        StackPanel Card = (StackPanel)ThisEntry.Parent;
                        int index = Card.Children.IndexOf(ThisEntry);
                        Card.Children.Remove(ThisEntry);
                        Card.Children.Insert(index, FinalEntryBox);
                    }
                    //empty entry
                    else
                    {
                        ThisEntry.Children.Clear();
                        StackPanel Card = (StackPanel)ThisEntry.Parent;
                        Card.Children.Remove(ThisEntry);
                    }
                        
                    
                }
                
            }


            //All entries should be textboxes now 
            disableEditing();

            for (int i = 0; i < this.recipePanel.Children.Count; i++)
            {
                TextBox ThisEntry = (TextBox)this.recipePanel.Children[i];
                DataToBeSaved.IngredientList.Add(ThisEntry.Text.ToString());
                if (i == 0) //first entry is title add to tags
                {
                    DataToBeSaved.TagsList.Add(ThisEntry.Text.ToString());
                    DataToBeSaved.CardTitle = ThisEntry.Text.ToString();
                }
            }



            for (int i = 0; i < this.reversePanel.Children.Count; i++)
            {
                TextBox ThisEntry;
                if (this.reversePanel.Children[i].GetType() == Tmp_TX.GetType())
                {
                    ThisEntry = (TextBox)this.reversePanel.Children[i];
                    DataToBeSaved.InstructionList.Add(ThisEntry.Text.ToString());

                    if (i == 0) //first entry is title add to tags
                        DataToBeSaved.TagsList.Add(ThisEntry.Text.ToString());
                }

             
            }



            LocalAppData AllCardsCollection = await DataSaverLoader.LoadData();
            int ReplaceIndex = -1;
            for (int i = 0; i < AllCardsCollection.AllCardData.Count; i++)
            {
                if (DataToBeSaved.CardTitle == AllCardsCollection.AllCardData[i].CardTitle)
                {
                    ReplaceIndex = i;
                    break;
                }
            }

            if (ReplaceIndex != -1) //Replace
            {
                AllCardsCollection.AllCardData[ReplaceIndex] = DataToBeSaved;
            }
            else
            {
                AllCardsCollection.AddCard(DataToBeSaved);
            }
//.........这里部分代码省略.........
开发者ID:wangfowen,项目名称:Recipe_Box,代码行数:101,代码来源:recipeCard.xaml.cs


注:本文中的Windows.UI.Xaml.Controls.TextBox.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。