예제 #1
0
        private void SimulateMeasurement_Drop(object sender, DragEventArgs e)
        {
            Bib3.FCL.GBS.Extension.CatchNaacMessageBoxException(() =>
            {
                var file = Glob.LaadeFrüühestInhaltDataiAusDropFileDrop(e);

                try
                {
                    var memoryMeasurementJson = Encoding.UTF8.GetString(file.Value);

                    var graph = Bib3.RefNezDiferenz.Extension.ListeWurzelDeserialisiireVonJson(memoryMeasurementJson)
                                ?.FirstOrDefault();

                    if (null == graph)
                    {
                        throw new ArgumentException("failed to read graph.");
                    }

                    var measurement =
                        (graph as FromProcessMeasurement <IMemoryMeasurement>)?.Value ??
                        graph as IMemoryMeasurement;

                    if (null == measurement)
                    {
                        throw new ArgumentException("unexpected type:" + graph?.GetType());
                    }

                    SimulateMeasurement?.Invoke(measurement);
                }
                catch (Exception exc)
                {
                    throw new Exception("Loaded from file " + file.Key, exc);
                }
            });
        }