本文整理汇总了C#中System.Windows.Documents.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow()
{
InitializeComponent();
testIds = new List<string>();
BuildMsBuildProjectsFullPaths();
GetIpsInformation();
List<ProjectInfo> projectPaths = new List<ProjectInfo>()
{
new ProjectInfo( @"D:\AutomationTestAssistant\TestTime\TestTime.csproj")
};
dgvProjects.ItemsSource = projectPaths;
List<Object> workspaceInfos = new List<Object>();
var tfsInfo = new
{
TfsPath = "tfsTestPath",
LocalPath = "localPathTest",
TfsProjectCollection = "CorporateSites",
WorkspaceName = "TestWorkspaceName"
};
workspaceInfos.Add(tfsInfo);
var tfsInfo1 = new
{
TfsPath = "tfsTestPath1",
LocalPath = "localPathTest1",
TfsProjectCollection = "CorporateSites1",
WorkspaceName = "TestWorkspaceName1"
};
workspaceInfos.Add(tfsInfo1);
dgvTfsSettings.ItemsSource = workspaceInfos;
//dgvProjects.Rows[0].Cells[0].Value = @"D:\AutomationTestAssistant\TestTime\TestTime.csproj";
}
示例2: InitializeRoles
/// Liste der Rollen initialisieren
#region Roles
public List<string> InitializeRoles()
{
List<string> rollen = new List<string>();
rollen.Add("user");
rollen.Add("admin");
return rollen;
}
示例3: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var htmlText = value as string;
if (string.IsNullOrWhiteSpace(htmlText))
return value;
var splits = Regex.Split(htmlText, "<a ");
var result = new List<Inline>();
foreach (var split in splits)
{
if (!split.StartsWith("href=\""))
{
result.AddRange(FormatText(split));
continue;
}
var match = Regex.Match(split, "^href=\"(?<url>(.+?))\" class=\".+?\">(?<text>(.*?))</a>(?<content>(.*?))$", RegexOptions.Singleline);
if (!match.Success)
{
result.Add(new Run(split));
continue;
}
var hyperlink = new Hyperlink(new Run(match.Groups["text"].Value))
{
NavigateUri = new Uri(match.Groups["url"].Value)
};
hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
result.Add(hyperlink);
result.AddRange(FormatText(match.Groups["content"].Value));
}
return result;
}
示例4: PrepareWeekGrid
private void PrepareWeekGrid()
{
for (int i = 0; i < 4; i++)//Creating listviews where we will display Timesatmps for rows
{
ListView list = new ListView();
//Little bit of tinkering with properties to get desired result;
list.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
Label timelabel = new Label();//We will display timestamp on this label
timelabel.Content = TimePeriodToString((timeperiod)i);//setting
list.Items.Add(timelabel);//adding label to listview
TimeStamps.Children.Add(list);//Adding listview to grid;
}
Label[] weekDayLabels = new Label[7];//Labels for dispaly weekday name
List<DayOfWeek> customday = new List<DayOfWeek>();// reshuffling weekady enum to set monday as first day of week
foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek))
.OfType<DayOfWeek>()
.ToList()//monday is second day by default
.Skip(1))//so we skip sunday
{
customday.Add(day);//adding
}
customday.Add(DayOfWeek.Sunday);//and add sunday as last
for (int i = 0; i < weekDayLabels.Length; i++)//Placing all the labels at grid;
{
weekDayLabels[i] = new Label();
weekDayLabels[i].Background = Brushes.LightBlue;
weekDayLabels[i].Content = customday.ElementAt(i).ToString();//With appropriate day name;(This will correspond to actual date-weekday)
DayLabels.Children.Add(weekDayLabels[i]);
}
}
示例5: Map
public Map()
{
walls = new List<Wall>();
players = new List<Player>();
tokens = new List<Token>();
Token.tokenNum = 0;
Player p1 = new Player();
Player p2 = new Player();
p1.setName(Settings.getInstance().getPlayer1Name());
p2.setName(Settings.getInstance().getPlayer2Name());
players.Add(p1);
players.Add(p2);
//width = 13;
//height = 19;
width = (Settings.getInstance().getWidth() * 2) + 1;
height = (Settings.getInstance().getHeight() * 2) + 3;
board = new String[width+2, height+2];
initializeBoard();
placeTokens();
coverageCheck = new int[width, height];
resetCovereage();
}
示例6: SaveCurrentState
public static void SaveCurrentState(AdvancedApplicationBar advancedApplicationBar)
{
var stateList = new List<BaseButton>();
foreach (var buttonItem in advancedApplicationBar.ButtonItems)
{
if(buttonItem is AdvancedApplicationBarMenuItem)
{
var aitem = buttonItem as AdvancedApplicationBarMenuItem;
var baseButton = new BaseMenuItemButton()
{
Text = aitem.Text,
IsVisible = aitem.Visibility == Visibility.Visible,
IsEnabled = aitem.IsEnabled,
};
stateList.Add(baseButton);
}
if(buttonItem is AdvancedApplicationBarIconButton)
{
var aitem = buttonItem as AdvancedApplicationBarIconButton;
var baseButton = new BaseIconItemButton()
{
Text = aitem.Text,
IsVisible = aitem.Visibility == Visibility.Visible,
IsEnabled = aitem.IsEnabled,
IconUri=aitem.IconUri
};
stateList.Add(baseButton);
}
}
PhoneApplicationService.Current.State[GetButtonKey()] = stateList;
PhoneApplicationService.Current.State[GetAppBarKey()] =
new ApplicationBarSaveStateItem().SaveState(advancedApplicationBar);
}
示例7: Create
public FixedDocument Create(IEnumerable<ReportItem> data)
{
var rows = new List<object>();
foreach (var workItem in data)
{
switch (workItem.Type)
{
case "User Story":
rows.Add(new ProductBacklogItemCardRow(workItem));
break;
case "Task":
rows.Add(new TaskCardRow(workItem));
break;
case "Bug":
rows.Add(new BugCardRow(workItem));
break;
default:
rows.Add(new UnknownCardRow(workItem));
break;
}
}
return GenerateReport(
page => new PageInfo(page, DateTime.Now),
PaperSize,
Margins,
rows
);
}
示例8: Export_to_Pdf
public Export_to_Pdf()
{
InitializeComponent();
//Create object for pdf.
document = new PdfDocument();
page = document.AddPage();
gfx = XGraphics.FromPdfPage(page);
//Set by default values.
font = new XFont("Arial", 12, XFontStyle.Regular);
header_font = new XFont("Arial", 12, XFontStyle.Regular);
page.Size = PageSize.A4;
page.Orientation = PageOrientation.Portrait;
//////////////////////////////////////////////////////////////////////
//Create a fake questionanire to test the print process to pdf.
if (questionaire != null)
{
List<Question> question_list = new List<Question>();
List<Answer> answer_list = new List<Answer>();
Answer ans = new Answer();
ans.Answer_descr = "einai to dsfgdsfgsd";
answer_list.Add(ans);
answer_list.Add(ans);
answer_list.Add(ans);
Question quest = new Question() { AnswerList = answer_list };
quest.Question_descr = "H ekfoonisi tis erotisis aytis einai blablbalbablbalblab";
for (int i = 0; i < 10; i++)
{
question_list.Add(quest);
}
questionaire = new Quastionnaire.Model.Questionaire() { Questionaire_descr = "sdfsakdfjdflshsadflkjashflasdfkh", QuestionList = question_list };
}
//////////////////////////////////////////////////////////////////////
}
示例9: GenerateRules
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points)
{
List<IPrimitiveConditionData> result = new List<IPrimitiveConditionData>();
bool singlePoint = false;
foreach (TouchPoint2 point in points)
{
singlePoint = TrigonometricCalculationHelper.isASinglePoint(point);
if (singlePoint)
{
result.Add(null);
continue;
} // A point can't be a closed loop
// if it is not a finger, it can't be a closed loop
if (!point.isFinger)
{
result.Add(null);
continue;
}
ValidSetOfPointsCollection valids = Validate(points);
if ((valids != null) && (valids.Count > 0))
{
_data.State = "true";
result.Add(_data);
}
}
return result;
}
示例10: decrypt
// decrypt list of objects for history function
public List<object> decrypt(List<object> cipherArr)
{
List<object> lstObj = new List<object>();
if (cipherArr.Count > 0)
{
foreach (object o in cipherArr)
{
if (o.GetType() == typeof(JArray))
{
if (((JArray)o).Count > 0)
{
lstObj.Add(decrypt((JArray)o));
}
}
else if (o.GetType() == typeof(string))
{
if ((string)o !="")
{
lstObj.Add(decrypt((string)o));
}
}
else
{
if (((JObject)o).Count > 0)
{
lstObj.Add(decrypt((JObject)o));
}
}
}
}
return lstObj;
}
示例11: UCDiscoverScreen
public UCDiscoverScreen(MainWindow _source)
{
_main = _source;
InitializeComponent();
CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
List<Events> decEvents1 = new List<Events>();
decEvents1.Add(new Events("Inside", "Inside is a play about modern life. Daniel MacIvor adapted the play with University of Calgary students", "Images/inside.jpg", "210 University Ct. N.W\nReeve Theatre",
"Tuesday 7:30 p.m\nWednesday 7:30 p.m\nThursday 7:30 p.m\nFriday 7:30 p.m\nSaturday 7:30 p.m\nSunday 2 p.m"));
decEvents1.Add(new Events("Jewish Book Festival", "Browse hundreds of books at the annual Jewish Book Festival", "Images/jewish_book_event.jpeg", "1607 90 Ave. S.W\nJewish Centre Calgary",
"Sunday 10 a.m. to 8:30 p.m\nMonday 10 a.m.to 8:30 p.m\nTuesday 10 a.m.to 8:30 p.m\nWednesday 10 a.m.to 8:30 p.m\nThursday 10 a.m.to 8:30 p.m\nFriday 10 a.m.to 4 p.m\nSaturday 6 p.m.to 8:30 p.m."));
eventListing = new Dictionary<String, List<Events>>();
eventListing.Add("12/1/2015", decEvents1);
eventListing.Add("12/2/2015", decEvents1);
eventListing.Add("12/3/2015", decEvents1);
eventListing.Add("12/4/2015", decEvents1);
eventListing.Add("12/5/2015", decEvents1);
List <Events> novEvents = new List<Events>();
novEvents.Add(new Events("Calgary Flames", "Calgary flames face off against the league leading team Chicago Blackhawks", "Images/Calgary-Flames.jpg", "555 Saddledome Rise SE\n T2G 2W1", "Saturday 7 p.m - 10 p.m"));
novEvents.Add(new Events("Illuminasia", "Exotic lantern festival from different parts of asia", "Images/illuminasia.jpg", "1300 Zoo Rd NE\nT2E 7V6", "All week 7 pm"));
novEvents.Add(new Events("Calgary Stampede", "Famous cowboy festival for all ages", "Images/stampede_logo.png", "1410 Olympic Way SE\nT2G 2W1", "7 a.m. to 12 p.m"));
eventListing.Add("11/25/2015", novEvents);
expAttractions.IsExpanded = true;
setupCalendar();
}
示例12: GenerateRules
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points)
{
List<IPrimitiveConditionData> rules = new List<IPrimitiveConditionData>();
if (points.Count == 1)
{
_data.Min = 1;
rules.Add(_data);
return rules;
}
int touchCount = 1;
for (int i = 1; i < points.Count; i++)
{
if ((points[i].TouchDeviceId != points[i - 1].TouchDeviceId)
&& points[i].StartTime < points[i-1].EndTime) // this makes sure that the second point starts before the previous finishes
{
touchCount++;
}
}
_data.Min = touchCount;
rules.Add(_data);
if (rules.Count > 0)
return rules;
else
return null;
}
示例13: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
List<Inline> inlines = new List<Inline>();
if (value != null && !string.IsNullOrEmpty(value.ToString()))
{
Vehicle inputVehicle;
Driver inputDriver;
if (value is Vehicle)
{
inputVehicle = (Vehicle)value;
inlines.Add(new Run(inputVehicle.Name + " "));
_CreateListOfSpecialties(inlines, inputVehicle);
}
else if (value is Driver)
{
inputDriver = (Driver)value;
inlines.Add(new Run(inputDriver.Name + " "));
_CreateListOfSpecialties(inlines, inputDriver);
}
}
return inlines;
}
示例14: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Debug.Assert(value is HistoryService.HistoryItem);
Debug.Assert(targetType.Equals(typeof(ICollection<Inline>)));
Debug.Assert(value != null);
HistoryService.HistoryItem item = (HistoryService.HistoryItem)value;
List<Inline> inlines = new List<Inline>();
int startIndex = 0;
int nextIndex = 0;
do
{
nextIndex = item.String.IndexOf(item.Substring, startIndex, StringComparison.InvariantCultureIgnoreCase);
if (nextIndex == -1) // add remaining ordinary text
inlines.Add(new Run(item.String.Substring(startIndex)));
else
{
if (nextIndex != startIndex) // add ordinal text
inlines.Add(new Run(item.String.Substring(startIndex, nextIndex - startIndex)));
inlines.Add(new Bold(new Underline(new Run(item.String.Substring(nextIndex, item.Substring.Length)))));
startIndex = nextIndex + item.Substring.Length;
}
}
while (nextIndex != -1);
return inlines;
}
示例15: GenerateRules
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points)
{
// Paths generally contain a lot of points, we are skipping some points
// to improve performance. The 'step' variable decides how much we should skip
List<IPrimitiveConditionData> primitives = new List<IPrimitiveConditionData>();
bool singlePoint = false;
foreach (TouchPoint2 point in points)
{
if (!point.isFinger)
{
primitives.Add(null);
continue;
}
singlePoint = TrigonometricCalculationHelper.isASinglePoint(point);
if (singlePoint)
{
primitives.Add(null);
continue;
}
StylusPoint p1 = point.Stroke.StylusPoints[0];
StylusPoint p2 = point.Stroke.StylusPoints[point.Stroke.StylusPoints.Count - 1];
double slope = TrigonometricCalculationHelper.GetSlopeBetweenPoints(p1, p2);
string sDirection = TouchPointExtensions.SlopeToDirection(slope);
TouchDirection direction = new TouchDirection();
direction.Values = sDirection;
primitives.Add(direction);
}
return primitives;
}