本文整理汇总了C#中System.Windows.Documents.List.Except方法的典型用法代码示例。如果您正苦于以下问题:C# List.Except方法的具体用法?C# List.Except怎么用?C# List.Except使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Except方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BedWizardDialog
/// <summary>
/// Initializes a new instance of the BedWizardDialog class.
/// </summary>
/// <param name="sheetName">Name of the sheet which has to be parsed.</param>
/// <param name="columnNumbers">List of column numbers which have to be mapped to headers.</param>
/// <param name="bedHeader">List of BED headers.</param>
/// <param name="requiredHeaders">List of mandatory headers.</param>
public BedWizardDialog(string sheetName, List<int> columnNumbers, List<string> bedHeader, List<string> requiredHeaders)
{
this.InitializeComponent();
this.btnOK.Click += this.OnBedWizardSave;
this.btnCancel.Click += this.OnCancelBedWizard;
this.PreviewKeyUp += this.OnBedWizardDialogKeyUp;
this.bedHeader = bedHeader;
this.requiredHeaders = requiredHeaders;
this.txtSubText.Text = string.Format(Properties.Resources.HEADER_SUBTEXT, sheetName);
foreach (string s in requiredHeaders)
{
ColumnMap map = new ColumnMap(columnNumbers, s);
this.stkfirstPanel.Children.Add(map);
}
IEnumerable<string> optionalHeaders = bedHeader.Except(requiredHeaders);
foreach (string s in optionalHeaders)
{
ColumnMap map = new ColumnMap(columnNumbers, s);
this.stkSecondPanel.Children.Add(map);
}
}
示例2: canvas_MouseDown
void canvas_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Mode != ToolMode.Draw) {
return;
}
var pos = e.GetPosition(canvas);
var names = new List<string>();
if (starNamesBox.IsChecked.Value) {
names.AddRange(starNames);
}
if (fictionalNamesBox.IsChecked.Value) {
names.AddRange(fictionalNames);
}
if (customNamesCheckBox.IsChecked.Value) {
names.AddRange(customNamesTextBox.Text.Replace("\r\n", "\n").Split('\n'));
}
names = names.Except(galaxyDrawing.PlanetDrawings.Select(p => p.PlanetName)).ToList();
var name = names.Count == 0 ? "No name" : names[random.Next(names.Count)];
galaxyDrawing.AddPlanet(pos, name).Label.Visibility = DisplayNames.IsChecked.Value ? Visibility.Visible : Visibility.Hidden;
}
示例3: btnSave_Click
private void btnSave_Click(Object sender, RoutedEventArgs e)
{
var oldEntries = new List<RouteTimeTableEntry>(this.Airliner.Routes.SelectMany(r => r.TimeTable.Entries.Where(en => en.Airliner == this.Airliner)));
var deleteEntries = oldEntries.Except(this.Entries);
var newEntries = this.Entries.Except(oldEntries);
foreach (RouteTimeTableEntry entry in newEntries)
{
entry.TimeTable.Route.TimeTable.addEntry(entry);
if (!this.Airliner.Routes.Contains(entry.TimeTable.Route))
this.Airliner.addRoute(entry.TimeTable.Route);
}
foreach (RouteTimeTableEntry entry in deleteEntries)
{
entry.TimeTable.Route.TimeTable.removeEntry(entry);
if (entry.TimeTable.Entries.Count(en => en.Airliner == this.Airliner) == 0)
this.Airliner.removeRoute(entry.TimeTable.Route);
}
}
示例4: btnEventLaunchMod_Click
private void btnEventLaunchMod_Click(object sender, RoutedEventArgs e)
{
string eventSelected = this.eventListView.SelectedItem.ToString().Replace(" ", "_");
string encryptedJson = System.IO.File.ReadAllText(workingDir + "\\Config\\" + eventSelected);
string decryptedJson = CryptoService.Load.Decrypt(encryptedJson, softwareCfg.cipherKey);
_eventFileName = this.eventListView.SelectedItem.ToString().Replace(" ", "_");
eventVar _event = JsonConvert.DeserializeObject<eventVar>(decryptedJson);
string modArgs = null;
bool weHaveNotMod = false;
string missMod = null;
//MOD LIST EXTRACT
List<string> modListEvent = new List<string>();
foreach (string mod in _event.eventMods)
{
modListEvent.Add(mod);
}
//COMPLETE MOD STRING
foreach (string mod in _event.eventMods)
{
modArgs += modPath + "\\" + mod + ";";
}
#region Mod Comparation
List<string> modList = new List<string>();
string[] folders = System.IO.Directory.GetDirectories(modPath, "@*", System.IO.SearchOption.AllDirectories);
foreach (string folder in folders)
{
string input = folder;
string output = input.Split('@').Last();
modList.Add("@" + output);
}
List<string> missingMod = new List<string>();
var firstNotSecond = modListEvent.Except(modList).ToList();
foreach (var x in firstNotSecond)
{
missingMod.Add(x);
missMod += x + "; ";
}
foreach (string missing in missingMod)
{
string mystring = missing;
if (eventListViewMods.Items.Contains(mystring))
weHaveNotMod = true;
}
#endregion
if (weHaveNotMod == false)
{
if (!string.IsNullOrEmpty(modPath) && !string.IsNullOrEmpty(armaPath))
{
Process arma = new Process();
arma.StartInfo.FileName = ("arma3.exe");
arma.StartInfo.Arguments = ("\"-mod=" + modArgs + "\"");
arma.StartInfo.WorkingDirectory = armaPath;
arma.Start();
}
else
MsgBox("Error", "Choose your Arma path and Mods path");
}
else
{
MsgBox("Error", "Some mods are missing " + missMod);
}
}
示例5: CompanyData
private void CompanyData(string updatetime)
{
I_Sql = SqlFactory.MakeSelect(TableType.Table_Type.Compnay);
DataTable SqlTable = new DataTable();
DataTable SqliteTable = new DataTable();
List<int> listsql = new List<int>();
List<int> listsqlite = new List<int>();
List<int> difference = new List<int>();
List<string> SelectList = new List<string>();
SqlTable = Db_Sql.ReSelectdtb(((SqlInterface)I_Sql).GetDatafromSql(updatetime));
SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
Dictionary<int, CompanyModel> sqltablelist = GetSqlcCompany(SqlTable);
IList<DbParameter[]> parlist = new List<DbParameter[]>();
for (int j = 0; j < SqliteTable.Rows.Count; j++)
{
int id = Int32.Parse(SqliteTable.Rows[j]["ID"].ToString());
for (int i = 0; i < sqltablelist.Count; i++)
{
if (id == sqltablelist.Keys.ToList()[i])
{
DbParameter[] DbUpdate = ExecutionSelectCompany(sqltablelist[id]);
parlist.Add(DbUpdate);
SelectList.Add(I_Sql.GetSqliteUpdate());
sqltablelist.Remove(id);
i--;
}
}
}
foreach (int Select in sqltablelist.Keys) //根据差集进行插入操作
{
DbParameter[] DbInsert = ExecutionSelectCompany(sqltablelist[Select]);
parlist.Add(DbInsert);
SelectList.Add(I_Sql.GetSqliteInsert());
}
SqlTable = Db_Sql.ReSelectdtb(I_Sql.GetSqlSelect());
SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
foreach (DataRow dr in SqlTable.Rows)
{
int id = Int32.Parse(dr["ID"].ToString());
listsql.Add(id);
}
foreach (DataRow dr in SqliteTable.Rows)
{
int id = Int32.Parse(dr["ID"].ToString());
listsqlite.Add(id);
}
difference = listsqlite.Except(listsql).ToList();
foreach (int Select in difference)
{
Db_Sqlite.ExSQL(((SqlInterface)I_Sql).GetSqliteDelect(Select)); //删除Service端没有的数据
}
int m = Db_Sqlite.ReExNum(SelectList, parlist);
WriteLog("公司表需要更新" + SelectList.Count().ToString() + "条记录" + " 实际更新" + m.ToString() + "条记录");
}
示例6: DoSave
private void DoSave(object sender, ExecutedRoutedEventArgs e)
{
lock(stateLock)
{
var window = new DiffWindow();
List<PathEntry> newPaths = new List<PathEntry>(SystemPath.Concat(UserPath).Select(_ => _.Path));
List<PathEntry> oldPaths = new List<PathEntry>(reg.SystemPath.Concat(reg.UserPath));
foreach (var x in new ObservableCollection<DiffPath>(newPaths.Except(oldPaths).Select(p => new DiffPath(p, true)).Concat(
oldPaths.Except(newPaths).Select(p => new DiffPath(p, false)))))
{
window.Changes.Add(x);
}
if (window.ShowDialog() == true)
{
Write();
}
}
}
示例7: MyAnalyze
private void MyAnalyze()
{
List<Product> listProductsSend;
if (countProverok > 0 && listProducts == null)
{
countProverok++;
textBlock.Dispatcher.BeginInvoke(new Action(delegate ()
{
textBlock.DataContext = null;
textBlock.Text = "Идет проверка №" + countProverok;
}));
List<Product> listProducts2;
EasyAnalyze esAnalyze = new EasyAnalyze();
listProducts = esAnalyze.GoToPage(urlSite);
if (!File.Exists("Products.json"))
{
//первый запуск
try
{
File.WriteAllText(@"Products.json", JsonConvert.SerializeObject(listProducts));
}
catch (Exception ex)
{
MessageBox.Show("Ошибка записи файла. " + ex.Message);
}
}
else
{
listProducts2 = JsonConvert.DeserializeObject<List<Product>>(File.ReadAllText("Products.json"));
var differences = listProducts2.Where(l2 => listProducts.Any(l1 => l1.Id == l2.Id && l1.Price != l2.Price)).ToList();
listProductsSend = listProducts2.Except(listProducts, new ProductComparer()).ToList();
listProductsSend.AddRange(differences);
listProductsSend.AddRange(listProducts.Except(listProducts2, new ProductComparer()).ToList());
if (listProductsSend.Count > 0)
{
string allprod = "";
foreach (var prod in listProductsSend)
{
prod.Url = Regex.Replace(prod.Url, @"vk.com/wkview\.php\?act=show&al=1&loc=market-([0-9]{1,22}?)&w=product-([0-9)]{1,33})",
"vk.com/market-$1?w=product-$2");
allprod = allprod + " | " + prod.Name + " | " + prod.Price + " | " + prod.Url + " ; \n\r ";
}
Email.SendMail(login, pass, osn, allprod);
try
{
File.WriteAllText(@"Products.json", JsonConvert.SerializeObject(listProducts));
}
catch (Exception ex)
{
MessageBox.Show("Файл не записался. " + ex.Message);
}
}
}
listProducts = null;
//Distinct(new ProductComparer()).ToList(); ;
}
else if (countProverok == 0 && listProducts == null)
{
textBlock.Dispatcher.BeginInvoke(new Action(delegate ()
{
textBlock.DataContext = null;
textBlock.Text = "Первичный сбор информации";
}));
EasyAnalyze esAnalyze = new EasyAnalyze();
listProducts = esAnalyze.GoToPage(urlSite);
if (!File.Exists("Products.json"))
{
File.WriteAllText(@"Products.json", JsonConvert.SerializeObject(listProducts));
}
countProverok++;
listProducts = null;
}
}
示例8: SeatComboBox
//public void SeatComboBox(int divsonID)
//{
// SqlConnection conn = new SqlConnection(dataconnection);
// SqlCommand cmd = new SqlCommand("uspseats", conn);
// cmd.Connection = conn;
// cmd.CommandType = CommandType.StoredProcedure;
// cmd.Parameters.AddWithValue("RoomId", divsonID);
// DataSet ds = new DataSet();
// SqlDataAdapter da = new SqlDataAdapter(cmd);
// da.SelectCommand = cmd;
// conn.Open();
// da.Fill(ds);
// conn.Close();
// if (ds.Tables[0].Rows.Count > 0)
// {
// SeatIDComboBox.SelectedValuePath = "SeatName";
// SeatIDComboBox.DisplayMemberPath = "SeatName";
// SeatIDComboBox.ItemsSource = ds.Tables[0].DefaultView;
// }
//}
public void SeatComboBox()
{
List<string> allSeadCodes = new List<string>() { "S1","S2","S3","S4"};
//List<string> list1 = allSeadCodes.Intersect(allocatedSeatOfARoom).ToList();
var list1 = allSeadCodes.Except(allocatedSeatOfARoom);
SeatIDComboBox.ItemsSource = list1;
//SeatIDComboBox.ItemsSource = allSeadCodes.Intersect(allocatedSeatOfARoom).ToList();
//SeatIDComboBox.ItemsSource = allocatedSeatOfARoom;
}