private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // init library
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(null);

            // find file, remember Submodel element for it, find filename
            // (ConceptDescription)(no-local)[IRI]http://www.admin-shell.io/mtp/v1/MTPSUCLib/ModuleTypePackage
            var simIdFn = new AdminShell.Key("ConceptDescription", false,
                                             "IRI", "http://www.admin-shell.io/mtp/v1/MTPSUCLib/ModuleTypePackage");

            this.activeMtpFileElem = theSubmodel?.submodelElements?.FindFirstSemanticIdAs <AdminShell.File>(simIdFn);
            var inputFn = this.activeMtpFileElem?.value;

            if (inputFn == null)
            {
                return;
            }

            // access file
            if (CheckIfPackageFile(inputFn))
            {
                inputFn = thePackage.MakePackageFileAvailableAsTempFile(inputFn);
            }

            // load file
            LoadFile(inputFn);

            // fit it
            this.mtpVisu.ZoomToFitCanvas();

            // double click handler
            this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // start
            SetMessage("Application started.");

            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // to find options
            this.theOptions = AasxPluginOptionsBase.LoadDefaultOptionsFromAssemblyDir <MtpViewerStandaloneOptions>(
                "WpfMtpVisuViewer", Assembly.GetExecutingAssembly());
            if (this.theOptions != null && this.theOptions.SymbolMappings != null)
            {
                activeVisualObjectLib.LoadFromSymbolMappings(this.theSymbolLib, this.theOptions.SymbolMappings);
                SetMessage("Options loaded.");
            }

            // load file
            try
            {
                //// LoadFile("Dosing.mtp");
                //// LoadFile("Manifest_PxC_Dosing.aml");
                LoadFile("Manifest_V18.10.31_3_better_name_win3.aml");
                //// LoadFile("Manifest_Sten1.aml");
                //// LoadFile("Manifest_ChemiReaktor_MIHO.aml");

                SetMessage("MTP file loaded.");
            }
            catch (Exception ex)
            {
                SetMessage("Exception: {0}", ex.Message);
            }

            // fit it
            this.mtpVisu.ZoomToFitCanvas();

            // double click handler
            this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
        }
Esempio n. 3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // gather infos
            var ok = GatherMtpInfos(this.thePreLoadInfo);

            if (ok && this.activeMtpFileFn != null)
            {
                // access file
                var inputFn = this.activeMtpFileFn;
                if (CheckIfPackageFile(inputFn))
                {
                    inputFn = thePackage.MakePackageFileAvailableAsTempFile(inputFn);
                }

                // load file
                LoadFile(inputFn);

                // fit it
                this.mtpVisu.ZoomToFitCanvas();

                // double click handler
                this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
            }

            // Timer for status
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            // ReSharper disable once RedundantDelegateCreation
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            dispatcherTimer.Start();
        }
Esempio n. 4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // gather infos
            var ok = GatherMtpInfos();

            if (ok && this.activeMtpFileFn != null)
            {
                // access file
                var inputFn = this.activeMtpFileFn;
                if (CheckIfPackageFile(inputFn))
                {
                    inputFn = thePackage.MakePackageFileAvailableAsTempFile(inputFn);
                }

                // load file
                LoadFile(inputFn);

                // fit it
                this.mtpVisu.ZoomToFitCanvas();

                // double click handler
                this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
            }
        }