コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: alexarchen/Moex
        void Refresh()
        {
            try
            {
                Engines.Clear();

                foreach (var item in new EnginesRequest().Response.Engines.Data.Select(d => new Item()
                {
                    Name = d["title"],
                    Value = d["name"],
                    Data = d
                }))
                {
                    Engines.Add(item);
                }


                Markets.Clear();
                Securities.Clear();
                Boards.Clear();

                Info    = "";
                History = new List <HistoryObject>();

                FirePropertyChanged(nameof(Info));
                FirePropertyChanged(nameof(History));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error");
            }
        }
コード例 #2
0
        /// <summary>
        /// Clears the value of the given property.
        /// </summary>
        /// <param name="propertyName">The name of the property whose value to clear.</param>
        public void ClearPropertyValue(string propertyName)
        {
            switch (propertyName)
            {
            case nameof(Size):
                Size = Sizes.NotDefined;
                break;

            case nameof(Engines):
                Engines.Clear();
                break;

            case nameof(Weapons):
                Weapons.Clear();
                break;

            case nameof(Crew):
                Crew = CrewTypes.NotDefined;
                break;

            case nameof(Name):
                Name = string.Empty;
                break;
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: bger0327/CostCutterTest
        private void GetEngines()
        {
            using (var unitOfWork = new UnitOfWork())
            {
                if (!Engines.Any())
                {
                    Engines.Clear();
                    Engines.Add(new Engine()
                    {
                        engine_designation = ""
                    });
                    Engines.AddRange(unitOfWork.EngineRepository.GetAll());
                }

                engineBindingSource.DataSource = Engines;
            }
        }