Example #1
0
        private void Refresh()
        {
            bool fileExists = File.Exists(_filePath);

            if (!fileExists)
            {
                return;
            }

            _header.FilePath = _filePath;

            SvgStats stats = SvgStatsParser.TryParse(_filePath);

            if (stats != null)
            {
                _statsPanel.CompositionWidget.Update(stats);
                _statsPanel.ColourWidget.Update(stats);
            }

            // TODO: Handle as Uri, not as string.
            Uri fileUrl = new Uri("file://" + FilePath);

            _statsPanel.EditingWidget.Update(fileUrl);

            _log.LoadInfluences(fileUrl);
            _chart.LoadInfluences(fileUrl);

            if (_log.DataStore.Any())
            {
                ActivityLogItem item = _log.DataStore.First() as ActivityLogItem;

                _chart.SetTitle(item.Date);

                if (Model.ContainsResource(item.Activity))
                {
                    data.Activity activity = Model.GetResource <data.Activity>(item.Activity);

                    _chart.Zoom(activity.StartTime, activity.EndTime);
                }
            }

            _tabs.SelectedIndex = 1;
        }
Example #2
0
        private void OnActivityLogSelectedItemsChanged(object sender, EventArgs e)
        {
            ActivityLogItem selectedItem = _log.SelectedItem as ActivityLogItem;

            if (selectedItem == null || string.IsNullOrEmpty(selectedItem.InfluencedRegion))
            {
                return;
            }

            UriRef regionUri = new UriRef(selectedItem.InfluencedRegion);

            data.Rectangle region = Model.GetResource <data.Rectangle>(regionUri);

            _header.Thumbnail.HighlightColour   = Color.Parse(selectedItem.AgentColour);
            _header.Thumbnail.HighlightedRegion = region;

            data.Activity activity = Model.GetResource <data.Activity>(selectedItem.Activity);

            _chart.Zoom(activity.StartTime, activity.EndTime);

            _chart.SetTitle(selectedItem.Date);
            _chart.SetPositionMarker(selectedItem.Date);
        }