Beispiel #1
0
        //
        // Callbacks
        //

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // making up "empty" picture
            this.AasId.Text   = "<id unknown!>";
            this.AssetId.Text = "<id unknown!>";

            /*
             * Image image = new Image();
             * image.Source = new BitmapImage(new Uri("Resources/USB_Hexagon_offen.jpeg", UriKind.RelativeOrAbsolute));
             * this.AssetPic.Source = new BitmapImage(new Uri("Resources/USB_Hexagon_offen.jpeg", UriKind.RelativeOrAbsolute));
             */

            // display elements has a cache
            DisplayElements.ActivateElementStateCache();

            // show Logo?
            if (Options.LogoFile != null)
            {
                try
                {
                    var bi = new BitmapImage(new Uri(Options.LogoFile, UriKind.RelativeOrAbsolute));
                    this.LogoImage.Source = bi;
                    this.LogoImage.UpdateLayout();
                } catch { }
            }

            // adding the CEF Browser conditionally
#if WITHOUTCEF
            theBrowser         = new FakeBrowser();
            CefContainer.Child = theBrowser;
            theBrowser.Address = "https://github.com/admin-shell/io/blob/master/README.md";
#else
            theBrowser         = new CefSharp.Wpf.ChromiumWebBrowser();
            CefContainer.Child = theBrowser;
            theBrowser.Address = "https://github.com/admin-shell/io/blob/master/README.md";
#endif

            // window size?
            if (Options.WindowLeft > 0)
            {
                this.Left = Options.WindowLeft;
            }
            if (Options.WindowTop > 0)
            {
                this.Top = Options.WindowTop;
            }
            if (Options.WindowWidth > 0)
            {
                this.Width = Options.WindowWidth;
            }
            if (Options.WindowHeight > 0)
            {
                this.Height = Options.WindowHeight;
            }
            if (Options.WindowMaximized)
            {
                this.WindowState = WindowState.Maximized;
            }

            // Timer for below
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            dispatcherTimer.Start();

            // Last task here ..
            Log.Info("Application started ..");

            // Try to load?
            if (Options.AasxToLoad != null)
            {
                // make a fully qualified filename from that one provided as input argument
                var fn = System.IO.Path.GetFullPath(Options.AasxToLoad);
                UiLoadPackageEnv(fn);
            }

            // test sequence

            /*
             * var asset1 = new AdminShell.Asset();
             * Log.Info("asset1" + asset1.GetElementName());
             * AdminShell.Referable ref1 = asset1;
             * Log.Info("ref1" + ref1.GetElementName());
             * var s = Options.GenerateIdAccordingTemplate(Options.TemplateIdSubmodelType);
             */

            /*
             * var blur = new BlurEffect();
             * blur.Radius = 5;
             *
             * var current = this.Background;
             * this.Background = new SolidColorBrush(Colors.DarkGray);
             * this.Effect = blur;
             * MessageBox.Show("hello");
             * this.Effect = null;
             * this.Background = current;
             * this.InnerGrid.Opacity = 0.5;
             * this.InnerGrid.Effect = blur;
             */
        }