Ejemplo n.º 1
0
        void SpawnTransport(ExportFactory<Transport, ITransportName> transportAdapter)
        {
            Transport transport = transportAdapter.CreateExport().Value;

            TransportForm = new TransportForm(ref transport);
            TransportForm.Text = transportAdapter.Metadata.Name;

            transport.SpawnCustomUI(this);

            menuStrip1.Show();

            TransportForm.TopLevel = false;
            TransportForm.FormBorderStyle = FormBorderStyle.None;
            TransportForm.Dock = DockStyle.Fill;
            TransportForm.Visible = true;
            TransportForm.AllocationForm.MainScrubber.DoubleClick += MainScrubber_DoubleClick;
            panel1.Controls.Add(TransportForm);
        }
Ejemplo n.º 2
0
        new void Load(String path)
        {
            if (!File.Exists(path))
            {
                return;
            }

            List<Type> knownTypes = new List<Type>();
            foreach (ExportFactory<SymbolLookup, ISymbolLookupExtension> symbolLookupAdapter in Program.SymbolLookupAdapters)
            {
                Type type = symbolLookupAdapter.CreateExport().Value.GetType();
                knownTypes.Add(type);
            }

            DataContractSerializer serializer = new DataContractSerializer(typeof(Profile), knownTypes);
            FileStream fileStream = new FileStream(path, FileMode.Open);
            Profile profile = (Profile)serializer.ReadObject(fileStream);
            fileStream.Close();

            if (TransportForm != null)
            {
                TransportForm.Dispose();
            }

            panel1.Controls.Remove(StartScreen);
            menuStrip1.Show();

            TransportForm = new TransportForm(profile);

            TransportForm.TopLevel = false;
            TransportForm.FormBorderStyle = FormBorderStyle.None;
            TransportForm.Dock = DockStyle.Fill;
            TransportForm.Visible = true;
            TransportForm.AllocationForm.MainScrubber.DoubleClick += MainScrubber_DoubleClick;
            panel1.Controls.Add(TransportForm);

            // Do some post-processing of the dataset
            TransportForm.Profile.History.LastTimestamp = new TimeStamp();
            TransportForm.Profile.History.UpdateSnapshotAsync(TransportForm.Profile.History.Snapshot, true);
            TransportForm.Profile.ProcessDiffs();

            if (TransportForm.Profile.Diffs != null)
            {
                TransportForm.Profile.Diffs.ForEach((diff) => AddDiffTab(diff));
            }
        }