Example #1
0
        private async void FormViewer_Shown(object sender, EventArgs e)
        {
            ToolStripMenuItem defaultDevice = null;

            foreach (var item in Program.GetDevices())
            {
                var _item = new ToolStripMenuItem(item.Value)
                {
                    Tag = item.Key
                };
                _item.Click += Item_Click;
                _item.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.videocam, 48, toolStripMenu.BackColor);
                toolStripButtonDevices.DropDownItems.Add(_item);

                if (Properties.Settings.Default.AutoStart && item.Key == Properties.Settings.Default.DefaultDevice)
                {
                    defaultDevice = _item;
                }
            }

            labelPreview.Visible = defaultDevice == null;

            if (defaultDevice != null)
            {
                defaultDevice.PerformClick();
            }

            if (Properties.Settings.Default.CheckForUpdates)
            {
                await GitHubInfo.CheckForUpdateAsync();
            }
        }
Example #2
0
        private async void OnSelectedAsync(object sender, SelectionChangedEventArgs e)
        {
            // Let user know DynaHub is retrieving stuff
            packagesList.Items.Clear();

            ListBoxItem asyncItem = new ListBoxItem();

            asyncItem.Content = "...retrieving repos";

            packagesList.Items.Add(asyncItem);

            // Show name of selected repo in combobox
            string selectionString = null;

            selectionString = selectReposCB.SelectedItem.ToString();

            selectReposCB.Text = selectionString;

            // Get repository object from user selection
            // It's supposed that the user has only one repo with that path (GH rule)
            GitHubInfo.selectedRepo = localReposList.Where(r => r.FullName == selectionString).First();

            // Initialize process to get repo's content
            Task <SortedDictionary <string, string> > repoContentTask =
                GitHubInfo.GetRepoContentAsync(GitHubInfo.selectedRepo, ".zip");

            //                  Packages are uploaded as zipped folders  ^

            // Get async result
            repoContent = await repoContentTask;

            // Populate ListBox
            GetPackages.PopulateListBox(repoContent, packagesList);
        }
Example #3
0
 private async void FormAbout_Load(object sender, EventArgs e)
 {
     if (GitHubInfo.LatestRelease == null)
     {
         await GitHubInfo.GetLatestReleaseAsync();
     }
     buttonUpdate.Visible = (GitHubInfo.LatestRelease != null && (GitHubInfo.LatestRelease.GetVersion() > ApplicationInfo.Version));
 }
        private void Parse(string json)
        {
            var data = MiniAVC.Json.Deserialize(json) as Dictionary <string, object>;

            if (data == null)
            {
                ParseError = true;
                return;
            }
            foreach (var key in data.Keys)
            {
                switch (key.ToUpper())
                {
                case "NAME":
                    Name = (string)data[key];
                    break;

                case "URL":
                    Url = FormatCompatibleUrl((string)data[key]);
                    break;

                case "DOWNLOAD":
                    Download = (string)data[key];
                    break;

                case "GITHUB":
                    GitHub = new GitHubInfo(data[key], this);
                    break;

                case "VERSION":
                    Version = GetVersion(data[key]);
                    break;

                case "KSP_VERSION":
                    kspVersion = GetVersion(data[key]);
                    break;

                case "KSP_VERSION_MIN":
                    kspVersionMin = GetVersion(data[key]);
                    break;

                case "KSP_VERSION_MAX":
                    kspVersionMax = GetVersion(data[key]);
                    break;

                case "KSP_VERSION_EXCLUDE":
                    kspExcludeVersions = new List <VersionInfo>();
                    List <System.Object> ExcludeList = (List <System.Object>)data[key];
                    foreach (System.Object el in ExcludeList)
                    {
                        var s = GetVersion(el);
                        kspExcludeVersions.Add(s);
                    }
                    break;
                }
            }
        }
Example #5
0
        private async void FormMain_Load(object sender, EventArgs e)
        {
            toolStripButtonUpdates.Checked = Properties.Settings.Default.CheckForUpdates;

            if (Properties.Settings.Default.CheckForUpdates)
            {
                await GitHubInfo.CheckForUpdateAsync();
            }
        }
Example #6
0
        private void Parse(string json)
        {
            var data = MiniAVC.Json.Deserialize(json) as Dictionary <string, object>;

            if (data == null)
            {
                ParseError = true;
                return;
            }
            foreach (var key in data.Keys)
            {
                switch (key.ToUpper())
                {
                case "NAME":
                    Name = (string)data[key];
                    break;

                case "URL":
                    Url = FormatCompatibleUrl((string)data[key]);
                    break;

                case "DOWNLOAD":
                    Download = (string)data[key];
                    break;

                case "GITHUB":
                    GitHub = new GitHubInfo(data[key], this);
                    break;

                case "VERSION":
                    Version = GetVersion(data[key]);
                    break;

                case "KSP_VERSION":
                    kspVersion = GetVersion(data[key]);
                    break;

                case "KSP_VERSION_MIN":
                    kspVersionMin = GetVersion(data[key]);
                    break;

                case "KSP_VERSION_MAX":
                    kspVersionMax = GetVersion(data[key]);
                    break;
                }
            }
        }
Example #7
0
        private async void PopulateComboAsync(object sender, EventArgs e)
        {
            if (selectReposCB.Items.Count == 0)
            {
                Task <IReadOnlyList <Repository> > getRepos = GitHubInfo.GetUserReposAsync();

                // Display in-the-meantime text
                selectReposCB.Text = "...retrieving repos";

                IReadOnlyList <Repository> repositories = await getRepos;

                // Populate combobox
                foreach (Repository r in repositories)
                {
                    selectReposCB.Items.Add(r.FullName);
                    // Populate local list (needed below)
                    localReposList.Add(r);
                }
            }
        }
Example #8
0
        private async void OnSelectedAsync(object sender, SelectionChangedEventArgs e)
        {
            string selectionString = null;

            selectionString = selectReposCB.SelectedItem.ToString();

            // Show text in combobox
            selectReposCB.Text = selectionString;

            // Get repository object from user selection
            // It's supposed that the user has only one repo with that path (GH rule)
            GitHubInfo.selectedRepo = localReposList.Where(r => r.FullName == selectionString).First();

            // Initialize process to get repo's content
            Task <SortedDictionary <string, string> > repoContentTask = GitHubInfo.GetRepoContentAsync(GitHubInfo.selectedRepo, ".dyn");

            // Get async result
            repoContent = await repoContentTask;

            BrowserEngine.PopulateTree(repoContent, filesTree);
        }
Example #9
0
 public async Task LoadAsync()
 {
     await Task.WhenAll(GeneralInfo.SetGeneralInfoAsync(), GitHubInfo.SetGitHubInfoAsync(), VisualStudioMarketplaceInfo.SetVisualStudioMarketplaceInfoAsync(), Changelog.SetChangelogAsync());
 }