public async Task HandleOnAppearing()
        {
            RepositoryList.Clear();
            SearchStatusText = string.Format(AppResources.RepoPage_SearchInProgressString, UserName);
            IsLoaderRunning  = true;
            try
            {
                Repository[] repos = await _repoHostClient.GetRepositoriesByUserNameAsync(UserName);

                if (repos == null || repos.Length == 0)
                {
                    SearchStatusText = string.Format(AppResources.RepoPage_ResultNotFoundString, UserName);
                }
                else
                {
                    SearchStatusText = string.Empty;
                    foreach (var repo in repos)
                    {
                        RepositoryList.Add(_mapper.MapRepoDTOToRepoViewModel(repo));
                    }
                }
            }
            finally
            {
                IsLoaderRunning = false;
            }
        }
Exemplo n.º 2
0
 public BookPage(Flight flight, RepositoryList repositoryList)
 {
     InitializeComponent();
     this.flight    = flight;
     bookController = new BookController(repositoryList);
     initViews();
 }
Exemplo n.º 3
0
        private async void OnGetReposClick()
        {
            ToggleBusy(true);

            try
            {
                ReposBox.ItemsSource = null;
                ReposBox.IsEnabled   = false;

                //Ensure the client is ready to go
                GetBitBucketClient(GetPassword(), true);

                //Download the repository data
                RepositoryList repos = (await _BitbucketClient.GetAsync <RepositoryList>());

                //Put it in the List Box
                ReposBox.ItemsSource  = repos.values;
                ReposBox.SelectedItem = repos.values.FirstOrDefault();
                ReposBox.IsEnabled    = true;
            }
            catch (Exception ex)
            {
                await HandleException($"An error occurred while attempting to get repos.");
            }

            ToggleBusy(false);
        }
        public void SortEnumeratedRepositories(Dictionary <GitHubApi.GitHubRepository, DateTime> processedTable, List <GitHubApi.GitHubRepository> unprocessedList)
        {
            GitHubApi.GitHubRepository?OldestRepository;

            do
            {
                OldestRepository = null;

                if (unprocessedList.Count > 0)
                {
                    OldestRepository = unprocessedList.First();
                    unprocessedList.RemoveAt(0);
                }
                else
                {
                    foreach (KeyValuePair <GitHubApi.GitHubRepository, DateTime> Entry in processedTable)
                    {
                        if (OldestRepository == null || Entry.Value < processedTable[OldestRepository])
                        {
                            OldestRepository = Entry.Key;
                        }
                    }

                    if (OldestRepository != null)
                    {
                        processedTable.Remove(OldestRepository);
                    }
                }

                if (OldestRepository != null)
                {
                    RepositoryList.Add(new RepositoryInfo(RepositoryList, OldestRepository));
                }
            }while (OldestRepository != null);
        }
Exemplo n.º 5
0
        private async void OnGetReposClick()
        {
            ToggleBusy(true);

            try
            {
                ReposBox.ItemsSource = null;
                ReposBox.IsEnabled   = false;

                //Ensure the client is ready to go
                GetBitBucketClient(GetPassword(), true);

                //Download the repository data
                RepositoryList repos = (await _BitbucketClient.GetAsync <RepositoryList>());

                //Put it in the List Box
                ReposBox.ItemsSource = repos.values;
                ReposBox.IsEnabled   = true;
            }
            catch (Exception ex)
            {
                await HandleException <RepositoryList>(ex);
            }

            ToggleBusy(false);
        }
        private void RepositoryListDownload()
        {
            string trans;

            try
            {
                string data;
                using (WebClient wc = new WebClient())
                {
                    wc.CachePolicy           = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
                    wc.Headers["User-Agent"] = "Triggernometry Repository List Downloader";
                    byte[] rawdata = wc.DownloadData(@"https://raw.githubusercontent.com/paissaheavyindustries/Triggernometry/master/Repositories/manifest.xml?temp=" + DateTime.Now.Ticks);
                    data = Encoding.UTF8.GetString(rawdata);
                }
                RepositoryList rl = RepositoryList.Unserialize(data);
                if (rl == null)
                {
                    throw new InvalidOperationException(I18n.Translate("RepositoryListForm/masterlistproblem", "Data from master repository list could not be unserialized"));
                }
                ParseRepositoryList(rl);
                trans = I18n.Translate("RepositoryListForm/downloadcomplete", "Download complete");
                plug.FilteredAddToLog(Plugin.DebugLevelEnum.Info, trans);
                ShowProgress(100, trans);
                System.Threading.Thread.Sleep(2000);
                ShowProgress(0, "");
            }
            catch (Exception ex)
            {
                trans = I18n.Translate("RepositoryListForm/exception", "Download failed due to exception: {0}", ex.Message);
                plug.FilteredAddToLog(Plugin.DebugLevelEnum.Error, trans);
                ShowProgress(100, trans);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Construct the screens
        /// </summary>
        /// <param name="game">Game from which to get repos</param>
        /// <param name="reps">Collection of Repository objects</param>
        /// <param name="initName">Initial value of the Name field</param>
        /// <param name="initUrl">Iniital value of the URL field</param>
        protected RepoScreen(IGame game, SortedDictionary <string, Repository> reps, string initName, string initUrl) : base()
        {
            editList     = reps;
            defaultRepos = RepositoryList.DefaultRepositories(game);

            name = new ConsoleField(labelWidth, nameRow, -1, initName)
            {
                GhostText = () => "<Enter the name to use for this repository>"
            };
            url = new ConsoleField(labelWidth, urlRow, -1, initUrl)
            {
                GhostText = () => "<Enter the URL of this repository>"
            };

            AddObject(new ConsoleLabel(1, nameRow, labelWidth, () => "Name:"));
            AddObject(name);
            AddObject(new ConsoleLabel(1, urlRow, labelWidth, () => "URL:"));
            AddObject(url);

            AddTip("F2", "Accept");
            AddBinding(Keys.F2, (object sender, ConsoleTheme theme) => {
                if (Valid())
                {
                    Save();
                    return(false);
                }
                else
                {
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => {
                return(false);
            });

            // mainMenu = list of default options
            if (defaultRepos.repositories != null && defaultRepos.repositories.Length > 0)
            {
                List <ConsoleMenuOption> opts = new List <ConsoleMenuOption>();
                foreach (Repository r in defaultRepos.repositories)
                {
                    // This variable will be remembered correctly in our lambdas later
                    Repository repo = r;
                    opts.Add(new ConsoleMenuOption(
                                 repo.name, "", $"Import values from default mod list source {repo.name}",
                                 true, (ConsoleTheme theme) => {
                        name.Value    = repo.name;
                        name.Position = name.Value.Length;
                        url.Value     = repo.uri.ToString();
                        url.Position  = url.Value.Length;
                        return(true);
                    }
                                 ));
                }
                mainMenu = new ConsolePopupMenu(opts);
            }
        }
 public ShowFlightsPage(RepositoryList repositoryList, string toCity, string fromCity, DateTime date)
 {
     InitializeComponent();
     this.repositoryList = repositoryList;
     this.toCity         = toCity;
     this.fromCity       = fromCity;
     this.date           = date;
     initViews();
 }
        private void ParseRepositoryList(RepositoryList rl)
        {
            List <TreeNode> tns = new List <TreeNode>();

            foreach (RepositoryList.Category c in rl.Categories)
            {
                TreeNode tn = HandleRepoCategory(null, c);
                tns.Add(tn);
            }
            AddToTree(tns);
        }
Exemplo n.º 10
0
        public int SaveAll <ItemType, ListType>(RepositoryList <ItemType, ListType> itemList, string userName)
            where ItemType : RepositoryRecord <ItemType>, new()
            where ListType : RepositoryList <ItemType, ListType>, new()
        {
            int lCount = 0;

            foreach (ItemType item in itemList)
            {
                lCount += Save(item, userName);
            }
            return(lCount);
        }
Exemplo n.º 11
0
        public RepositoryListTests()
        {
            var command             = Substitute.For <ICommandLine>();
            var eventBus            = Substitute.For <ITinyMessengerHub>();
            var serializer          = Substitute.For <IRepositoryListSerializer>();
            var applicationSettings = Substitute.For <IApplicationSettings>();

            _target = new RepositoryList(serializer, applicationSettings);

            _repositories = new List <RepositoryBase>()
            {
                Substitute.For <RepositoryBase>(Path, "GIT", command, eventBus),
                Substitute.For <RepositoryBase>(Path, "Tfs", command, eventBus),
                Substitute.For <RepositoryBase>(Path, "GitTfs", command, eventBus)
            };
        }
Exemplo n.º 12
0
        public static void GetFiles(DirectoryInfo infoDirectory, Dictionary <String, RepositoryList> repository)
        {
            FileInfo[] files = infoDirectory.GetFiles();

            if (files.Length < 1)
            {
                return;
            }

            for (int i = 0; i < files.Length; i++)
            {
                if (repository.ContainsKey(infoDirectory.FullName) == false)
                {
                    RepositoryList _list = new RepositoryList();

                    repository.Add(infoDirectory.FullName, _list);
                }

                repository[infoDirectory.FullName].m_list_file.Add(files[i].Name);
            }
        }
        async void Handle_SearchButtonPressed(object sender, System.EventArgs e)
        {
            if (!string.IsNullOrEmpty(searchBar.Text))
            {
                loader.IsRunning           = true;
                detailLayoutView.IsVisible = false;
                errorMessage.IsVisible     = false;
                profile = await webservice.GetUserAsync(searchBar.Text);

                if (string.IsNullOrEmpty(profile.Message))
                {
                    userRepositoryList = await webservice.GetUserReposAsync(profile);

                    avtarUrl.Source            = profile.AvatarUrl;
                    lblUserName.Text           = (string.IsNullOrEmpty(profile.Name)) ? profile.LoginId : profile.Name;
                    listView.ItemsSource       = userRepositoryList.Items;
                    detailLayoutView.IsVisible = true;
                    if (userRepositoryList.Items.Count > 0)
                    {
                        listView.IsVisible         = true;
                        lblNoRepoMessage.IsVisible = false;
                    }
                    else
                    {
                        listView.IsVisible         = false;
                        lblNoRepoMessage.IsVisible = true;
                    }
                }
                else
                {
                    errorMessage.IsVisible     = true;
                    errorMessage.Text          = profile.Message;
                    detailLayoutView.IsVisible = false;
                }
                loader.IsRunning = false;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Gets the user repository.
        /// </summary>
        /// <returns>The user repos async.</returns>
        /// <param name="user">User.</param>
        public async Task <RepositoryList> GetUserReposAsync(User user)
        {
            repos          = new ObservableCollection <Repository>();
            repositoryList = new RepositoryList();
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    var response = await client.GetAsync($"users/" + user.LoginId + "/repos");

                    if (response.IsSuccessStatusCode)
                    {
                        string res = await response.Content.ReadAsStringAsync();

                        repos = await Task.Run(() => JsonConvert.DeserializeObject <ObservableCollection <Repository> >(res));

                        repositoryList.Items = repos;
                    }
                    else
                    {
                        repositoryList.Message = Constants.MessageRepositoryNotFound;
                    }
                }
                else
                {
                    repositoryList.Message = Constants.MessageNoNetwork;
                }

                return(repositoryList);
            }
            catch (Exception ex)
            {
                repositoryList.Message = Constants.MessageAPIRequestFail;
                return(repositoryList);
            }
        }
Exemplo n.º 15
0
 public void Stop()
 {
     RepositoryList.Clear();
     SolutionList.Clear();
     ProjectList.Clear();
 }
 public ShowFlightsPage(RepositoryList repositoryList)
 {
     InitializeComponent();
     this.repositoryList = repositoryList;
     initViews();
 }
 public UsuarioRepositoryTests()
 {
     _repository = new RepositoryList<Usuario>(UsuarioTestData.Get());
     _usuarioRepository = new UsuarioRepository(_repository);
 }
Exemplo n.º 18
0
 public static int SaveAll <ItemType, ListType>(RepositoryList <ItemType, ListType> itemList, string userName)
     where ItemType : RepositoryRecord <ItemType>, new()
     where ListType : RepositoryList <ItemType, ListType>, new()
 {
     return(Repository.SaveAll <ItemType, ListType>(itemList, userName));
 }
 public UserProfilePage()
 {
     InitializeComponent();
     profile            = new User();
     userRepositoryList = new RepositoryList();
 }
Exemplo n.º 20
0
 public NHUnitOfWork(ISession session)
 {
     _session      = session;
     _transaction  = session.BeginTransaction();
     _repositories = new RepositoryList();
 }
Exemplo n.º 21
0
 public UsuarioRepositoryTests()
 {
     _repository        = new RepositoryList <Usuario>(UsuarioTestData.Get());
     _usuarioRepository = new UsuarioRepository(_repository);
 }
Exemplo n.º 22
0
 public BookbyClient(RepositoryList repositoryList)
 {
     InitializeComponent();
     this.repositoryList = repositoryList;
     initViews();
 }
Exemplo n.º 23
0
 public int SaveAll <ItemType, ListType>(RepositoryList <ItemType, ListType> itemList)
     where ItemType : RepositoryRecord <ItemType>, new()
     where ListType : RepositoryList <ItemType, ListType>, new()
 {
     return(SaveAll(itemList, string.Empty));
 }
Exemplo n.º 24
0
 public EFUnitOfWork(IDbContext context)
 {
     _context      = (DbContext)context;
     _repositories = new RepositoryList();
 }
Exemplo n.º 25
0
        public MainPage()
        {
            InitializeComponent();

            data = new RepositoryList();
        }
Exemplo n.º 26
0
 public BookController(RepositoryList repositoryList)
 {
     this.repositoryList = repositoryList;
 }