Esempio n. 1
0
        private IEnumerable<ContentItem> GetChildren(bool getPages)
        {
            var items = new ItemList();
            foreach (var parent in gateway.FindTranslations(Selection.SelectedItem))
            {
	            if (getPages)
	            {
		            foreach (ContentItem child in parent.GetChildPagesUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
			            if (!items.ContainsAny(gateway.FindTranslations(child)))
				            items.Add(child);
	            }
	            else
	            {
					foreach (ContentItem child in parent.GetChildPartsUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
						if (!items.ContainsAny(gateway.FindTranslations(child)))
							items.Add(child);
	            }
            }
            items.Sort();

            foreach (ContentItem item in items)
            {
	            if (item is ILanguage)
                    continue;
	            if (item.IsPage == getPages)
		            yield return item;
            }
        }
		protected ItemList CreateList()
		{
			ItemList list = new ItemList();
			list.Add(CreateOneItem<FirstItem>(1, "one", null));
			list.Add(CreateOneItem<SecondItem>(2, "two", null));
			list.Add(CreateOneItem<NonPageItem>(3, "three", null));
			return list;
		}
		public void CanRemoveTwoDuplicatesWithStaticMethod()
		{
			ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
			ItemList list = new ItemList();
			list.Add(item);
			list.Add(item);
			DuplicateFilter.FilterDuplicates(list);
			Assert.AreEqual(1, list.Count);
		}
Esempio n. 4
0
        public void CanCastItemList()
        {
            ItemList items = new ItemList();
            items.Add(CreateOneItem<FirstItem>(1, "one", null));
            items.Add(CreateOneItem<SecondItem>(1, "two", null));

            ItemList<FirstItem> firsts = items.Cast<FirstItem>();
            Assert.That(firsts.Count, Is.EqualTo(1));
        }
		public void CanRemoveTwoDuplicatesWithWithFilterInstance()
		{
			ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
			ItemList list = new ItemList();
			list.Add(item);
			list.Add(item);
			DuplicateFilter filter = new DuplicateFilter();
			((ItemFilter)filter).Filter(list);
			Assert.AreEqual(1, list.Count);
		}
Esempio n. 6
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            //If we have XBMC New style images being downloaded then we want to check that 3 files exist
            //for the series:
            //http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images
            //poster
            //banner
            //fanart

            if (TVSettings.Instance.XBMCImages)
            {
                ItemList TheActionList = new ItemList();
                // base folder:
                if (!string.IsNullOrEmpty(si.AutoAdd_FolderBase) && (si.AllFolderLocations(false).Count > 0))
                {
                    FileInfo posterJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "poster.jpg");
                    FileInfo bannerJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "banner.jpg");
                    FileInfo fanartJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "fanart.jpg");

                    if ((forceRefresh || (!posterJPG.Exists)) && (!donePosterJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("poster");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, posterJPG, path, false));
                            donePosterJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }

                    if ((forceRefresh || (!bannerJPG.Exists)) && (!doneBannerJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("banner");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, bannerJPG, path, false));
                            doneBannerJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }

                    if ((forceRefresh || (!fanartJPG.Exists)) && (!doneFanartJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("fanart");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, fanartJPG, path));
                            doneFanartJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }
                }
                return TheActionList;
            }

            return base.ProcessShow(si, forceRefresh);
        }
		public override void SetUp()
		{
			base.SetUp();

			list = new ItemList();
			list.Add(item1 = CreateOneItem<FirstItem>(1, "one", null));
			list.Add(item2 = CreateOneItem<SecondItem>(2, "two", item1));
			list.Add(item3 = CreateOneItem<NonPageItem>(3, "three", item2));

			item1.Published = N2.Utility.CurrentTime().AddSeconds(10);
		}
 public static ItemList<Task> GetConflictSetForTask(Task conflictedTask, ItemList<Task> earliestTasksList, ItemList<Job> jobData, Schedule schedule) {
   ItemList<Task> result = new ItemList<Task>();
   double conflictedCompletionTime = ComputeEarliestCompletionTime(conflictedTask, schedule);
   result.Add(conflictedTask);
   foreach (Task t in earliestTasksList) {
     if (t.ResourceNr == conflictedTask.ResourceNr) {
       if (ComputeEarliestStartTime(t, schedule) < conflictedCompletionTime)
         result.Add(t);
     }
   }
   return result;
 }
    public void ApplyTest() {
      IRandom random = new TestRandom(new int[] { 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }, null);
      JSMEncoding individual = TestUtils.CreateTestJSM1();
      JSMShiftChangeManipulator.Apply(random, individual);
      JSMEncoding expected = new JSMEncoding();
      ItemList<Permutation> jsm = new ItemList<Permutation>();
      for (int i = 0; i < 3; i++) {
        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 2, 4, 5 }));
        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 4, 2, 5 }));
      }
      expected.JobSequenceMatrix = jsm;

      Assert.IsTrue(TestUtils.JSMEncodingEquals(expected, individual));
    }
		public void CanClearDuplicateFilter()
		{
			ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
			ItemList list = new ItemList();
			list.Add(item);
			list.Add(item);
			list.Add(item);

			DuplicateFilter filter = new DuplicateFilter();
			filter.Filter(list);
			Assert.AreEqual(1, list.Count);
			filter.Clear();
			filter.Filter(list);
			Assert.AreEqual(1, list.Count);
		}
Esempio n. 11
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.FolderJpg)
            {
                // season folders JPGs

                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName);
                if (!doneFolderJPG.Contains(fi.FullName) && (!fi.Exists|| forceRefresh))
                // some folders may come up multiple times
                {

                    string bannerPath = "";

                    if (TVSettings.Instance.SeasonSpecificFolderJPG())
                    {
                        //We are getting a Series Level image
                        bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
                    }
                    else
                    {
                        //We are getting a Show Level image
                        bannerPath = si.TheSeries().GetItem(TVSettings.Instance.ItemForFolderJpg());
                    }
                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath,
                                                                  TVSettings.Instance.ShrinkLargeMede8erImages));
                    doneFolderJPG.Add(fi.FullName);
                }
                return TheActionList;
            }

            
            return base.ProcessSeason(si,folder,snum,forceRefresh);
        }
Esempio n. 12
0
 public Schedule(int nrOfResources) {
   Resources = new ItemList<Resource>();
   for (int i = 0; i < nrOfResources; i++) {
     Resources.Add(new Resource(i));
   }
   lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>();
 }
Esempio n. 13
0
 public void Add(Item itm)
 {
     ItemList data = new ItemList();
     data.Add(itm);
     Request request = new Request(ItemAction.Add, data);
     request.SendPackage(_sck);
 }
Esempio n. 14
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            

            if (TVSettings.Instance.FolderJpg)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, defaultFileName);
                bool fileDoesntExist = !doneFolderJPG.Contains(fi.FullName) && !fi.Exists;

                if (forceRefresh || fileDoesntExist)
                {
                    //default to poster when we want season posters for the season specific folders;
                    string itemToGet = (TVSettings.Instance.SeasonSpecificFolderJPG()) ? "poster" : TVSettings.Instance.ItemForFolderJpg();

                    string bannerPath = bannerPath = si.TheSeries().GetItem(itemToGet);

                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
                    doneFolderJPG.Add(fi.FullName);
                }
                return TheActionList;

            }
            return null;
        }
Esempio n. 15
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            // for each tv show, optionally write a tvshow.nfo file
            if (TVSettings.Instance.NFOs)
            {
                ItemList TheActionList = new ItemList();
                FileInfo tvshownfo = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "tvshow.nfo");

                bool needUpdate = !tvshownfo.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshownfo.LastWriteTime)) ||
                    // was it written before we fixed the bug in <episodeguideurl> ?
                                  (tvshownfo.LastWriteTime.ToUniversalTime().CompareTo(new DateTime(2009, 9, 13, 7, 30, 0, 0, DateTimeKind.Utc)) < 0);

                bool alreadyOnTheList = DownloadXBMCMetaData.doneNFO.Contains(tvshownfo.FullName);

                if ((forceRefresh || needUpdate) && !alreadyOnTheList)
                {
                    TheActionList.Add(new ActionNFO(tvshownfo, si));
                    DownloadXBMCMetaData.doneNFO.Add(tvshownfo.FullName);
                }
                return TheActionList;

            }
            return base.ProcessShow(si, forceRefresh);
        }
Esempio n. 16
0
 public static JSMEncoding CreateTestJSM2() {
   JSMEncoding result = new JSMEncoding();
   ItemList<Permutation> jsm = new ItemList<Permutation>();
   for (int i = 0; i < 6; i++)
     jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 2, 1, 0 }));
   result.JobSequenceMatrix = jsm;
   return result;
 }
 public ItemList ProcessSeason(ShowItem si, string folder, int snum)
 {
     ItemList TheActionList = new ItemList(); 
     foreach (DownloadIdentifier di in Identifiers)
     {
         TheActionList.Add(di.ProcessSeason (si,folder,snum));
     }
     return TheActionList;
 }
 public ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo)
 {
     ItemList TheActionList = new ItemList();
     foreach (DownloadIdentifier di in Identifiers)
     {
         TheActionList.Add(di.ProcessEpisode(dbep,filo));
     }
     return TheActionList;
 }
		public ItemList CreateItems(int numberOfItems)
		{
			ItemList items = new ItemList();
			for (int i = 0; i < numberOfItems; i++)
			{
				items.Add(CreateOneItem<FirstItem>(i + 1, i.ToString(), null));
			}
			return items;
		}
 public ItemList ProcessShow(ShowItem si)
 {
     ItemList TheActionList = new ItemList(); 
     foreach (DownloadIdentifier di in Identifiers)
     {
         TheActionList.Add(di.ProcessShow(si));
     }
     return TheActionList;
 }
Esempio n. 21
0
        public ItemList CreateItems(int numberOfItems)
        {
            ItemList items = new ItemList();

            for (int i = 0; i < numberOfItems; i++)
            {
                items.Add(CreateOneItem <FirstItem>(i + 1, i.ToString(), null));
            }
            return(items);
        }
Esempio n. 22
0
        private void OnCreate()
        {
            T item = new T()
            {
                Enabled = true
            };

            ItemList.Add(item);
            SelectedItem = item;
        }
Esempio n. 23
0
        public void ItemListDuplicateDataTest()
        {
            ItemList <string> testList = new ItemList <string>(false, false, new List <string>()
            {
                string.Empty
            });

            TestUtility.ExpectException <ArgumentException>(
                () => testList.Add(string.Empty));
        }
 public ItemList ForceUpdateSeason(DownloadIdentifier.DownloadType dt, ShowItem si, string folder, int snum)
 {
     ItemList TheActionList = new ItemList();
     foreach (DownloadIdentifier di in Identifiers)
     {
         if (dt == di.GetDownloadType())
             TheActionList.Add(di.ProcessSeason(si, folder,snum, true));
     }
     return TheActionList;
 }
 public ItemList ForceUpdateShow(DownloadIdentifier.DownloadType dt, ShowItem si)
 {
     ItemList TheActionList = new ItemList();
     foreach (DownloadIdentifier di in Identifiers)
     {
         if (dt == di.GetDownloadType())
             TheActionList.Add(di.ProcessShow(si,true));
     }
     return TheActionList;
 }
Esempio n. 26
0
        public Schedule(int nrOfResources)
        {
            Name = "Schedule";

            Resources = new ItemList <Resource>();
            for (int i = 0; i < nrOfResources; i++)
            {
                Resources.Add(new Resource(i));
            }
            lastScheduledTaskOfJob = new Dictionary <int, ScheduledTask>();
        }
Esempio n. 27
0
 /// <summary>
 /// ITypicalItemStorage
 /// </summary>
 public bool AddAgentToStorage(Agent argAgent)
 {
     if (ItemList.Count + 1 > StorageSize)
     {
         logger.Error("Failed to add {0} to storage {1} cause of lack of space", argAgent, this);
         return(false);
     }
     argAgent.CurrentLocation.TargetStorage = this;
     ItemList.Add(argAgent);
     return(true);
 }
Esempio n. 28
0
 public void setSteuern(IList <SteuerModel> steuern)
 {
     steuern.ToList().ForEach(steuer =>
     {
         ItemList.Add(steuer);
     });
     if (ItemList.Count > 0)
     {
         SelectedItem = ItemList.First();
     }
 }
Esempio n. 29
0
        public async void DispSet(bool Refresh)
        {
            int     i                = 0;
            decimal TotalAssetAdd    = 0;
            decimal PayAssetpriceAdd = 0;

            try
            {
                // UTF8のファイルの書き込み Edit.
                //string write = await StorageControl.PCLSaveCommand("6758,200,1665\n9837,200,712\n6976,200,1846\n6502,0,0");//登録データ書き込み
                // List<Price> prices = Finance.Parse(await StorageControl.PCLLoadCommand());//登録データ読み込み
                List <Price> pricesanser = await Models.PasonalGetserchi();//登録データの現在値を取得する


                if (Refresh == true)
                {
                    ItemList.Clear();// 全て削除
                }

                foreach (Price item in pricesanser)
                {
                    ItemList.Add(new Price
                    {
                        Name      = item.Name,      // "Sony",
                        Stocks    = item.Stocks,    //保有数*
                        Itemprice = item.Itemprice, //
                        Prev_day  = item.Prev_day,  //前日比±**
                        Realprice = item.Realprice, //現在値*// 1000,
                        RealValue = item.RealValue, // 100,
                        Percent   = item.Percent,   //前日比%**// "5"
                        Gain      = item.Gain,      //損益
                        Idindex   = i,
                        // ButtonColor = item.Polar,
                        Polar = item.Polar
                                //FirstLastName = item.FirstLastName
                    });


                    PayAssetpriceAdd = PayAssetpriceAdd + (pricesanser[i].Stocks * Convert.ToDecimal(pricesanser[i].Itemprice)); //株数*購入単価の合計
                    TotalAssetAdd    = TotalAssetAdd + (pricesanser[i].Stocks * Convert.ToDecimal(pricesanser[i].Realprice));    //現在評価額
                                                                                                                                 //Gain = item.Realprice - item.Itemprice;
                    i = ++i;
                }
                PayAssetprice = PayAssetpriceAdd;
                TotalAsset    = TotalAssetAdd;
                UptoAsset     = TotalAsset - PayAssetprice;
            }
            catch (FileNotFoundException)
            {
                await View.DisplayAlert("登録データがありません", "Add.ボタンを押して登録して下さい。", "OK");

                await StorageControl.PCLSaveCommand("");//新規ファイル登録書き込み
            }
        }
    public ItemList<UserGroupBase> GetSelectedItems() {
      ItemList<UserGroupBase> result = new ItemList<UserGroupBase>();

      foreach (var item in itemsListView.SelectedItems) {
        UserGroupBase ugb = ((ListViewItem)item).Tag as UserGroupBase;
        if (ugb != null) {
          result.Add(ugb);
        }
      }
      return result;
    }
Esempio n. 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketBagInfo"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketBagInfo(IL2RPacket packet)
 {
     Type             = packet.ReadByte();
     EnabledSlotCount = packet.ReadUInt16();
     ExpandedCount    = packet.ReadUInt16();
     ItemCount        = packet.ReadUInt16();
     for (int j = 0; j < ItemCount; j++)
     {
         ItemList.Add(new PacketItem(packet));
     }
 }
Esempio n. 32
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (objectType == typeof(ItemList <T>))
            {
                string       startPath = reader.Path;
                ItemList <T> items     = new ItemList <T>();
                if (reader.TokenType == JsonToken.StartArray)
                {
                    items = (ItemList <T>)serializer.Deserialize(reader, typeof(ItemList <T>));
                }
                else if (reader.TokenType == JsonToken.StartObject)
                {
                    var startTime = DateTime.UtcNow;
                    do
                    {
                        reader.Read(); // read next json token
                        if (reader.TokenType == JsonToken.PropertyName)
                        {
                            reader.Read();// read property value
                            string[] path     = reader.Path.Split(new[] { '.' });
                            string   lastPath = path.LastOrDefault();
                            switch (lastPath)
                            {
                            case "_InvoiceSettings":
                                items.InvoiceSettings = (ExpandoObject)serializer.Deserialize(reader, typeof(ExpandoObject));
                                break;

                            default:
                                string inputData = path.LastOrDefault();
                                int    index     = 0;
                                var    pathtest  = int.TryParse(inputData, out index);
                                if (pathtest)
                                {
                                    items.Add((T)serializer.Deserialize(reader, typeof(T)));
                                }
                                break;
                            }
                        }

                        if (TimeoutSeconds != int.MaxValue)
                        {
                            var timeDiff = DateTime.UtcNow - startTime;
                            if (timeDiff.Seconds > TimeoutSeconds)
                            {
                                throw new TimeoutException("SuperFaktura invoice list parsing takes to long. Check the source data or adjust timeout interval");
                            }
                        }
                    }while (reader.TokenType != JsonToken.None && !((reader.TokenType == JsonToken.EndObject || reader.TokenType == JsonToken.EndArray) && startPath == reader.Path));
                }
                return(items);
            }

            return(serializer.Deserialize(reader, objectType));
        }
Esempio n. 33
0
        /// <summary>
        /// Converts <see cref="ItemListSerialized{TItem}"/> to <see cref="ItemList{TItem}"/>.
        /// </summary>
        /// <returns/>
        public ItemList <TItem> ToItemList()
        {
            var itemList = new ItemList <TItem>();

            foreach (var(item, step) in Items)
            {
                itemList.Add(item, step);
            }

            return(itemList);
        }
Esempio n. 34
0
        public async Task Init()
        {
            if (ItemCategoryList.Count == 0)
            {
                var listIC = await _apiServiceIC.Get <List <ItemCategory> >(null);

                foreach (var ic in listIC)
                {
                    ItemCategoryList.Add(ic);
                }
                ItemCategoryList.Insert(0, new ItemCategory {
                    Category = "Sve stavke menija", ItemCategoryId = -1, ItemTypeId = -1
                });
            }
            IEnumerable <RestaurantMenuItem> list = null;

            if (SelectedItemCategory != null)
            {
                if (SelectedItemCategory.ItemCategoryId == -1)
                {
                    list = await _apiServiceRMI.Get <IEnumerable <RestaurantMenuItem> >(null);

                    ItemList.Clear();
                    foreach (var item in list)
                    {
                        ItemList.Add(item);
                    }
                }
                else
                {
                    MenuItemSearchRequest req = new MenuItemSearchRequest
                    {
                        ItemCategoryId = SelectedItemCategory.ItemCategoryId
                    };
                    list = await _apiServiceRMI.Get <IEnumerable <RestaurantMenuItem> >(req);

                    ItemList.Clear();
                    foreach (var item in list)
                    {
                        ItemList.Add(item);
                    }
                }
            }
            else
            {
                list = await _apiServiceRMI.Get <IEnumerable <RestaurantMenuItem> >(null);

                ItemList.Clear();
                foreach (var item in list)
                {
                    ItemList.Add(item);
                }
            }
        }
Esempio n. 35
0
        private static ItemList GetNewsItems(int numberOfNewsItems, Database database)
        {
            ItemList newsItemList = new ItemList();

            for (int i = 0; i < numberOfNewsItems; i++)
            {
                Mock <Item> newsItemMock = GetItemMock(Templates.NewsItem.TemplateId, "NewsItem", database);
                newsItemList.Add(newsItemMock.Object);
            }
            return(newsItemList);
        }
Esempio n. 36
0
        public static void AddToDictionaryList <T, U>(T Key, U Value, Dictionary <T, List <U> > Dict)
        {
            List <U> ItemList;

            if (!Dict.TryGetValue(Key, out ItemList))
            {
                ItemList = new List <U>();
                Dict.Add(Key, ItemList);
            }
            ItemList.Add(Value);
        }
Esempio n. 37
0
        protected IEnumerable <ContentItem> GetChildren(bool getPages)
        {
            var items = new ItemList();

            foreach (var parent in gateway.FindTranslations(Selection.SelectedItem))
            {
                if (getPages)
                {
                    foreach (ContentItem child in parent.GetChildPagesUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
                    {
                        if (!items.ContainsAny(gateway.FindTranslations(child)))
                        {
                            items.Add(child);
                        }
                    }
                }
                else
                {
                    foreach (ContentItem child in parent.GetChildPartsUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
                    {
                        if (!items.ContainsAny(gateway.FindTranslations(child)))
                        {
                            items.Add(child);
                        }
                    }
                }
            }
            items.Sort();

            foreach (ContentItem item in items)
            {
                if (item is ILanguage)
                {
                    continue;
                }
                if (item.IsPage == getPages)
                {
                    yield return(item);
                }
            }
        }
Esempio n. 38
0
        private async Task DownloadItems()
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri("http://services.runescape.com");
                    for (int i = 1; i < 38; i++)
                    {
                        var recivedObject = new RootObject();
                        var response      = await client.GetAsync($"/m=itemdb_rs/api/catalogue/items.json?category={i.ToString()}&alpha={Input}");

                        string result = await response.Content.ReadAsStringAsync();

                        if (result == String.Empty)
                        {
                            continue;
                        }
                        JsonConvert.PopulateObject(result, recivedObject);
                        foreach (var item in recivedObject.Items)
                        {
                            ItemList.Add(new ItemModel()
                            {
                                ItemID      = item.id,
                                ItemUrl     = item.icon,
                                ItemName    = item.name,
                                ItemMembers = item.members,
                                ItemPrice   = item.current.price,
                                ItemChange  = item.today.price
                            });;
                        }
                        NumberOfPages = (ItemList.Count() - 1) / 10 + 1;

                        if (Items.Count() <= 10)
                        {
                            ShowPage();
                        }
                    }
                }
            }
            catch (HttpRequestException ex)
            {
                var error = $"Http request error\n{ex.Message}\n";
                MessageBox.Show(error);
                throw;
            }
            catch (Exception ex)
            {
                var error = $"Cannot download items\n{ex.Message}\n";
                MessageBox.Show(error);
                throw;
            }
        }
Esempio n. 39
0
 public static ItemList<Task> GetEarliestNotScheduledTasks(ItemList<Job> jobData) {
   ItemList<Task> result = new ItemList<Task>();
   foreach (Job j in jobData) {
     foreach (Task t in j.Tasks) {
       if (!t.IsScheduled) {
         result.Add(t);
         break;
       }
     }
   }
   return result;
 }
Esempio n. 40
0
        public static void SpawnPointObject()
        {
            var pointObj = new PointObjects();

            ((ISupportInitialize)(pointObj)).BeginInit();
            pointObj.MouseClick    += new MouseEventHandler(Game.instance.MouseClickShootBullet);
            pointObj.BackColor      = Color.Transparent;
            pointObj.Parent         = Game.instance.pbBackGround;
            pointObj.DoubleBuffered = true;
            ItemList.Add(pointObj);
            ((ISupportInitialize)(pointObj)).EndInit();
        }
Esempio n. 41
0
        public static JSMEncoding CreateTestJSM2()
        {
            JSMEncoding            result = new JSMEncoding();
            ItemList <Permutation> jsm    = new ItemList <Permutation>();

            for (int i = 0; i < 6; i++)
            {
                jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 2, 1, 0 }));
            }
            result.JobSequenceMatrix = jsm;
            return(result);
        }
Esempio n. 42
0
        /// <summary>
        /// Filter the ObservableCollection down to an item list only containing orderID
        /// </summary>
        public static void FilterItemListById(string orderID)
        {
            ItemList.Clear();

            foreach (Item item in MasterItemList)
            {
                if (item.OrderID == orderID)
                {
                    ItemList.Add(item);
                }
            }
        }
Esempio n. 43
0
 public void Add(BaseItem item)
 {
     ItemList.Add(item);
     if (item is SubItem)
     {
         ItemList
         .OfType <ItemGroup>()
         .Where(g => g.GroupId == item.GroupId)
         .Single()
         .NotifyPropertyChanged("Children");
     }
 }
 private void Sample()
 {
     ItemList.Add(new Price
     {
         Name      = "SampleSony",
         Stocks    = 100,
         Itemprice = 2015,
         Realprice = 1000,
         RealValue = 100,
         Percent   = "5"
     });
 }
Esempio n. 45
0
        //public void AddColumnToTable(ColumnInfo info)
        //{
        //     if(!string.IsNullOrWhiteSpace(info.ColumnName) && !_ColumnTable.Columns.Contains(info.ColumnName) && info.ColumnType !=null)
        //     {
        //         _ColumnTable.Columns.Add(info.ColumnName,info.ColumnType);
        //     }
        //}

        public void InitManulTestItem()
        {
            foreach (TestStep step in ChildTestStepList)
            {
                if (step is ManualLoopTestStep)
                {
                    (step as ManualLoopTestStep).InitManulTestItem();
                    foreach (LoopTestItem item in step.ItemList)
                    {
                        DataTable tb = new DataTable();
                        if (Table != null)
                        {
                            foreach (DataColumn column in ColumnTable.Columns)
                            {
                                tb.Columns.Add(column.ColumnName, column.DataType);
                            }
                        }
                        foreach (DataColumn column in (item as LoopTestItem).ItemResult.Columns)
                        {
                            tb.Columns.Add(column.ColumnName, column.DataType);
                        }
                        ItemList.Add(new LoopTestItem()
                        {
                            TestStepName = (item as LoopTestItem).TestStepName,
                            ItemIndex    = (item as LoopTestItem).ItemIndex,
                            ItemResult   = tb
                        });
                    }
                }
                else
                {
                    foreach (var item in step.ItemList)
                    {
                        DataTable tb = new DataTable();
                        if (ColumnTable != null)
                        {
                            foreach (DataColumn column in ColumnTable.Columns)
                            {
                                tb.Columns.Add(column.ColumnName, column.DataType);
                            }
                        }
                        tb.Columns.Add("Y", typeof(double));
                        ItemList.Add(new LoopTestItem()
                        {
                            TestStepName = step.Name,
                            ItemIndex    = step.ItemList.IndexOf(item),
                            ItemResult   = tb
                        });
                    }
                }
            }
        }
Esempio n. 46
0
        /// <summary>
        /// Once an item was edited / newly added update the Lists of Items
        /// </summary>
        public void updateView()
        {
            T storedItem = (T)PhoneApplicationService.Current.State["EditItem"];

            if (ItemList.Contains(storedItem))
            {
                ItemList[this._EditItemIndex] = storedItem;
            }
            else
            {
                ItemList.Add(storedItem);
            }
        }
Esempio n. 47
0
        internal async void RemoveItem(Item item)
        {
            //Add item to ItemList, remove item from CategoryItem and remove item from Category.Item on the backend


            var result = await Client.HttpClient.DeleteAsync("http://localhost:65177/api/Category/" + Category.Id.ToString() + "/Item/" + item.Id.ToString());

            if (result.IsSuccessStatusCode)
            {
                ItemList.Add((Item)item);
                CategoryItems.Remove((Item)item);
            }
        }
Esempio n. 48
0
        public static void DropHeart(Virus virus)
        {
            var heart = new Hearts();

            ((ISupportInitialize)(heart)).BeginInit();
            heart.MouseClick    += new MouseEventHandler(Game.instance.MouseClickShootBullet);
            heart.BackColor      = Color.Transparent;
            heart.Parent         = Game.instance.pbBackGround;
            heart.DoubleBuffered = true;
            heart.Location       = new Point((virus.Location.X + virus.Width / 2 - heart.Width / 2), (virus.Location.Y + virus.Height / 2 - heart.Width / 2));
            ItemList.Add(heart);
            ((ISupportInitialize)(heart)).EndInit();
        }
Esempio n. 49
0
        public static void DropLPItem(Virus virus)
        {
            var lpItem = new LevelProgressItems();

            ((ISupportInitialize)(lpItem)).BeginInit();
            lpItem.MouseClick    += new MouseEventHandler(Game.instance.MouseClickShootBullet);
            lpItem.BackColor      = Color.Transparent;
            lpItem.Parent         = Game.instance.pbBackGround;
            lpItem.DoubleBuffered = true;
            lpItem.Location       = new Point((virus.Location.X + virus.Width / 2 - lpItem.Width / 2), (virus.Location.Y + virus.Height / 2 - lpItem.Width / 2));
            ItemList.Add(lpItem);
            ((ISupportInitialize)(lpItem)).EndInit();
        }
Esempio n. 50
0
 public void GenerateItems()
 {
     Candidates = new ItemList();
     for (int i = 0; i < ItemCount; i++)
     {
         Candidates.Add(new Item()
         {
             Id    = i.ToString(),
             Value = Randomizer.IntInRange(this.ItemValues),
             Size  = Randomizer.IntInRange(this.ItemSizes),
         });
     }
 }
Esempio n. 51
0
 public void AddNewItems(int item1, int item2)
 {
     try
     {
         ItemList.Add(item1);
         ItemList.Add(item2);
     }
     catch (Exception ex)
     {
         Console.WriteLine("An error Occured:", ex.Message);
     }
     Thread.Sleep(new TimeSpan(0, 0, m_Thread2SleepTime));
 }
Esempio n. 52
0
        public ItemList FilterItem(int id)
        {
            var list = new ItemList();

            foreach (var item in allItem)
            {
                if (item.TableId == id)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
Esempio n. 53
0
 //アイテムを持たせたり減らしたりする。持ち物制限とかはここら辺でやる。(10種類以上は持たせないみたいな)
 //オペレーターのオーバーライドですっきりにしたいけど、読んでないからとりあえずこれ。一応消せなかったらfalseが戻り値だけど、使ってない。
 public void AddItem(Item i)
 {
     if (ItemList.ContainsKey(i.Name))
     {
         //キャラのアイテムリストにアイテムがあれば個数分増やす
         ItemList[i.Name].Count += i.Count;
     }
     else
     {
         //キャラのアイテムリストにアイテムがなければ、アイテムを増やす。
         ItemList.Add(i.Name, i);
     }
 }
Esempio n. 54
0
 /// <summary>
 /// Add Order
 /// </summary>
 /// <param name="order"></param>
 /// <param name="index">Optional, insert index</param>
 public static void AddItem(Item item, int index = -1)
 {
     if (index < 0)
     {
         MasterItemList.Add(item);
         ItemList.Add(item);
     }
     else
     {
         MasterItemList.Add(item); //doesnt care about the index
         ItemList.Insert(index, item);
     }
 }
        public override ItemList ProcessShow(ShowItem si,bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();

                FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "series.xml");

                bool needUpdate = !tvshowxml.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime));

                if (forceRefresh || needUpdate)
                    TheActionList.Add(new ActionMede8erXML(tvshowxml, si));

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "view.xml");
                if (!viewxml.Exists) TheActionList.Add(new ActionMede8erViewXML(viewxml,si));


                return TheActionList;
            }

            return base.ProcessShow(si, forceRefresh);
        }
		private void SetLinkedItems(XPathNavigator navigator, ReadingJournal journal, ContentItem item, string name)
		{
			var items = new ItemList();
			foreach (XPathNavigator itemElement in EnumerateChildren(navigator))
			{
				SetLinkedItem(itemElement.Value, journal, (foundItem) =>
					{
						items.Add(foundItem);
						var property = item.GetContentType().GetProperty(name);
						if (property != null)
							item[name] = items.ConvertTo(property.PropertyType, name);
						else
							item[name] = items;
					}, itemElement.GetAttribute("versionKey", ""));
			}
		}
    public void ApplyTest() {
      IRandom random = new TestRandom(new int[] { 3 }, null);
      JSMEncoding p1 = TestUtils.CreateTestJSM1();
      JSMEncoding p2 = TestUtils.CreateTestJSM2();
      JSMEncoding expected = new JSMEncoding();
      ItemList<Permutation> jsm = new ItemList<Permutation>();
      for (int i = 0; i < 6; i++) {
        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 2, 1, 0, 3, 4, 5 }));
      }
      expected.JobSequenceMatrix = jsm;

      JSMEncoding actual;
      actual = JSMSXXCrossover.Apply(random, p1, p2);

      Assert.IsTrue(TestUtils.JSMEncodingEquals(expected, actual));
    }
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(folder, "view.xml");
                if (!viewxml.Exists) TheActionList.Add(new ActionMede8erViewXML(viewxml,si,snum));


                return TheActionList;
            }

            return base.ProcessSeason(si, folder, snum, forceRefresh);
        }
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();
                string fn = filo.Name;
                fn = fn.Substring(0, fn.Length - filo.Extension.Length);
                fn += ".xml";
                FileInfo nfo = FileHelper.FileInFolder(filo.Directory, fn);

                if (forceRefresh || !nfo.Exists || (dbep.Srv_LastUpdated > TimeZone.Epoch(nfo.LastWriteTime)))
                    TheActionList.Add(new ActionMede8erXML(nfo, dbep));

                return TheActionList;

            }
            return base.ProcessEpisode(dbep, filo, forceRefresh);
        }
Esempio n. 60
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.SeriesJpg)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName);
                if (forceRefresh ||(!doneJPG.Contains(fi.FullName) && !fi.Exists))
                {
                    string bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages));
                    doneJPG.Add(fi.FullName);
                }
                return TheActionList;
            }


            return base.ProcessSeason(si, folder, snum, forceRefresh);
        }