예제 #1
0
 async void GetStories()
 {
     try
     {
         await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
         {
             //var stories = await InstaApi.StoryProcessor.GetUsersStoriesAsHighlightsAsync(User.Pk.ToString());
             //if (stories.Succeeded)
             //{
             //    Stories.Clear();
             //    if (stories.Value.Items?.Count > 0)
             //        Stories.AddRange(stories.Value.Items);
             //}
             var st = await InstaApi.StoryProcessor.GetUserStoryAndLivesAsync(User.Pk);
             if (st.Succeeded)
             {
                 Stories.Clear();
                 if (st.Value.Reel != null)
                 {
                     Stories.Add(st.Value.Reel);
                 }
                 SetBroadcast(st.Value.Broadcast);
             }
             else
             {
                 SetBroadcast(null);
             }
         });
     }
     catch { }
 }
예제 #2
0
        //----< constructor generates "getting started" list of courses >----

        private StoryList()
        {
            var sty = new Story
            {
                Id          = 1,
                Title       = "A Tour of the Underwater World",
                Category    = "Science Fiction",
                Author      = "Jane123",
                AuthorId    = 1,
                Description = "Story 1"
            };

            Stories.Add(sty);
            sty = new Story
            {
                Id          = 2,
                Title       = "Sleeping Beauty",
                Category    = "Fairytale",
                Author      = "John30",
                AuthorId    = 2,
                Description = "Story 2"
            };
            Stories.Add(sty);
            sty = new Story
            {
                Id          = 3,
                Title       = "Tomb Raider",
                Category    = "Action & Adventure Fiction",
                Author      = "Lara_Croft",
                AuthorId    = 3,
                Description = "Story 3"
            };
            Stories.Add(sty);
        }
예제 #3
0
        private void ExecuteAddStoryCommand()
        {
            if (!AddStoryCommand.CanExecute(null))
            {
                return;
            }

            if (Stories == null)
            {
                Stories = new ObservableCollection <Story>();
            }

            Stories.Add(new Story
            {
                Title    = Title,
                ImageUrl = ImageUrl,
                EntryUrl = EntryUrl,
                BodyHtml = BodyHtml
            });

            Title    = "";
            ImageUrl = "";
            EntryUrl = "";
            BodyHtml = "";
        }
예제 #4
0
        async Task ExecuteLoadStoriesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Stories.Clear();
                var stories = await FirebaseService.GetItemsAsync(true);

                foreach (var story in stories)
                {
                    Stories.Add(story);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void Remove_Should_Use_Database()
        {
            Stories.Add(CreateStory() as Story);

            database.Setup(d => d.Delete(It.IsAny <Story>())).Verifiable();

            _storyRepository.Remove(Stories[0]);
        }
        public void FindByUrl_Should_Return_Correct_Story()
        {
            Stories.Add(CreateStory() as Story);

            var url   = Stories[0].Url;
            var story = _storyRepository.FindByUrl(url);

            Assert.Equal(url, story.Url);
        }
        public void FindByUniqueName_Should_Return_Correct_Story()
        {
            Stories.Add(CreateStory() as Story);

            var uniqueName = Stories[0].UniqueName;
            var story      = _storyRepository.FindByUniqueName(uniqueName);

            Assert.Equal(uniqueName, story.UniqueName);
        }
        public void FindById_Should_Return_Correct_Story()
        {
            Stories.Add(CreateStory() as Story);

            var id    = Stories[0].Id;
            var story = _storyRepository.FindById(id);

            Assert.Equal(id, story.Id);
        }
예제 #9
0
        /// <summary>
        /// Anvender det valgte projekt i singletonnen til at hente alle stories der ligger tilknyttet til projektet ud og sætte det ind i OC der er binded op til viewet.
        /// </summary>
        public async void LoadStories()
        {
            List <Story> st = await StoryPer.LoadBacklog(LeSingleton.SelectedProject.Project_Id);

            if (st != null)
            {
                foreach (Story storey in st)
                {
                    Stories.Add(storey);
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 记录故事
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string RecordStory(string msg)
        {
            while (Stories.Count > 10)
            {
                Stories.RemoveAt(0);
            }
            var story = @$ "{SystemTime.Now.ToString()}
{msg}";

            Stories.Add(story);
            return(story);
        }
예제 #11
0
        /// <summary>
        /// Adds a new highest Story.
        /// </summary>
        /// <returns>
        /// True if the Story is added.
        /// </returns>
        public bool AddStory(Story story)
        {
            var elevation = Elevation;

            if (Stories.Count > 0)
            {
                elevation = Height;
            }
            story.Elevation = elevation;
            Stories.Add(story);
            return(true);
        }
 public void addStories(dynamic itemStories)
 {
     if (itemStories.Count > 0)
     {
         foreach (var campo in itemStories)
         {
             Stories.Add(Convert.ToString(campo["name"]));
         }
     }
     else
     {
         Stories.Add(Convert.ToString("Sem registro"));
     }
 }
예제 #13
0
        /// <summary>
        /// Generere et nyt Objec af typen story for at kunne sende det med til WEB API'en for at kunne generere et nyt object der bliver sendt tilbage fra api'en hvis det lykkes.
        /// </summary>
        public async void CreateStory()
        {
            Story s = new Story()
            {
                Project_Id = LeSingleton.SelectedProject.Project_Id, Category = Story_CategoryVM, Story_Asignee = AssigneeVM, Story_Name = Story_NameVM, Story_description = Story_descriptionVM, Story_Points = Story_PointsVM, Story_Priority = Story_PriorityVM, Story_State = "ToDo", Story_Referee = LeSingleton.LoggedUser
            };

            Story storyToAdd = await StoryPer.Create(s);

            if (storyToAdd != null)
            {
                Stories.Add(storyToAdd);
            }
            StoryReset();
        }
예제 #14
0
 public RundownOverviewViewModel(Rundown model)
 {
     this.Id        = model.Id;
     this.Title     = model.Title;
     this.StartTime = model.StartTime;
     this.ShowId    = model.ShowId;
     this.ShowTitle = model.Show?.Title;
     this.ShowColor = model.Show?.Color;
     this.EndTime   = model.EndTime;
     if (model.Stories is null)
     {
         model.Stories = new List <Story>();
     }
     model.Stories.ForEach(x => Stories.Add(new StoryViewModel(x)));
     this.Active = model.Active;
 }
예제 #15
0
 public RundownViewModel(Rundown model)
 {
     Id        = model.Id;
     Title     = model.Title;
     StartTime = model.StartTime;
     EndTime   = model.EndTime;
     ShowId    = model.ShowId;
     Show      = model.Show;
     EndTime   = model.EndTime;
     if (model.Stories is null)
     {
         model.Stories = new List <Story>();
     }
     model.Stories.ForEach(x => Stories.Add(new StoryViewModel(x)));
     Active = model.Active;
 }
        public void FindById_Should_Return_Correct_Subscribtion()
        {
            Stories.Add(new Story {
                Id = Guid.NewGuid()
            });
            Users.Add(new User {
                Id = Guid.NewGuid()
            });

            Stories[0].SubscribeComment(Users[0]);

            var storyId = Stories[0].Id;
            var userId  = Users[0].Id;

            Assert.NotNull(_commentSubscribtionRepository.FindById(storyId, userId));
        }
예제 #17
0
        public StoryViewModel(List <Story> stories)
            : this()
        {
            foreach (Story story in stories)
            {
                if (string.IsNullOrEmpty(story.ImgLink) == false)
                {
                    string imageFullPath = Path.Combine(Constants.ImagesDirectory, story.ImgLink);

                    StoriesViewModel item = new StoriesViewModel(story);

                    item.ImgLink = imageFullPath.Replace(' ', '_');
                    Stories.Add(item);
                }
            }
        }
예제 #18
0
 public ActionResult Add(Stories post)
 {
     if (!ModelState.IsValid)
     {
         return(View(post));
     }
     storyPage.Title = post.Title;
     storyPage.Story = post.Story;
     storyPage.Email = post.Email;
     storyPage.Add();
     if (IsError())
     {
         return(errorActionRes);
     }
     return(Redirect("/Story/Number/" + storyPage.Id));
 }
예제 #19
0
        private async void ExecuteShowBrowseWindowCommand()
        {
            var b = new BrowseView();

            b.ShowDialog();

            var vm = (BrowseViewModel)b.DataContext;

            if (vm.C9Entries == null)
            {
                return;
            }

            IsBusy = true;

            await Task.Factory.StartNew(() =>
            {
                if (Stories == null)
                {
                    Stories = new ObservableCollection <Story>();
                }

                foreach (var item in vm.C9Entries)
                {
                    if (item.Selected)
                    {
                        var entryBody = GetEntryBody(item.EntryUrl);

                        DispatcherHelper.CheckBeginInvokeOnUI(
                            () =>
                        {
                            Stories.Add(new Story
                            {
                                Title    = item.Title,
                                ImageUrl = item.ImageUrl,
                                EntryUrl = item.EntryUrl,
                                BodyHtml = entryBody
                            });
                        });
                    }
                }
            });


            IsBusy = false;
        }
예제 #20
0
        private void GetData()
        {
            Status = "Starting sync get data at " + DateTime.Now.ToLongTimeString();
            Stories.Clear();

            var    webClient = new System.Net.WebClient();
            string content   = webClient.DownloadString("https://sport.orf.at");

            Thread.Sleep(30_000);
            var findStoriesRegex = new Regex("ticker-story-headline.*?a href.*?>(.*?)<\\/a>",
                                             RegexOptions.IgnoreCase | RegexOptions.Singleline);
            var matches = findStoriesRegex.Matches(content);

            foreach (Match match in matches)
            {
                Stories.Add(match.Groups[1].ToString().Trim());
            }
        }
예제 #21
0
        public void FindIPAddresses_Should_Return_The_IPAddresses_That_The_User_Used_To_Submit_Comment_Promote_And_MarkAsSpams()
        {
            var id = Guid.NewGuid();

            Stories.Add(new Story {
                Id = Guid.NewGuid(), UserId = id, IPAddress = "192.168.0.1"
            });
            Comments.Add(new StoryComment {
                Id = Guid.NewGuid(), UserId = id, IPAddress = "192.168.0.2", StoryId = Stories[0].Id
            });
            Votes.Add(new StoryVote {
                UserId = id, IPAddress = "192.168.0.1", StoryId = Stories[0].Id
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                UserId = id, IPAddress = "192.168.0.3"
            });

            var ipAddresses = _userRepository.FindIPAddresses(id);

            Assert.Equal(3, ipAddresses.Count);
        }
예제 #22
0
        public void CreateStory()
        {
            Story story = new Story(Model.Connection);

            story.UniverseId = Model.id;

            StoryPropertiesDialog dialog = new StoryPropertiesDialog(DialogOwner, story, Categories);
            bool?result = dialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                if (story.CategoryId == null)
                {
                    if (SubItems.Count > 0)
                    {
                        story.SortIndex = SubItems.Max(i => i.SortIndex) + 1;
                    }
                    else
                    {
                        story.SortIndex = 0;
                    }
                }
                else
                {
                    if (Stories.Count(i => i.Model.CategoryId == story.CategoryId) > 0)
                    {
                        story.SortIndex = Stories.Where(i => i.Model.CategoryId == story.CategoryId).Max(i => i.SortIndex + 1);
                    }
                    else
                    {
                        story.SortIndex = 0;
                    }
                }
                story.Create();
                StoryViewModel storyVm = new StoryViewModel(story);
                storyVm.UniverseVm = this;
                Stories.Add(storyVm);
                UpdateStoryInTree(storyVm);
            }
        }
예제 #23
0
        public async void Load()
        {
            List <Sprint> spr = await SprintsPer.LoadBacklog(LeSingleton.SelectedProject.Project_Id);

            if (spr != null)
            {
                foreach (Sprint sprint in spr)
                {
                    Sprints.Add(sprint);
                }
            }

            List <Story> st = await StoryPer.LoadBacklog(LeSingleton.SelectedProject.Project_Id);

            if (st != null)
            {
                foreach (Story storey in st)
                {
                    Stories.Add(storey);
                }
            }
        }
예제 #24
0
        private async Task GetDataAsync()
        {
            Status = "Starting async get data at " + DateTime.Now.ToLongTimeString();
            await Task.Run(async() =>
            {
                Application.Current.Dispatcher.Invoke(() => { Stories.Clear(); });

                var webClient             = new System.Net.WebClient();
                Task <string> contentTask = webClient.DownloadStringTaskAsync("https://sport.orf.at");
                await Task.Delay(30_000);
                var findStoriesRegex = new Regex("ticker-story-headline.*?a href.*?>(.*?)<\\/a>",
                                                 RegexOptions.IgnoreCase | RegexOptions.Singleline);
                var matches = findStoriesRegex.Matches(await contentTask);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    foreach (Match match in matches)
                    {
                        Stories.Add(match.Groups[1].ToString().Trim());
                    }
                });
            });
        }
예제 #25
0
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                var stories = await StoryService.ListByProfileAsync(User.Id);

                Stories.Clear();
                foreach (var story in stories.OrderByDescending(s => s.Id))
                {
                    Stories.Add(story);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void FindIPAddresses_Should_Return_The_IPAddresses_That_The_User_Used_To_Submit_Comment_Promote_And_MarkAsSpams()
        {
            //var id = Guid.NewGuid();

            var user = (User)_factory.CreateUser("dummyuser", "*****@*****.**", String.Empty);

            Stories.Add(new Story {
                Id = Guid.NewGuid(), User = user, IpAddress = "192.168.0.1"
            });
            Comments.Add(new StoryComment {
                Id = Guid.NewGuid(), User = user, IpAddress = "192.168.0.2", Story = Stories[0]
            });
            Votes.Add(new StoryVote {
                UserId = user.Id, IpAddress = "192.168.0.1", StoryId = Stories[0].Id
            });
            MarkAsSpams.Add(new StoryMarkAsSpam {
                UserId = user.Id, IpAddress = "192.168.0.3"
            });

            var ipAddresses = _userRepository.FindIPAddresses(user.Id);

            Assert.Equal(3, ipAddresses.Count);
        }
예제 #27
0
        private async Task Refresh(CancellationToken ct)
        {
            Stories.Clear();
            await foreach (var story in _remoteRepository.TopStoriesAsync())
            {
                if (ct.IsCancellationRequested)
                {
                    return;
                }

                var storyViewModel = await story.ToViewModelAsync();

                if (ct.IsCancellationRequested)
                {
                    return;
                }

                Stories.Add(storyViewModel);
                IsRefreshing = false;
            }

            _cts = null;
        }
        public void Add_Should_Throw_Exception_When_Specified_Name_Already_Exists()
        {
            Stories.Add(CreateStory() as Story);

            Assert.Throws <ArgumentException>(() => _storyRepository.Add(CreateStory()));
        }
예제 #29
0
 public void add(Story sty)
 {
     Stories.Add(sty);
 }
예제 #30
0
파일: InMemoryDb.cs 프로젝트: Vlashki98/UoW
        public static void Init()
        {
            Specialties.Add(new Speciality
            {
                FacultyId = 123,
                Id        = 2,
                LectorId  = 321,
                Name      = "Telecommunications",
                ShortName = "TIS"
            });
            Users.Add(new User
            {
                Id         = 1,
                FacultylID = 123,
                Name       = "Boris",
                Email      = "*****@*****.**",
                TeamID     = 12
            });

            Users.Add(new User
            {
                Id         = 2,
                FacultylID = 456,
                Name       = "Stefan",
                Email      = "*****@*****.**",
                TeamID     = 12
            });

            //Initi Story
            Stories.Add(new Story
            {
                Id          = 55,
                Name        = "Controlers Story",
                Description = "Create all required controlers",
                EndDate     = new DateTime(2020, 12, 23),
                ProjectId   = 2,
                StartDate   = DateTime.Now
            });

            //Inti faculties

            Faculties.Add(new Faculty()
            {
                Id          = 1,
                Name        = "Physico-technological faculty",
                Description = "We are the best",
                ShortName   = "PTF"
            });

            //Init Teams
            Teams.Add(new Team
            {
                Id          = 43,
                Name        = "Team A",
                FacultyID   = 1,
                DateCreated = new DateTime(2019, 10, 01)
            });

            Teams.Add(new Team
            {
                Id          = 44,
                Name        = "Team B",
                FacultyID   = 1,
                DateCreated = new DateTime(2019, 10, 01)
            });

            //Init User Taks
            UserTasks.Add(new UserTask
            {
                Id = 23,
                AssignedToUserID = 2,
                Description      = "Task Description",
                EndDate          = new DateTime(2020, 11, 23),
                Name             = "Create Controlers",
                OwnerId          = 1,
                StartDate        = DateTime.Now,
                StoryId          = 55
            });

            Sprints.Add(new Sprint
            {
                Description = "Description",
                EndDate     = DateTime.Now.AddDays(5),
                Id          = 133,
                Name        = "Sprint name",
                StartDate   = DateTime.Now,
                TeamID      = 1
            });
            Lectors.Add(new Lector
            {
                Id          = 24,
                FirstName   = "Vladimir",
                LastName    = "Sovniov",
                DateStarted = new DateTime(2018, 10, 12)
            });

            Projects.Add(new Project
            {
                Description = "Project description",
                Id          = 4322,
                Name        = "Some project name",
                OwnerId     = 2
            });

            //User positions
            UserPositions.Add(new UserPosition
            {
                Id           = 1,
                PositionName = "Junior Developer",
                Description  = "Begginer C# developer"
            });
            UserPositions.Add(new UserPosition
            {
                Id           = 2,
                PositionName = "Middle Developer",
                Description  = "Experienced C# developer"
            });
            UserPositions.Add(new UserPosition
            {
                Id           = 3,
                PositionName = "Senior Developer",
                Description  = "Very experienced C# developer"
            });
        }