Beispiel #1
0
        private async void spacesCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            var thisSpace = (DTO.Space)spacesCombo.SelectedItem;

            nAssembla.Configuration.SpaceName = thisSpace.Name;

            var serialized = Settings.Default.SerializedCache;
            var dataCache  = new nAssembla.Cache.DataCache();

            if (!string.IsNullOrEmpty(serialized))
            {
                dataCache = Newtonsoft.Json.JsonConvert.DeserializeObject <nAssembla.Cache.DataCache>(serialized);
            }

            var spacecache = default(nAssembla.Cache.SpaceDataCache);

            if (!dataCache.Spaces.TryGetValue(thisSpace.Id, out spacecache))
            {
                statusLabel.Text = "Populating data cache...";
                spacecache       = await NAssembla.GetSpaceDataCache(thisSpace.Id);

                dataCache.Spaces.Add(thisSpace.Id, spacecache);
                serialized = await Newtonsoft.Json.JsonConvert.SerializeObjectAsync(dataCache);

                Settings.Default.SerializedCache = serialized;
                Settings.Default.Save();
            }
            else
            {
                NAssembla.SetSpaceDataCache(spacecache);
            }

            statusLabel.Text = "Getting activity for space...";

            streamPanel.Controls.Clear();
            var stream = await NAssembla.ActivityProxy.Space(thisSpace.Id).DateFrom(DateTime.Today.AddDays(-2)).GetListAsync();

            stream.ToList().ForEach(s =>
            {
                var ctl        = new TestHarness.Controls.StreamEvent();
                ctl.DataSource = s;
                streamPanel.Controls.Add(ctl);
            });

            reportsCombo.SelectedItem = null;
            reportsCombo.Items.Clear();
            reportsCombo.Enabled = false;

            var customReports = await NAssembla.CustomReportProxy.GetListAsync();

            reportsCombo.Items.AddRange(nAssembla.DTO.StandardReports.AllStandardReports.ToArray());
            if (customReports != null)
            {
                reportsCombo.Items.AddRange(customReports.ToArray());
            }

            reportsCombo.Enabled = true;
            statusLabel.Text     = "Ready";
        }
Beispiel #2
0
        private async void spacesCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            var thisSpace = (DTO.Space)spacesCombo.SelectedItem;

            nAssembla.Configuration.SpaceName = thisSpace.Name;

            var serialized = Settings.Default.SerializedCache;
            var dataCache = new nAssembla.Cache.DataCache();
            
	  if (!string.IsNullOrEmpty(serialized))
                dataCache = Newtonsoft.Json.JsonConvert.DeserializeObject<nAssembla.Cache.DataCache>(serialized);

            var spacecache = default(nAssembla.Cache.SpaceDataCache);

            if (!dataCache.Spaces.TryGetValue(thisSpace.Id, out spacecache))
            {
                statusLabel.Text = "LLenando cache data...";
                spacecache = await NAssembla.GetSpaceDataCache(thisSpace.Id);
                dataCache.Spaces.Add(thisSpace.Id, spacecache);
                serialized = await Newtonsoft.Json.JsonConvert.SerializeObjectAsync(dataCache);
                Settings.Default.SerializedCache = serialized;
                Settings.Default.Save();
            }
            else
            {
                NAssembla.SetSpaceDataCache(spacecache);
            }

            statusLabel.Text = "Getting activity for space...";

            streamPanel.Controls.Clear();
            var stream = await NAssembla.ActivityProxy.Space(thisSpace.Id).DateFrom(DateTime.Today.AddDays(-2)).GetListAsync();
            stream.ToList().ForEach(s =>
            {
                var ctl = new TestHarness.Controls.StreamEvent();
                ctl.DataSource = s;
                streamPanel.Controls.Add(ctl);
            });

            reportsCombo.SelectedItem = null;
            reportsCombo.Items.Clear();
            reportsCombo.Enabled = false;

            var customReports = await NAssembla.CustomReportProxy.GetListAsync();

            reportsCombo.Items.AddRange(nAssembla.DTO.StandardReports.AllStandardReports.ToArray());
            if (customReports != null)
                reportsCombo.Items.AddRange(customReports.ToArray());
             
            reportsCombo.Enabled = true;
            statusLabel.Text = "Ready";
        }