private void Compare_Click(object sender, EventArgs e) { int[] prodict1_ids = (from x in Product1Ids.Text.Split('\n') where !string.IsNullOrWhiteSpace(x) select int.Parse(x)).ToArray(); if (Company2.SelectedItem == null) { MessageBox.Show("Company2 is not chosen."); return; } this.Cursor = Cursors.WaitCursor; if (t != null && t.IsAlive) { t.Abort(); } t = new Thread(() => { try { List <ProductLink> pls = engine.CreateProductLinkList(prodict1_ids, ((Item)Company2.SelectedItem).Value); } catch (Exception ex) { Message.Error(ex); } ControlRoutines.BeginInvoke(This, () => { this.Cursor = Cursors.Default; }); }); t.Start(); }
static void Main() { try { //Application.Run(MainForm.This); Engine engine = new Engine(true); List <ProductLink> ls = engine.CreateProductLinkList(new int[] { 82076 }, 2); List <Product> ps = ls[0].Product1s.ToList(); ps.AddRange(ls[1].Product2s.ToList()); //engine.SaveLink(ps.Select(x => x.DbProduct.Id).ToArray()); } catch (Exception e) { } }