コード例 #1
0
 private void btnSaveCategory_Click(object sender, EventArgs e)
 {
     if (ListHandler.UpdateCategory(lbCategory.SelectedItem.ToString(), tbCategory.Text.ToString()))
     {
         FillCatogoryListBox();
     }
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="center"></param>
        /// <param name="scale"></param>
        /// <param name="height"></param>
        /// <param name="previousScale"></param>
        public LandContour(Point center, Point scale, double height, List <double> previousScale = null)
        {
            //
            this.VectorScaleList = new List <double>();

            //Center Point of the Contour
            this.Center = center;

            //if there is no Previous Scale Values create a new one
            if (previousScale == null)
            {
                previousScale = new List <double> {
                    0D
                };
            }

            //min and max values and offset used to calculate scaler values.
            double min    = 0;
            double max    = 0;
            double offset = 0;

            for (int i = Map.Detail; i > 0; i--)
            {
                offset = ListHandler <double> .getFromTrimedIndex(previousScale, Map.Detail - i);

                min = scale.X + offset;
                max = scale.Y + offset;
                int scaleValue = Map.MapSeed.Next((int)min, (int)max);
                this.VectorScaleList.Add(scaleValue);
            }
            Height = height;
        }
コード例 #3
0
        public static int Run(string[] args)
        {
            if (args.Length == 0 || args.Length == 1)
            {
                return(ErrorHandler.printHelpInfo());
            }
            else
            {
                switch (args[1])
                {
                case "new":
                    return(NewHandler.PrintHelpMenu());

                case "list":
                    return(ListHandler.PrintHelpMenu());

                case "update":
                    return(UpdateHandler.PrintHelpMenu());

                case "delete":
                    return(DeleteHandler.PrintHelpMenu());

                case "launch":
                    return(LaunchHandler.PrintHelpMenu());

                default:
                    return(ErrorHandler.printHelpInfo());
                }
            }
        }
コード例 #4
0
        private void lvEpisodes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvPodcasts.SelectedItems == null || lvPodcasts.SelectedItems.Count == 0)
            {
                return;
            }
            else
            {
                if (lvEpisodes.SelectedItems == null || lvEpisodes.SelectedItems.Count == 0)
                {
                    return;
                }
                else
                {
                    string selectedPodcast = lvPodcasts.SelectedItems[0].Text;
                    var    podcast         = ListHandler.FetchPodcast(selectedPodcast);
                    string selectedEpisode = lvEpisodes.SelectedItems[0].Text;
                    string episode         = ListHandler.FetchEpisode(selectedEpisode, podcast);
                    lbEpisodeTitle.Text = selectedEpisode;
                    string episodeNoHTML = Regex.Replace(episode, "<.*?>", String.Empty);
                    tbEpsiodeDescription.Text = episodeNoHTML;

                    return;
                }
            }
        }
コード例 #5
0
 private void RefreshAll(ListHandler listHandler, IEnumerable <Owner> ownersList = null)
 {
     lvOwners.ItemsSource = listHandler(ownersList);
     lvOwners.Items.Refresh();
     tbName.Text      = "";
     imgButton.Source = null;
 }
コード例 #6
0
ファイル: ListHandlerTests.cs プロジェクト: Rezabth/C_Sharp2
        public void AddFiveStrings()
        {
            ListHandler sut = new ListHandler();

            sut.AddFiveStrings();
            Assert.AreEqual(5, sut.List.Count);
        }
コード例 #7
0
    public void Start()
    {
        listHandler  = FindObjectOfType <ListHandler>();
        exerciseList = listHandler.getExerciseList();
        programList  = listHandler.getProgramList();

        PopulateDropdowns();
    }
コード例 #8
0
 private void btnRemoveCategory_Click(object sender, EventArgs e)
 {
     if (ListHandler.RemoveCategory(tbCategory.Text.ToString()))
     {
         FillCatogoryListBox();
         tbCategory.Text = "";
     }
 }
コード例 #9
0
ファイル: ListHandlerTests.cs プロジェクト: Rezabth/C_Sharp2
        public void ArgumentOutOfRange()
        {
            ListHandler sut = new ListHandler();

            sut.AddFiveStrings();
            sut.RemoveThirdString();
            Console.WriteLine(sut.List[4]);
        }
コード例 #10
0
        private async void timer1_Tick(object sender, EventArgs e)
        {
            var all      = ListHandler.ListPodcast();
            var toUpdate = all.Where(a => updateCounter % a.UpdateInterval == 0).ToList();

            updateCounter++;
            await new FetchFeed().FetchFeeds(toUpdate);
            ListHandler.SaveData();
        }
コード例 #11
0
        private async void Form1_Load(object sender, EventArgs e)
        {
            ListHandler.LoadData();
            FillPodcastListBox();
            FillCatogoryListBox();
            FillCategoryCheckbox();
            FillIntervalCheckbox();

            await new FetchFeed().FetchFeeds(ListHandler.ListPodcast());
        }
コード例 #12
0
ファイル: SimpleTest.cs プロジェクト: SimBera/List
        public void ParsTest()
        {
            ListHandler lh      = new ListHandler();
            string      toParse = "main list1 l1";

            string [] parsed = lh.parse(toParse);
            bool      result = parsed[1].Equals("list1");

            Assert.True(result, $"{parsed[1]} == list1 ");
        }
コード例 #13
0
ファイル: ListHandlerTests.cs プロジェクト: Rezabth/C_Sharp2
        public void Sort()
        {
            ListHandler sut = new ListHandler();

            sut.List.Add("Cesar");
            sut.List.Add("Bertil");
            sut.List.Add("Adam");
            sut.Sort();
            Assert.AreEqual("Adam", sut.List[0]);
        }
コード例 #14
0
        public void Sort()
        {
            ListHandler sut = new ListHandler();

            sut.List.Add("Masum");
            sut.List.Add("Mattias");
            sut.List.Add("Jahurul");
            sut.Sort();
            Assert.AreEqual("Jahurul", sut.List[0]);
        }
コード例 #15
0
 private void btnRemovePodcast_Click(object sender, EventArgs e)
 {
     if (ListHandler.RemovePodcast(lvPodcasts.SelectedItems[0].Text))
     {
         FillPodcastListBox();
         tbPodcastTitle.Text = "";
         tbPodcastURL.Text   = "";
         PodcastButtons(false);
     }
 }
        public override void Populate(CSharpGeneratorContext context)
        {
            // use context.ProvidedElements.AddRange to add new
            // generator elements (e.g., GeneratorDeclaredElement<T>)
            IClassLikeDeclaration typeDeclaration = context.ClassDeclaration;
            ITypeElement          typeElement     = typeDeclaration.DeclaredElement;

            ListHandler.Initialize(context);
            MethodGeneratorBase.Initialize(context);
            GetBytesMethodGenerator.Initialize(context);
            SetBytesMethodGenerator.Initialize(context);

            if (typeElement is IClass || typeElement is IStruct)
            {
                var ctx = new TypeHandlingContext(context);

                foreach (ITypeMember member in typeElement.GetMembers())
                {
                    ITypeOwner owner = null;

                    var field = member as IField;
                    if (field != null)
                    {
                        if (field.GetAccessRights() != AccessRights.PRIVATE &&
                            !field.IsConstant &&
                            !field.IsReadonly &&
                            !field.IsStatic)
                        {
                            owner = field;
                        }
                    }

                    var property = member as IProperty;
                    if (property != null)
                    {
                        if (property.IsReadable &&
                            property.IsWritable &&
                            !property.IsStatic)
                        {
                            owner = property;
                        }
                    }

                    if (owner != null)
                    {
                        ctx.Resolve(owner);

                        if (TypeHandlers.All.Any(h => h.CanHandle(ctx)))
                        {
                            context.ProvidedElements.Add(new GeneratorDeclaredElement <ITypeOwner>(owner));
                        }
                    }
                }
            }
        }
コード例 #17
0
ファイル: ListHandlerTests.cs プロジェクト: Rezabth/C_Sharp2
        public void RemoveThirdString()
        {
            ListHandler sut = new ListHandler();

            sut.AddFiveStrings();
            string fourthString = sut.List[3];

            sut.RemoveThirdString();
            Assert.AreEqual(4, sut.List.Count);
            Assert.AreEqual(fourthString, sut.List[2]);
        }
コード例 #18
0
        public void AddFiveStrings()
        {
            //Arrange
            ListHandler sut = new ListHandler();

            //Act
            sut.AddFiveStrings();

            //Assert
            Assert.AreEqual(5, sut.List.Count);
        }
コード例 #19
0
        public void FillCatogoryListBox()
        {
            lbCategory.Items.Clear();
            var sortedList = ListHandler.SortCategoryList(ListHandler.ListCategory());

            foreach (var sc in sortedList)
            {
                lbCategory.Items.Add(sc.Title);
            }
            ;
            FillCategoryCheckbox();
        }
コード例 #20
0
        private Test CreateIndexOfItemsTest()
        {
            return(new TestCase("IndexOfItem", () =>
            {
                AssertDistinctIntancesNotEmpty();
                var handler = new ListHandler <TList, TItem>(GetSafeDefaultInstance(), Context);

                foreach (var item in DistinctInstances)
                {
                    handler.IndexOfItem(item, IsReadOnly);
                }
            }));
        }
コード例 #21
0
        private Test CreateIndexerGetItemsAtInvalidIndexTest()
        {
            return(new TestCase("GetItemsAtInvalidIndex", () =>
            {
                AssertDistinctIntancesNotEmpty();
                var handler = new ListHandler <TList, TItem>(GetSafeDefaultInstance(), Context);

                Assert.Multiple(() =>
                {
                    handler.DoActionAtInvalidIndex(x => - 1, (list, index) => { var o = list[index]; }, "Indexer Getter");         // Negative index.
                    handler.DoActionAtInvalidIndex(x => x.Count + 1, (list, index) => { var o = list[index]; }, "Indexer Getter"); // Index too high.
                });
            }));
        }
コード例 #22
0
        private Test CreateRemoveItemsAtTest()
        {
            return(new TestCase("RemoveItemsAt", () =>
            {
                AssertDistinctIntancesNotEmpty();
                var list = GetSafeDefaultInstance();
                var handler = new ListHandler <TList, TItem>(list, Context);

                foreach (var item in DistinctInstances)
                {
                    handler.RemoveItemAtOk(item);
                }
            }));
        }
コード例 #23
0
        public static IHaveFulfilledSubscriptionRequirements WithMessageHandlers <T>(
            this IFluentSubscription sub, params IHandlerAsync <T>[] handlers) where T : Message
        {
            if (handlers.Length == 0)
            {
                throw new ArgumentException("No handlers in list");
            }

            if (handlers.Length == 1)
            {
                sub.WithMessageHandler(handlers[0]);
            }

            var listHandler = new ListHandler <T>(handlers);

            return(sub.WithMessageHandler(listHandler));
        }
コード例 #24
0
        public void ShowPodcastByCategory(string updateCategoryTitle)
        {
            lvPodcasts.Items.Clear();
            var podcastList = ListHandler.SortByCategory(updateCategoryTitle);

            if (podcastList.Any())
            {
                foreach (var p in podcastList)
                {
                    ListViewItem podcast = new ListViewItem();
                    podcast.Text = p.Title;
                    podcast.SubItems.Add(p.Episodes.Count.ToString());
                    podcast.SubItems.Add(p.UpdateInterval.ToString());
                    podcast.SubItems.Add(p.Category);
                    lvPodcasts.Items.Add(podcast);
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Adds a new Contour to the Mesh
        /// </summary>
        public void addNewContour()
        {
            //sets the "current height" to 0 and set
            double currentHeight = 0;

            //grabs the "last contour" created on the mesh and grabs the "last contour's scale", if it doesn't exist set it to null;
            LandContour lastContour = ListHandler <LandContour> .getNullIfOutOfRange(LandVectorData, LandVectorData.Count - 1);

            List <double> lastContourScale = (lastContour != null) ? lastContour.VectorScaleList : null;

            // the "Min and Max scale" of the new contour (X:min, Y:max), used with the "last contour's scale" when creating  a new Contour
            Point scaleMaxMin = ListHandler <Point> .getFromTrimedIndex(MinMaxVectorLength, LandVectorData.Count);

            //if this is not the fist contour on the mesh subtract the difference in height from the previous Contour's height level to get the new height level, else (this is the first Contour) so set it to the Mesh's "Height Level"
            currentHeight = (LandVectorData.Count > 0) ? LandVectorData[LandVectorData.Count - 1].Height - ListHandler <double> .getFromTrimedIndex(HeightScaling, LandVectorData.Count) : HeightLevel;

            // add a new Contour to the end of the list
            LandVectorData.Add(new LandContour(CenterPoint, scaleMaxMin, currentHeight, lastContourScale));
        }
コード例 #26
0
 private void lvPodcasts_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lvPodcasts.SelectedItems == null || lvPodcasts.SelectedItems.Count == 0)
     {
         return;
     }
     else
     {
         string selectedPodcast = lvPodcasts.SelectedItems[0].Text;
         var    podcast         = ListHandler.FetchPodcast(selectedPodcast);
         tbPodcastTitle.Text    = podcast.Title;
         tbPodcastURL.Text      = podcast.URL;
         cbPodcastInterval.Text = podcast.UpdateInterval.ToString();
         cbPodcastCategory.Text = podcast.Category.ToString();
         FillVEpisodes(podcast);
         PodcastButtons(true);
         return;
     }
 }
コード例 #27
0
        private void btnSavePodcast_Click(object sender, EventArgs e)
        {
            var oldPodcast = ListHandler.FetchPodcast(lvPodcasts.SelectedItems[0].Text);
            var newPodcast = new Podcast(
                tbPodcastURL.Text,
                tbPodcastTitle.Text,
                int.Parse(cbPodcastInterval.SelectedItem.ToString()),
                cbPodcastCategory.SelectedItem.ToString());

            if (ListHandler.UpdatePodcast(oldPodcast, newPodcast))
            {
                tbPodcastTitle.Text             = "";
                tbPodcastURL.Text               = "";
                cbPodcastInterval.SelectedIndex = 0;
                cbPodcastCategory.SelectedIndex = 0;
                PodcastButtons(false);
                FillPodcastListBox();
            }
        }
コード例 #28
0
        private void btnNewPodcast_Click(object sender, EventArgs e)
        {
            string podcastURL      = tbPodcastURL.Text;
            string podcastTitle    = tbPodcastTitle.Text;
            var    podcastInterval = cbPodcastInterval.SelectedItem.ToString();
            var    podcastCategory = cbPodcastCategory.SelectedItem.ToString();

            if (ListHandler.AddPodcast(podcastURL, podcastTitle, podcastInterval, podcastCategory.ToString()))
            {
                FillPodcastListBox();
                Dialog.PodcastAdded();
                tbPodcastTitle.Text             = "";
                tbPodcastURL.Text               = "";
                cbPodcastInterval.SelectedIndex = 0;
                cbPodcastCategory.SelectedIndex = 0;
            }
            else
            {
                return;
            }
        }
コード例 #29
0
        private Test CreateInsertItemsAtInvalidIndexTest()
        {
            return(new TestCase("InsertItemsAtInvalidIndex", () =>
            {
                AssertDistinctIntancesNotEmpty();
                var list = GetSafeDefaultInstance();
                var handler = new ListHandler <TList, TItem>(list, Context);
                var initialContent = new List <TItem>(list);

                Assert.Multiple(() =>
                {
                    foreach (var item in DistinctInstances)
                    {
                        if (!initialContent.Contains(item))
                        {
                            handler.DoActionAtInvalidIndex(x => - 1, (l, i) => l.Insert(i, item), "Insert");         // Negative index.
                            handler.DoActionAtInvalidIndex(x => x.Count + 1, (l, i) => l.Insert(i, item), "Insert"); // Index too high.
                        }
                    }
                });
            }));
        }
コード例 #30
0
        public void FillCategoryCheckbox()
        {
            cbPodcastCategory.Items.Clear();
            var categoryList = ListHandler.ListCategory();

            if (categoryList.Any())
            {
                foreach (var c in categoryList)
                {
                    cbPodcastCategory.Items.Add(c.Title);
                }
            }
            if (categoryList.Any())
            {
                cbPodcastCategory.SelectedIndex = 0;
                cbPodcastCategory.Enabled       = true;
            }
            else
            {
                cbPodcastCategory.Enabled = false;
            }
        }
コード例 #31
0
 protected void OnGridSelectionChanged(object sender, EventArgs e)
 {
     GridViewSelectEventArgs eargs = e as GridViewSelectEventArgs;
     object item = new ListHandler<DataUtils.UserAccount>().getItem(eargs.NewSelectedIndex);
     formThing.setSource((DataObject)item);
 }