Beispiel #1
0
        public static XElementString GetDataGridElement(List<GridItem> items)
        {
            XElementString gridXCs = new XElementString("data:DataGrid.Columns");
           
            items.ForEach(item =>
            {
                XElementString gridXColumn = new XElementString("data:DataGridTextColumn",
                                     new XAttributeString("Header", item.PropertyDisplayName),
                                     new XAttributeString("Width", item.Width.ToString())
                                     );
                if (! string.IsNullOrEmpty(item.PropertyName))
                {
                   gridXColumn.Add( new XAttributeString("Binding", "{Binding Mode=TwoWay, Path=" + item.PropertyName + "}"));
                }

                //XElement gridXColumn = new XElement(data + "DataGridTextColumn", 
                //    new XAttribute("Header", item.PropertyDisplayName),
                //    new XAttribute("Width", item.Width.ToString()),
                //    new XAttribute("Binding", "{Binding Mode=TwoWay, Path=" + item.PropertyName +"}")
                //    );
                gridXCs.Add(gridXColumn);
            });
             //  
            XElementString gridX = new XElementString("data:DataGrid", new XAttributeString("AutoGenerateColumns", "false"));
            gridX.Add(gridXCs);

            return gridX;
        }
        private void InitToast()
        {
            var list = sp_toasts.Children.OfType<ToastItemControl>();
            ToastItems = list.ToList();

            ToastItems.ForEach(item => item.AnimationHideComplete += item_AnimationHideComplete);
        }
 /// <summary>
 /// Handles the Click event of the btnGetSongsYouTube control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void btnGetSongsYouTube_Click(object sender, RoutedEventArgs e)
 {
     this.HideDgSongs();
     this.YouTubeSongsImportViewModel.SongsCount = 0;
     this.YouTubeSongsImportViewModel.ObservableSongs.Clear();
     if (this.YouTubeSongsImportViewModel.SelectedPlaylist != null)
     {
         this.ShowProgressBar();
         List<YouTubeGroovesharkSong> youTubeGroovesharkSong = new List<YouTubeGroovesharkSong>();
         Task t = Task.Factory.StartNew(() =>
         {
             youTubeGroovesharkSong = this.YouTubeSongsImportViewModel.PopulateYouTubeSongs();
         });
         t.ContinueWith(antecedent =>
         {
             youTubeGroovesharkSong.ForEach(x => this.YouTubeSongsImportViewModel.ObservableSongs.Add(x));
             this.YouTubeSongsImportViewModel.SongsCount = this.YouTubeSongsImportViewModel.ObservableSongs.Count;
             this.HideProgressBar();
             this.ShowDgSongs();
             btnMap.IsEnabled = true;
         }, TaskScheduler.FromCurrentSynchronizationContext());   
     }
     else
     {
         ModernDialog.ShowMessage("Please Select an YouTube Playlist!", "Warning", MessageBoxButton.OK);
     }
 }
        public void UpdateFunctionalChoices(String listguid, List<string> choices, Action<bool> reply)
        {
                //string listname = "{C6DE93CD-0076-4B62-B794-3729BADB7242}";

                String choicexml = "<CHOICES>";
                choices.ForEach(choice => { choicexml += "<CHOICE>" + choice.Replace("&","&amp;") + "</CHOICE>"; });
                choicexml += "</CHOICES>";

                string updatequery = "<Method ID='3'>" +
                                     "<Field Type='Choice' Name='Functional' DisplayName='Functional'>" +
                                     choicexml +
                                     "</Field>" +
                                     "</Method>";
                XElement xquery = XElement.Parse(updatequery);
                XElement updatefields = new XElement("Fields", xquery);
                proxy_update.UpdateListCompleted += (s, e) =>
                                                 {
                                                     if(e.Error == null)
                                                     {
                                                         reply(true);
                                                     }
                                                     else
                                                     {
                                                        reply(false);
                                                     }
                                                 };
                proxy_update.UpdateListAsync(listguid, null, null, updatefields, null, null);
            }
        public ResourceHistoryView()
        {
            var listPages = new List<TabViewItem>() {
                new HistogramTabViewItem("油", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.Fuel.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("弹", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.Ammo.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("钢", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.Steel.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("铝", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.Bauxite.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("桶", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.HsRepair.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("喷火器", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.HsBuild.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("开发", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.DevMaterial.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
                new HistogramTabViewItem("改修", new Func<IEnumerable<KeyValuePair<long,double>>>(() => BasicInfoLog?.ModMaterial.Select(x => new KeyValuePair<long, double>(x.Key, x.Value)))),
            };
            listPages.ForEach(x => {
                x.IsSelected = false;
                x.PropertyChanged += (s, e) => {
                    if ((s as HistogramTabViewItem)?.IsSelected == true) {
                        _histogramFactory = (s as HistogramTabViewItem).Factory;
                    }
                };
            });
            Pages = listPages;
            SelectedPage = Pages.First();
            DataStore.Store.OnDataStoreCreate += ds => ds.OnBasicInfoChange += x => {
                RaisePropertyChanged();
            };

            InitializeComponent();
        }
Beispiel #6
0
        private void RemoveAllEntitiesCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            EntityViewModel evm = GetCurrentEntity(e.Parameter);

             List<IEntity> entities = new List<IEntity>(evm.Entity.SubEntities);

             entities.ForEach((en) => evm.Entity.RemoveEntity(en));
        }
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     Ok.Focus();
     _links = this.FindDescendants<RichTextBox>().SelectMany(b => b.Document.GetElementsOfType<Hyperlink>()).ToList();
     _links.ForEach(l =>
     {
         l.RequestNavigate += OnHyperlinkRequestNavigate;
     });
 }
        //private double moveX, moveY;
        public ResultWindow(List<Result> ResultData)
        {
            InitializeComponent();
            dataGrid.ItemsSource = ResultData;

            minX = 0; maxX = 0; minY = 0; maxY = 0; minZ = 0; maxZ = 0;
            XYcanvas.Children.Clear();
            YZcanvas.Children.Clear();
            ResultData.ForEach(x => SetMinMax(x));

            //Get smallest dimension of canvas
            var cMin = Math.Min(this.Width, this.Height);
            //get largest dimension of model bounds
            var modelXYMax = Math.Max(maxX,maxY)-Math.Min(minX, minY);
            var modelYZMax = Math.Max(maxZ, maxY) - Math.Min(minZ, minY);
            var scaleXY = cMin / modelXYMax;
            var scaleYZ = cMin / modelYZMax;
            //scale *= 0.9; //reduce to 90% to fit in some margins

            //draw the rectangles
            ResultData.ForEach(x => DrawItem(x, scaleXY, scaleYZ));
        }
 public BranchEntry()
 {
     List<int> managerIds = new List<int>();
     DataTable dt = DatabaseService.GetDataTable("GetManagerIds");
     foreach (DataRow row in dt.Rows)
     {
         managerIds.Add(int.Parse(row["managerId"].ToString()));
     }
     InitializeComponent();
     if (managerIds.Count > 0)
     {
         managerIds.ForEach(x => cbManagerIds.Items.Add(x));
     }
 }
 public void SetNonOverflowButton(ToolboxButton button)
 {
     ToolboxButton currentNonOverflowButton = this.Children.OfType<ToolboxButton>().First();
     if (currentNonOverflowButton != button)
     {
         List<ToolboxButton> allButtons = new List<ToolboxButton>();
         allButtons.Add(currentNonOverflowButton);
         foreach (ToolboxButton item in Overflow.Items)
             allButtons.Add(item);
         allButtons.Remove(button);
         allButtons.Sort(delegate(ToolboxButton one, ToolboxButton two) { return one.DisplayIndex.CompareTo(two.DisplayIndex); });
         Overflow.Items.Clear();
         allButtons.ForEach(delegate(ToolboxButton item) { Overflow.Items.Add(item); });
     }
 }
 void CommentAPI_LoadCommentDataComplated(List<CommentInfo> commentList, Exception se)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (commentList != null && se == null)
         {
             if (commentList.Count > 0)
             {
                 this.commentInfoCol.Clear();
                 commentList.ForEach(x => { this.commentInfoCol.Add(x); }); //看不懂
             }
         }
         else
             MessageBox.Show(se.Message, "Exception MEssage", MessageBoxButton.OK);
     });
 }
        public void LoadFromDatabase(List<string> kanjiList)
        {
            kanjiDictionary = new Dictionary<string, Kanji>();

            using (KanjiDataContext context = new KanjiDataContext(connectionString)) {

                var data = from k in context.Kanji where kanjiList.Contains(k.Literal) select k;

                kanjiList.ForEach(k => kanjiDictionary.Add(k, data.First(d => d.Literal == k)));

                if (App.AppSettings.IsRandomReviewList)
                    GenerateRandomSequence();
                else
                    GenerateSequence();
            }
          
        }
        private void btnDraw_Click(object sender, RoutedEventArgs e)
        {
            int drawNum = 0;
            List<int> lottoRivi = new List<int>();

            if (Int32.TryParse(txtDrawNum.Text, out drawNum))
            {
                for (int i = 0; i < drawNum; i++)
                {
                    lottoRivi = lottoKone.ArvoRivi(cmbType.Text);
                    lottoRivi.Sort();
                    lottoRivi.ForEach(Tulosta);
                    lottoRivi.Clear();
                    txtResult.Text += Environment.NewLine;
                }
            }
        }
        private void SynchronizeLists()
        {
            if (_adMessage == null || _paperMessage == null)
                return;
            var paperList = _paperMessage.NewspaperList.ToList();
            var adList = _adMessage.AdvertisementList.ToList();

            foreach (var paper in paperList)
            {
                var tempAdList = new List<AdvertisementItemViewModel> ();

                foreach (var adModel in paper.Model.Advertisements)
                {
                    try
                    {
                        if (!paper.Advertisements.Any(a => a.UKey == adModel.UKey))
                            tempAdList.Add(adList.First(a=>a.UKey == adModel.UKey));
                    }
                    catch (Exception e)
                    {
                        string msg = e.Message;
                    }
                }

                tempAdList.ForEach(paper.Advertisements.Add);
            }

            foreach (var ad in adList)
            {
                var tempPaperList = new List<NewspaperItemViewModel>();
                foreach(var paperModel in ad.Model.Newspapers)
                {
                    try
                    {
                        if (!ad.Newspapers.Any(n => n.UKey == paperModel.UKey))
                            tempPaperList.Add(paperList.First(p => p.UKey == paperModel.UKey));
                    }
                    catch (Exception e)
                    {
                        string msg = e.Message;
                    }
                }
                tempPaperList.ForEach(ad.Newspapers.Add);
            }
        }
		public void Init(Model model) {
			inputsList = new List<InputReceiverPair>();

			OnCompleted += () => {
				disposables.Dispose();
			};
			this.model = model;

			InitializeComponent();

			int count = 0;
			if (model.inputs != null)
				count = model.inputs.Count();

			for (int i = 0; i < count; i++) {
				Receiver rec = null;
				AnalyticsEngineInput inp = null;

				if (model.receivers != null && model.receivers.Count() > i)
					rec = model.receivers[i];

				if (model.inputs != null && model.inputs.Count() > i)
					inp = model.inputs[i];

				inputsList.Add(new InputReceiverPair(rec, inp));
			}

			inputsList.ForEach(inp => {
				CreateInputUI(inp);
			});

			FinishCommand = new DelegateCommand(
				() => Success(new Result.Finish(model)),
				() => true
			);
			btnFinish.Command = FinishCommand;

			AbortCommand = new DelegateCommand(
				() => Success(new Result.Abort()),
				() => true
			);
			btnAbort.Command = AbortCommand;
			
			Localization();
		}
 public EditBranch()
 {
     List<int> currentBranchIds = new List<int>();
     DataTable branchNumberDT = DatabaseService.GetDataTable("GetBranchNumbers");
     foreach (DataRow row in branchNumberDT.Rows)
     {
         currentBranchIds.Add(int.Parse(row["BranchNumber"].ToString()));
     }
     InitializeComponent();
     currentBranchIds.ForEach(x => cbBranchToUpdate.Items.Add(x));
     List<int> currentManagerIds = new List<int>();
     DataTable managerTable = DatabaseService.GetDataTable("GetManagerIds");
     foreach (DataRow row in managerTable.Rows)
     {
         currentManagerIds.Add(int.Parse(row["managerId"].ToString()));
     }
     currentManagerIds.ForEach(x => cbManagerIds.Items.Add(x));
 }
Beispiel #17
0
        public File(List<BufferRegion> sources, long size, string type = "", string name = "")
            : base(sources, size, type)
        {
            // figure out last modified date
            sources.ForEach(delegate(BufferRegion source)
            {
                if (_lastModifiedDate == null || _lastModifiedDate.CompareTo(source.buffer.lastModifiedDate) < 0)
                {
                    _lastModifiedDate = source.buffer.lastModifiedDate;
                }
            });

            // if no name was passed take one from first file reference
            if (name == "") {
                _name = sources[0].buffer.name;
            } else {
                _name = name;
            }
        }
Beispiel #18
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            _log.Info("begin awaiting hypertext");
            string text = await _download.GetHypertext(new Uri("https://twitter.com/#!/DrivenLogic/followers"));
            textBox1.Text = text;



            _log.Info("Ended Awaiting hypertext");

            _binaries = await _parse.MatchBinaries(text);
            _binaries.ForEach(b => textBox1.Text += b.ToString());

            //parse content

            //download binaries 

            //process results

        }
        public CharacterCreation()
        {
            InitializeComponent();

            current_step = 0;
            // Instantiate every usercontrol required for the creation
            creation_steps = new List<ICreationSwitcher> {
                                    new Race(),
                                    new Classe(),
                                    new Stats(),
                                    new Gifts(),
                                    new Skills(),
                                    //new Spells(),
                                    new Background()};

            // Defines this as the datacontext of every Icreationswitcher
            creation_steps.ForEach(k => k.DataContext = this);
            // Initialize the current step
            creation_controllers.Content = creation_steps[0];
            update_display();
        }
        void RefreshLines() {
            region.Points.Clear();
            linesList.ForEach(x => {
                mcanvas.Children.Remove(x);
            });
            elipsesList.ForEach(x => {
                mcanvas.Children.Remove(x);
            });
            linesList.Clear();
            pointsList.Clear();

            elipsesList.ForEach(x => {
                Point pt = new Point(Canvas.GetLeft(x) + markerPointerR, Canvas.GetTop(x) + markerPointerR);
                region.Points.Add(pt);
                pointsList.Add(pt);
            });

            linesList = CreateLinesList(pointsList);
            linesList.ForEach(x => { mcanvas.Children.Add(x); });
            elipsesList.ForEach(x => { mcanvas.Children.Add(x); });
        }
        public MainWindow()
        {
            InitializeComponent();

              Thumbnails = new List<HudWindows.ThumbnailViewWindow>();
              Backdrops = new List<HudWindows.BackdropWindow>();
              Backdrops.Add(new HudWindows.BackdropWindow());
              Backdrops.ForEach((b) => b.Show());

              Topmost = true;

              fsMessages.Items.Add(String.Format("Watching: {0}\n", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)));
              fsMessages.SelectedIndex = 0;

              Watcher = new System.IO.FileSystemWatcher(System.Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
              Watcher.IncludeSubdirectories = true;
              Watcher.Created += (sender, e) => this.Dispatcher.Invoke(new Action<object, System.IO.FileSystemEventArgs>(FileChangedEvent), sender, e);
              Watcher.Deleted += (sender, e) => this.Dispatcher.Invoke(new Action<object, System.IO.FileSystemEventArgs>(FileChangedEvent), sender, e);
              Watcher.Changed += (sender, e) => this.Dispatcher.Invoke(new Action<object, System.IO.FileSystemEventArgs>(FileChangedEvent), sender, e);
              Watcher.Renamed += (sender, e) => this.Dispatcher.Invoke(new Action<object, System.IO.RenamedEventArgs>(FileRenamedEvent), sender, e);
              Watcher.EnableRaisingEvents = true;
        }
Beispiel #22
0
        public static XElement GetDataGridElement(List<GridItem> items)
        {
            XElement gridXCs = new XElement(data + "DataGrid.Columns");

            items.ForEach ( item =>
                {
                    XElement gridXColumn = new XElement(data + "DataGridTextColumn",
                                         new XAttribute("Header", item.PropertyDisplayName),
                                         new XAttribute("Width", item.Width.ToString())
                                         );

                    //XElement gridXColumn = new XElement(data + "DataGridTextColumn", 
                    //    new XAttribute("Header", item.PropertyDisplayName),
                    //    new XAttribute("Width", item.Width.ToString()),
                    //    new XAttribute("Binding", "{Binding Mode=TwoWay, Path=" + item.PropertyName +"}")
                    //    );
                    gridXCs.Add(gridXColumn);
                });
            //  Mode=TwoWay, Path={RelationCollection[0].FBEntities
            XElement gridX = new XElement(data + "DataGrid");
//            XElement gridX = new XElement(data + "DataGrid", new XAttribute("ItemsSource", "{Binding}"));
            gridX.Add(gridXCs);
            return gridX;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Bodies = new List<Body>();
            DrawableBodies = new List<DrawableBody>();
            Stopwatch = new Stopwatch();
            /*
            Bodies.Add(new Body(
                new Vector2(30, 30),
                new Vector2(3, 3),
                1e11
            ));*/

            Bodies.Add(new Body(
                new Vector2(400, 350),
                new Vector2(1, 1),
                1e10
            ) { Velocity = new Vector2(0, 0) });
            /*
            Bodies.Add(new Body(
                new Vector2(180, 350),
                new Vector2(10, 10),
                1e2
            ) { Velocity = new Vector2(0, 11) });
            */
            Bodies.Add(new Body(
                new Vector2(500, 350),
                new Vector2(15, 15),
                1.499250375e12
            ) { Velocity = new Vector2(0, 0), Anchored = false });

            Bodies.ForEach(x => DrawableBodies.Add(new DrawableBody(Canvas, x)));

            Stopwatch.Start();

            CompositionTarget.Rendering += Rendering;
        }
Beispiel #24
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            var triLvl = uint.Parse(triLevel.Text);
            var allTriangles = new List<Triangle>();
            var cube = new Cube(Vector3.Parse(cubeFrom.Text),
                Vector3.Parse(cubeTo.Text),
                new Brush[]{
                    Brushes.OrangeRed,
                    Brushes.Green,
                    Brushes.Blue,
                    Brushes.Chartreuse,
                    Brushes.Violet,
                    Brushes.Yellow});
            allTriangles.AddRange(cube.Triangulation(triLvl));

            allTriangles.Sort((a,b) => a.ZZ.CompareTo(b.ZZ));
            allTriangles.ForEach(DrawFigure);
            //var triangle = new Triangle(new Vector3(120, 200, 20), new Vector3(160, 250, 20), new Vector3(200, 200, 20))
            //{
            //    Color = KggCanvas.Color.Blue
            //};

            //triangle.Triangulation(uint.Parse(triLevel.Text)).ForEach(kggCanvas.DrawTriangle);
        }
 /// <summary>
 /// 添加一个对冲交易列表到对冲交易列表
 /// </summary>
 /// <param name="hedgingList">要添加的对冲交易列表</param>
 private void AddHedgingTradeList(List<HedgingTradeData> hedgingList)
 {
     if (_dpObj.CheckAccess())
         hedgingList.ForEach(item => HedgingTradeList.Add(item));
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new AddHedgingTradeListDelegate(list => list.ForEach(item => HedgingTradeList.Add(item))),
             hedgingList);
 }
 /// <summary>
 /// 添加限价挂单列表到列表
 /// </summary>
 /// <param name="orderList">要添加的限价挂单列表</param>
 private void AddPendingOrderList(List<PendingOrderData> orderList)
 {
     if (_dpObj.CheckAccess())
         orderList.ForEach(AddPendingOrderData);
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new AddPendingOrderListDelegate(list => list.ForEach(AddPendingOrderData)),
             orderList);
 }
 /// <summary>
 /// 添加一个汇率和水信息列表到列表
 /// </summary>
 /// <param name="rateWaterInfoList">要添加一个汇率和水的信息列表</param>
 private void AddRateWaterInfoList(List<ExchangeRateWaterInformation> rateWaterInfoList)
 {
     if (_dpObj.CheckAccess())
         rateWaterInfoList.ForEach(AddRateWaterInfo);
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new AddRateWaterInfoListDelegate(list => list.ForEach(AddRateWaterInfo)),
             rateWaterInfoList);
 }
 /// <summary>
 /// 添加一个商品信息列表到商品信息列表
 /// </summary>
 /// <param name="productInfoList">要添加的商品信息列表</param>
 private void AddProductInfoList(List<ProductInformation> productInfoList)
 {
     if (_dpObj.CheckAccess())
         productInfoList.ForEach(AddProductInfo);
     else
         _dpObj.Dispatcher.Invoke(DispatcherPriority.Normal,
             new AddProductInfoListDelegate(list => list.ForEach(AddProductInfo)),
             productInfoList);
 }
 /// <summary>
 /// 添加MAC过滤信息列表到MAC过滤信息列表
 /// </summary>
 /// <param name="infoList">要添加的MAC过滤信息列表</param>
 private void AddMACFilterInfoList(List<MACFilterInformation> infoList)
 {
     if (_dpObj.CheckAccess())
         infoList.ForEach(item => MACFilterInfoes.Add(item));
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new AddMACFilterInfoListDelegate(list => list.ForEach(item => MACFilterInfoes.Add(item))),
             infoList);
 }
 /// <summary>
 /// 添加一个金商账户列表到金商账户列表
 /// </summary>
 /// <param name="dealerList">要添加的金商账户列表</param>
 private void AddDealerAccountList(List<DealerAccount> dealerList)
 {
     if (_dpObj.CheckAccess())
         dealerList.ForEach(AddDealerAccount);
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new AddDealerListDelegate(list => list.ForEach(AddDealerAccount)),
             dealerList);
 }