Ejemplo n.º 1
0
        private ObservableCollection <ModuleManagerModel> GetModuleManagerModels(int?parentId, ObservableCollection <ModuleManagerModel> dataList, int MarginLeft)
        {
            ObservableCollection <ModuleManagerModel> searchDataList = new ObservableCollection <ModuleManagerModel>();

            for (int i = 0; i < dataList.Count; i++)
            {
                if (dataList[i].ParentId == parentId)
                {
                    searchDataList.Add(dataList[i]);
                }
            }

            for (int i = 0; i < searchDataList.Count; i++)
            {
                if (searchDataList[i].ParentId == parentId)
                {
                    searchDataList[i].MarginLeft = MarginLeft;

                    searchDataList[i].PropertyChanged += OnPropertyChangedCommand;
                    DataSource.Add(searchDataList[i]);

                    var subDatas = GetModuleManagerModels(searchDataList[i].Id, dataList, MarginLeft + 20);
                    searchDataList[i].ModuleManagerModels = subDatas;
                }
            }

            return(searchDataList);
        }
 /// <summary>
 /// Select date.
 /// </summary>
 /// <param name="date">Date.</param>
 public virtual void SelectDate(DateTime date)
 {
     if (!IsSelected(date))
     {
         DataSource.Add(date);
     }
 }
Ejemplo n.º 3
0
        public void Draw(CardRepository cardRepository)
        {
            if (!cardRepository.IsLoadingComplete.Signaled || CurrentZone != Zone.SampleHand)
            {
                return;
            }

            var drawn = draw(cardRepository);

            if (drawn == null)
            {
                return;
            }

            TouchedCard = drawn;

            lock (DataSource)
                if (!DataSource.Contains(drawn))
                {
                    DataSource.Add(drawn);
                }

            DeckChanged?.Invoke(
                listChanged: SampleHand.GetCount(drawn.Id) == 1,
                countChanged: true,
                card: drawn,
                touchedChanged: true,
                changedZone: CurrentZone,
                changeTerminatesBatch: true);
        }
        private void CollectMahassiswa(ProgramStudi value)
        {
            if (value == null)
            {
                this.DataSource.Clear();
            }
            else
            {
                using (var db = new DbContext())
                {
                    int number = 1;
                    DataSource.Clear();
                    foreach (var item in db.Mahasiswa.Where(x => x.IdProgdi == value.Id).ToList())
                    {
                        item.Nomor          = number;
                        item.Jurusan        = db.Jurusan.Where(x => x.Id == item.IdJurusan).FirstOrDefault();
                        item.SukuModel      = DataHelpers.DataSuku.Where(x => x.Nilai == item.Suku).FirstOrDefault();
                        item.GelombangModel = DataHelpers.DataGelombang.Where(x => x.Nilai == item.Gelombang).FirstOrDefault();
                        DataSource.Add(item);
                        number++;
                    }
                }
            }

            Source.Refresh();
        }
Ejemplo n.º 5
0
        private bool InitSave()
        {
            var baseUrl = "http://www.012395.com/e/DoInfo/AddInfo.php?mid=15&enews=MAddInfo&classid=115&Submit=%E6%B7%BB%E5%8A%A0%E4%BF%A1%E6%81%AF";

            var response = ApiClient.AddInfo(baseUrl);

            if (response == FuncConst.AddErr)
            {
                FuncMsg.Error($"{FuncConst.AddErr}\r\n{FuncConst.NetworkErr}");
                return(false);
            }

            HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(response);

            if (!IsLogin(html))
            {
                return(false);
            }

            DataSource.Add("enews", GetNodeVal(html, "enews"));
            DataSource.Add("classid", GetNodeVal(html, "classid"));
            DataSource.Add("id", "");
            DataSource.Add("filepass", GetNodeVal(html, "filepass"));
            DataSource.Add("mid", "15");
            DataSource.Add("tokenid", "");
            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add the specified item.
        /// </summary>
        /// <param name="item">Item.</param>
        /// <returns>Index of added item.</returns>
        public virtual int Add(string item)
        {
            var old_indicies = (Sort && SortFunc != null) ? FindIndicies(item) : null;

            DataSource.Add(item);

            if (Sort && SortFunc != null)
            {
                var new_indicies = FindIndicies(item);

                var diff = new_indicies.Except(old_indicies).ToArray();
                if (diff.Length > 0)
                {
                    return(diff[0]);
                }
                if (new_indicies.Count > 0)
                {
                    return(new_indicies[0]);
                }
                return(-1);
            }
            else
            {
                return(DataSource.Count - 1);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 活动粘帖
        /// </summary>
        private void ActionPaste()
        {
            if (clipBoardData == null)
            {
                return;
            }
            if (clipBoardData.Count == 0)
            {
                return;
            }
            ActionList source = clipBoardData[0].ParentTest;

            for (int i = 0; i < clipBoardData.Count; i++)
            {
                ActionBase action = clipBoardData[i];
                source.Remove(action);
                if (Context.State.SelectItemIndex != -1)
                {
                    int insertIndex = Context.State.SelectItemIndex + i;
                    if (insertIndex >= DataSource.Count)
                    {
                        insertIndex = DataSource.Count - 1;
                    }
                    DataSource.Insert(insertIndex, action);
                }
                else
                {
                    DataSource.Add(action);
                }
            }
            DataBind();
            clipBoardData = null;
        }
Ejemplo n.º 8
0
        private void gridControl_DragDrop(object sender, DragEventArgs e)
        {
            TreeListMultiSelection selectionItem = e.Data.GetData(typeof(TreeListMultiSelection)) as TreeListMultiSelection;

            bool changed = false;

            foreach (Library.LibraryNode item in selectionItem)
            {
                MemoryLibraryItem tmpItem = item.Tag as MemoryLibraryItem;
                LiveMessageItem   libItem = new LiveMessageItem();
                libItem.Name   = tmpItem.Name;
                libItem.Target = tmpItem;
                libItem.Id     = tmpItem.Id;
                if (CategoryControl.CheckSameMemoryLibraryItem(libItem, DataSource))
                {
                    DataSource.Add(libItem);
                    RefreshDataSource();
                    changed = true;
                }
            }

            if (changed)
            {
                CategoryItemChanged();
            }
        }
 protected override Task <RS_Create> InnerHandle(RQ_Create request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(new RS_Create
     {
         OrderId = DataSource.Add(request.Name, request.Price),
     }));
 }
Ejemplo n.º 10
0
        void ParseLine(string line)
        {
            if (line == "")
            {
                return;
            }
            var info = line.Split('\t');

            var item = new SteamSpyItem()
            {
                Name      = info[0],
                ScoreRank = (info[1] == "") ? -1 : int.Parse(info[1]),

                Owners         = int.Parse(info[2]),
                OwnersVariance = int.Parse(info[3]),

                Players         = int.Parse(info[4]),
                PlayersVariance = int.Parse(info[5]),

                PlayersIn2Week         = int.Parse(info[6]),
                PlayersIn2WeekVariance = int.Parse(info[7]),

                AverageTimeIn2Weeks = int.Parse(info[8]),
                MedianTimeIn2Weeks  = int.Parse(info[9]),
            };

            DataSource.Add(item);
        }
Ejemplo n.º 11
0
		/// <summary>
		/// Add directory to DataSource.
		/// </summary>
		/// <param name="directory">Directory.</param>
		protected virtual void AddDirectory(string directory)
		{
			var item = new FileSystemEntry(directory, Path.GetFileName(directory), false);
			if (CanDisplayEntry(item))
			{
				DataSource.Add(item);
			}
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Add files DataSource.
		/// </summary>
		/// <param name="file">File.</param>
		protected virtual void AddFiles(string file)
		{
			var item = new FileSystemEntry(file, Path.GetFileName(file), true);
			if (CanDisplayEntry(item))
			{
				DataSource.Add(item);
			}
		}
 public override Task <T> AddAsync(T entity)
 {
     return(Task.Run(() =>
     {
         entity.Id = GetAllAsync().Result.Count + 1;
         DataSource.Add(entity);
         return entity;
     }));
 }
Ejemplo n.º 14
0
 private void _addDataTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     DataSource.Add(new UserModel
     {
         ID   = Guid.NewGuid(),
         Name = "云A" + DataSource.Count
     });
     OnPropertyChanged(nameof(DataSource));
 }
Ejemplo n.º 15
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (objectIsNew)
     {
         DataSource.Add(editObject);
     }
     StopEditMode();
     ObjectChanged?.Invoke(this, editObject);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Load drives list.
        /// </summary>
        protected virtual void GetDrives()
        {
#if !NETFX_CORE
            var drives = Directory.GetLogicalDrives();
            drives.ForEach(drive => {
                var item = new FileSystemEntry(drive, drive, false);
                DataSource.Add(item);
            });
#endif
        }
Ejemplo n.º 17
0
        public async void LoadTags()
        {
            var tags = await monkeyHubApiService.GetTagsAsync();

            DataSource.Clear();
            foreach (Tag tag in tags)
            {
                DataSource.Add(tag);
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Toggle date state.
 /// </summary>
 /// <param name="date">Date.</param>
 public virtual void ToggleDate(DateTime date)
 {
     if (IsSelected(date))
     {
         DataSource.RemoveAll(x => CurrentCalendar.IsSameDay(date, x));
     }
     else
     {
         DataSource.Add(date);
     }
 }
Ejemplo n.º 19
0
        internal void AddItem(
            DropDownListItemComponent item)
        {
            DataSource.Add(new Item(item.Text, item.Value));

            if (item.Selected)
            {
                SelectedValue = item.Value ?? item.Text;
                SelectedValueChanged.InvokeAsync(SelectedValue).GetAwaiter();
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Add the specified item.
        /// </summary>
        /// <param name="item">Item.</param>
        /// <returns>Index of added item.</returns>
        public virtual int Add(TItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item", "Item is null.");
            }

            DataSource.Add(item);

            return(DataSource.IndexOf(item));
        }
Ejemplo n.º 21
0
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            DataSource.Clear();

            foreach (var i in variables)
            {
                DataSource.Add(i);
            }

            DialogResult = true;
        } // OK
Ejemplo n.º 22
0
 public override void CreateFolder(FileManagerFolder parent, string name)
 {
     DataSource.Add(new FileSystemData()
     {
         Id            = GetHashCode(),
         IsFolder      = true,
         LastWriteTime = DateTime.Now,
         Name          = name,
         ParentId      = FindFolderItem(parent).Id
     });
 }
Ejemplo n.º 23
0
 public override void UploadFile(FileManagerFolder folder, string fileName, Stream content)
 {
     DataSource.Add(new FileSystemData()
     {
         Id            = GetHashCode(),
         IsFolder      = false,
         LastWriteTime = DateTime.Now,
         Name          = fileName,
         ParentId      = FindFolderItem(folder).Id
     });
 }
Ejemplo n.º 24
0
 public void GenerateInstances()
 {
     foreach (var instance in App.Connection.CurrentConnections.Select(x => x.Instance).ToList())
     {
         if (InstanceAlreadyInDataSource(instance))
         {
             continue;
         }
         var serverInstance = App.Connection.GetServerAtInstanceName(instance);
         DataSource.Add(ObjectExplorerNodeFactory.CreateServerNode(GetNewNodeId(), serverInstance));
     }
 }
Ejemplo n.º 25
0
 public SearchBoxViewModel()
 {
     _addDataTimer.Elapsed += _addDataTimer_Elapsed;
     for (var i = 0; i < 100; i++)
     {
         DataSource.Add(new UserModel
         {
             ID   = Guid.NewGuid(),
             Name = "云A" + DataSource.Count
         });
     }
     //_addDataTimer.Start();
 }
        public override Task UpdateAsync(T entity)
        {
            return(Task.Run(() =>
            {
                var data = GetAllAsync().Result.FirstOrDefault(x => x.Id == entity.Id);

                if (data != null)
                {
                    DataSource.Remove(data);
                    DataSource.Add(entity);
                }
            }));
        }
Ejemplo n.º 27
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
        {
            DataSource dataSource = existingValue as DataSource ?? new DataSource();

            JObject obj = JObject.Load(reader);

            serializer.Converters.Add(new DataItemJsonConverter());
            foreach (JProperty item in obj.Children())
            {
                dataSource.Add(item.Name, item.Value.ToObject <DataItem>(serializer));
            }
            return(dataSource);
        }
Ejemplo n.º 28
0
 public MyDataGridVM(FrameworkElement obj, DataGridSetting grid)
 {
     this.grid = grid;
     control   = obj as MyDataGrid;
     foreach (var ds in control.grid.Columns)
     {
         GridModel tmp = new GridModel
         {
             NAME_ZH  = ds.Header?.ToString(),
             NAME_ENG = ds?.SortMemberPath
         };
         DataSource.Add(tmp);
     }
 }
Ejemplo n.º 29
0
        public void RenewData()
        {
            int i = 0;

            foreach (List <int> DataSource in Data)
            {
                DataSource.Add(Ecosystem.GetInstance().Species[i].Population);
                if (DataSource.Count > DrawSystem.MAX_X_VALUE)
                {
                    DataSource.RemoveAt(0);
                }
                i++;
            }
        }
Ejemplo n.º 30
0
        private async void TxtQrCode_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Enter)
            {
                var qrCode = _txtQrCode.Text;
                var rfid   = _txtRfid.Text;
                if (rfid == lastRfid)
                {
                    _txtQrCode.SelectAll();
                    return;
                }
                lastRfid = rfid;
                var urlParams = qrCode.Split('?');
                if (urlParams.Length > 1)
                {
                    var ps = urlParams[1].Split('&');
                    var sn = ps.FirstOrDefault(_ => _.StartsWith("sncode="));
                    if (!string.IsNullOrEmpty(sn))
                    {
                        sn = sn.Replace("sncode=", "");
                        if (!string.IsNullOrEmpty(qrCode) && !string.IsNullOrEmpty(lastRfid))
                        {
                            var result = await Task.Run(() => UserContext.ApiHelper.BindWareSNCode(lastRfid, sn));

                            if (result.Success)
                            {
                                var existsVM = DataSource.FirstOrDefault(_ => _.SN == lastRfid);
                                if (existsVM != null)
                                {
                                    existsVM.QrCode = sn;
                                }
                                else
                                {
                                    var vm = new QrCodeBindVM();
                                    vm.Index  = (DataSource.Count + 1).ToString();
                                    vm.SN     = lastRfid;
                                    vm.QrCode = sn;
                                    DataSource.Add(vm);
                                    SelectedIndex = DataSource.Count - 1;
                                    _dataGrid.ScrollIntoView(_dataGrid.SelectedItem);
                                }
                                lastRfid        = null;
                                _txtQrCode.Text = string.Empty;
                            }
                        }
                    }
                }
                _txtQrCode.SelectAll();
            }
        }