Exemple #1
0
        private void HelpCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var          baseUri = BaseUriHelper.GetBaseUri(this);
            BitmapSource img     = new BitmapImage(new Uri(baseUri, @"/img/colora.png"));

            manager.ShowAboutBox(img);
        }
Exemple #2
0
        public Sprite(string name, int spriteWidth, AnimationSpeed speed = AnimationSpeed.Normal, AnimationType type = AnimationType.AnimateOnce)
        {
            BitmapImage spriteSheet =
                new BitmapImage(UriFromImageName(name))
            {
                BaseUri = BaseUriHelper.GetBaseUri(this)
            };

            numSprites = (int)((spriteSheet.Width / spriteWidth) - 1);
            int spriteHeight = (int)spriteSheet.Height;

            croppedImages = new CroppedBitmap[numSprites];

            for (int i = 0; i < numSprites; i++)
            {
                Int32Rect cropWindow = new Int32Rect(spriteWidth * i, 0, spriteWidth, spriteHeight);
                croppedImages[i] = new CroppedBitmap(spriteSheet, cropWindow);
            }

            animationType = type;

            this.Source = croppedImages[0];

            animationTimer.Interval = (int)speed;
            animationTimer.Tick    += animationTimer_Tick;

            animationTimer.Start();
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();
            Uri iconUri = new Uri("pack://application:,,,/Resources/MWT.ico", UriKind.RelativeOrAbsolute);

            BaseUri    = BaseUriHelper.GetBaseUri(this);
            this.Icon  = BitmapFrame.Create(iconUri);
            MainTitle += $" v{version}";
            this.Title = $"{MainTitle}";
            ofd.Filter = Translate.Key(nameof(MifareWindowsTool.Properties.Resources.DumpFileFilter));

            t = new Tools(this);

            ofd.InitialDirectory = Path.Combine(t.DefaultWorkingDir, "dumps");

            if (!t.TestWritePermission(ofd.InitialDirectory))
            {
                MessageBox.Show(Translate.Key(nameof(MifareWindowsTool.Properties.Resources.PleaseRestartAsAdmin)));
                Application.Current.Shutdown();
            }

            if (CheckSetDriver())
            {
                PeriodicScanTag();
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = MainWindowVM.GetInstance;

            #region BackGround
            if (!Directory.Exists(Environment.CurrentDirectory + "/Images/"))
            {
                Directory.CreateDirectory(Environment.CurrentDirectory + "/Images/");
            }

            string[] fileArray = Directory.GetFiles(Environment.CurrentDirectory + "/Images/");
            Random   rand      = new Random();
            if (fileArray.Length > 0)
            {
                try
                {
                    Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), fileArray[rand.Next(0, fileArray.Length)])));
                }
                catch (Exception ex)
                {
                    ExceptionUtility.LogError(ex);
                }
            }
            #endregion
        }
Exemple #5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var intValue = value as int?;

            if (intValue == null)
            {
                return(Binding.DoNothing);
            }

            if (intValue < 0 || intValue > 52)
            {
                return(Binding.DoNothing);
            }

            var control = parameter as Control;

            if (control == null)
            {
                return(Binding.DoNothing);
            }

            return(new ImageBrush(
                       new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(control),
                                               string.Format("/DriveHUD.Common.Resources;component/images/cards/{0}.png", intValue)))));
        }
        private void render()
        {
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    IPiece      piece        = _gameState.At(x, y);
                    Rectangle   square       = _imageSquares[x, y];
                    SquareState currentState = (SquareState)square.Tag;
                    if (currentState.Piece != piece)
                    {
                        if (piece != null)
                        {
                            string      path     = "images/" + piece.ImageFile();
                            Uri         imageUri = new Uri(BaseUriHelper.GetBaseUri(this), path);
                            BitmapImage image    = new BitmapImage(imageUri);

                            currentState.Piece = piece;
                            square.Tag         = currentState;
                            square.Fill        = new ImageBrush(image);
                        }
                        else
                        {
                            currentState.Piece = null;
                            square.Tag         = currentState;
                            square.Fill        = new ImageBrush();
                        }
                    }
                }
            }
            lblPlayerTurn.Content = _gameState.PlayerTurn.ToString();
            //lblWhiteHeuristic.Content = Agent.Heuristic.GetHeuristic(_gameState, Team.White);
            lblWhiteHeuristic.Content = _totalEvals;
        }
Exemple #7
0
        internal static bool IsEnumerableFontUriScheme(Uri fontLocation)
        {
            bool isEnumerable = false;

            // We only support file:// and pack:// application Uris to reference logical fonts.
            if (fontLocation.IsAbsoluteUri)
            {
                if (fontLocation.IsFile)
                {
                    // file scheme is always enumerable
                    isEnumerable = true;
                }
                else if (fontLocation.Scheme == PackUriHelper.UriSchemePack)
                {
                    // This is just an arbitrary file name which we use to construct a file URI.
                    const string fakeFileName = "X";

                    // The fontLocation could be a folder-like URI even though the pack scheme does not allow this.
                    // We simulate the concept of subfolders for packaged fonts. Before calling any PackUriHelper
                    // methods, create a Uri which we know to be a file-like (rather than folder-like) URI.
                    Uri fileUri;
                    if (Uri.TryCreate(fontLocation, fakeFileName, out fileUri))
                    {
                        isEnumerable = BaseUriHelper.IsPackApplicationUri(fileUri);
                    }
                }
            }

            return(isEnumerable);
        }
        public void creaQuadre(string rutaImatge, string nom, int fila, int columna, int midaLletra)
        {
            StackPanel persona    = new StackPanel();
            TextBlock  nomPersona = new TextBlock();

            nomPersona.FontSize   = midaLletra;
            nomPersona.FontWeight = FontWeights.Bold;
            nomPersona.Foreground = new SolidColorBrush(Colors.Red);
            nomPersona.Text       = nom;

            persona.Children.Add(nomPersona);
            ImageBrush fons = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), rutaImatge)));

            persona.Background = fons;

            if (nom != "*")
            {
                persona.AllowDrop  = true;
                persona.MouseDown += persona_MouseDown;
                persona.DragEnter += persona_DragEnter;
                persona.Drop      += persona_Drop;
            }

            Grid.SetColumn(persona, columna);
            Grid.SetRow(persona, fila);
            grdEscenari.Children.Add(persona);

            //FerAnimacio();
        }
        private void Lose()
        {
            ImageBrush answerBrush = new ImageBrush();

            answerBrush.ImageSource =
                new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "images2/叉叉.png"));
            wrongAnswer.Background = answerBrush;
            stopAnimation();
            gameover = true;


            if (score >= Name1.highScoreGame2)
            {
                Name1.highScoreGame2 = score;
                if (System.Windows.MessageBox.Show("Congratulations! You get the highest score : " + score.ToString(), "GameOver", MessageBoxButton.OK, MessageBoxImage.Question) == MessageBoxResult.OK)
                {
                    Name1 child = new Name1();
                    child.Owner = this;
                    child.Show();
                    highScoreLbl.Content = Name1.highScoreGame2;
                }
            }
            else if (System.Windows.MessageBox.Show("Your score is : " + score.ToString() +
                                                    "\n The highest score is : " + Name1.highScoreNameGame2 + " , " + Name1.highScoreGame2, "GameOver", MessageBoxButton.OK, MessageBoxImage.Question) == MessageBoxResult.OK)
            {
                ;
            }
        }
Exemple #10
0
        public ImageBrush whiteQueen()
        {
            ImageBrush myBrush = new ImageBrush();

            myBrush.ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "\\images\\bialqueen.png"));
            return(myBrush);
        }
        private void RestartGame()
        {
            foreach (var x in MyCanvas.Children.OfType <Rectangle>())
            {
                if (x.Tag.ToString() == "car")
                {
                    itemRemover.Add(x);
                }
                if (x.Tag.ToString() == "bomb")
                {
                    ImageBrush lostLife = new ImageBrush();
                    lostLife.ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "/Resources/Images/FuelFull.png"));
                    Life1.Fill           = lostLife;
                    Life2.Fill           = lostLife;
                    Life3.Fill           = lostLife;
                }
            }

            foreach (Rectangle y in itemRemover)
            {
                MyCanvas.Children.Remove(y);
            }
            itemRemover.Clear();
            StartGame();
        }
Exemple #12
0
        public ImageBrush blackPawn()
        {
            ImageBrush myBrush = new ImageBrush();

            myBrush.ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "\\images\\czarPion.png"));
            return(myBrush);
        }
        /// <inheritdoc/>
        public override string QualifiedUrl(string path)
        {
            var baseUri      = BaseUriHelper.GetBaseUri();
            var qualifiedUri = new Uri(baseUri, path);

            return(qualifiedUri.ToString());
        }
        private void changeScore()
        {
            isLose     = false;
            answerTime = scoreTimeCounter;
            stopAnimation();

            ImageBrush answerBrush = new ImageBrush();

            answerBrush.ImageSource =
                new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "images/愛心.png"));

            correctAnswer.Background = answerBrush;
            if (answerTime >= 0 && answerTime <= 2 * level / 3)
            {
                score += 7;
            }
            else if (answerTime > 2 * level / 3 && answerTime <= 4 * level / 3)
            {
                score += 5;
            }
            else if (answerTime > 4 * level / 3 && answerTime <= 2 * level)
            {
                score += 2;
            }

            lblScore.Content = score.ToString();


            //關卡設計
            if (gameTimeCounter >= 10 && level > 1)
            {
                level--;
                gameTimeCounter = 0;
            }
        }
Exemple #15
0
 // Set snowman to buffed state
 public override void buff()
 {
     this.Snowman.Img      = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(Application.Current.MainWindow), "../Images/snowman_buffed.png"));
     this.Snowman.Moveable = true;
     this.Snowman.Buffed   = true;
     this.Snowman.TransitionTo(new BuffedState());
 }
        private void changeScore()
        {
            if (person == 1)
            {
                person1.Background = null;
                person             = 2;
            }
            else if (person == 2)
            {
                person2.Background = null;
                person             = 3;
            }
            else
            {
                person3.Background = null;
                person             = 1;
            }

            ImageBrush answerBrush = new ImageBrush();

            answerBrush.ImageSource =
                new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "images/愛心.png"));

            correctAnswer.Background = answerBrush;
            score           += (1);
            lblScore.Content = score.ToString();

            isCorrect = true;
        }
Exemple #17
0
        private ImageSource TryConvertToImageSource(object value)
        {
            if (value is ImageSource)
            {
                var imageSource = (ImageSource)value;

                // Set BaseUri.
                var uriContext = imageSource as IUriContext;
                if (uriContext != null && !imageSource.IsFrozen && uriContext.BaseUri == null)
                {
                    uriContext.BaseUri = BaseUriHelper.GetBaseUri(this);
                }

                return(imageSource);
            }

            if (value is string)
            {
                value = new Uri((string)value, UriKind.RelativeOrAbsolute);
            }

            if (value is Uri)
            {
                var bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.BaseUri   = BaseUriHelper.GetBaseUri(this);
                bitmapImage.UriSource = (Uri)value;
                bitmapImage.EndInit();
                return(bitmapImage);
            }

            return(null);
        }
        public void SetImage()
        {
            ImageBrush myBrush = new ImageBrush();

            myBrush.ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "background.jpg"));
            this.Background     = myBrush;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Ablak címének beállítása
            this.Title = "Hello Világ!";

            // Szöveg mező beállítása
            Text1.Content = "Hello Világ!";

            //Szövegmező betűtipusának beállítása
            Text1.FontFamily = new FontFamily("Arial");

            // checkbox alapján történő szöveg beállítás
            if (check1.IsChecked.Value)
            {
                Text1.Content = "Hello Checkbox!";
            }

            // Háttérkép beállítása az ablaknak az internetről
            //Háttér betöltése az ecsetbe
            ImageBrush myImageBrush = new ImageBrush();

            myImageBrush.ImageSource = new BitmapImage(
                new Uri(BaseUriHelper.GetBaseUri(this),
                        "http://www.gamechannel.hu/pictures/hirblock/tovabbra_is_a_windows_xp_a_masodik_legnepszerubb_windows_1.jpg"
                        ));
            // Háttér beállítása
            this.Background = myImageBrush;
        }
Exemple #20
0
        private void Maingrid()
        {
            maingrid = (Grid)Content;

            maingrid.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "pmr.jpg")));

            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            maingrid.RowDefinitions.Add(new RowDefinition());
            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            maingrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });



            maingrid.ColumnDefinitions.Add(new ColumnDefinition());
            maingrid.ColumnDefinitions.Add(new ColumnDefinition());
            maingrid.ColumnDefinitions.Add(new ColumnDefinition());
        }
Exemple #21
0
        public void PrepareWindow()
        {
            // select respective image
            string resource;

            switch (MessageType)
            {
            case MessageType.Blue:
                resource = "Resources/goodWindow.png";
                break;

            case MessageType.Red:
                resource = "Resources/errorWindow.png";
                break;

            case MessageType.White:
                resource = "Resources/someWindow.png";
                break;

            default:
                resource = "Resources/aboutWindow.png";
                break;
            }

            Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), resource)));

            TextBlockCaption.Text = Caption;
            TextBlockText.Text    = _isSingle ? _text : _texts[0];

            InitButtons();
        }
Exemple #22
0
        // To avoid blocking the UI thread, SoundPlayerAction performs an asynchronous
        // download of the WebResponse and later, the response Stream.  However,
        // PackWebRequest does not support the asynchonous Begin/EndGetResponse pattern.
        // To work around this, we use our own asynchronous worker pool thread,
        // and then use the regular synchronous WebRequest.GetResponse() method.
        // Once we obtain the WebResponse, we will use SoundPlayer's async API
        // to download the content of the stream.
        private void OnSourceChangedHelper(Uri newValue)
        {
            if (newValue == null || newValue.IsAbsoluteUri)
            {
                m_lastRequestedAbsoluteUri = newValue;
            }
            else
            {
                // When we are given a relative Uri path, expand to an absolute Uri by resolving
                // it against the Application's base Uri.  This would typically return a Pack Uri.
                m_lastRequestedAbsoluteUri =
                    BaseUriHelper.GetResolvedUri(BaseUriHelper.BaseUri, newValue);
            }

            // Invalidate items that depend on the Source uri
            m_player        = null;
            m_playRequested = false; // Suppress earlier requests to Play the sound

            if (m_streamLoadInProgress)
            {
                // There is already a worker thread downloading the previous URI stream,
                // or the SoundPlayer is copying the stream into its buffer.  Make a note
                // that the URI has been changed and we will have to reload everything.
                m_uriChangedWhileLoadingStream = true;
            }
            else
            {
                BeginLoadStream();
            }
        }
Exemple #23
0
        protected override Stream GetStreamCore(FileMode mode, FileAccess access)
        {
            Stream stream = null;

            if (_fullPath == null)
            {
                // File name will be a path relative to the applications directory.
                // - We do not want to use SiteOfOriginContainer.SiteOfOrigin because
                //   for deployed files the <Content> files are deployed with the application.
                Uri codeBase = GetEntryAssemblyLocation();

                string assemblyName, assemblyVersion, assemblyKey;
                string filePath;

                // For now, only Application assembly supports content files,
                // so we can simply ignore the assemblyname etc.
                // In the future, we may extend this support for regular library assembly,
                // assemblyName will be used to predict the right file path.

                BaseUriHelper.GetAssemblyNameAndPart(Uri, out filePath, out assemblyName, out assemblyVersion, out assemblyKey);

                // filePath should not have leading slash.  GetAssemblyNameAndPart( ) can guarantee it.
                Uri file = new Uri(codeBase, filePath);
                _fullPath = file.LocalPath;
            }

            stream = CriticalOpenFile(_fullPath);

            if (stream == null)
            {
                throw new IOException(SR.Get(SRID.UnableToLocateResource, Uri.ToString()));
            }

            return(stream);
        }
Exemple #24
0
        public void DrawColor()
        {
            ImageBrush imagebrush = new ImageBrush();

            if (IsOranje && !IsSolid)
            {
                imagebrush.ImageSource      = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "../../../images/oranje-stippel.png"));
                recDag.Fill                 = imagebrush;
                btnCreateMandag.BorderBrush = new SolidColorBrush(Colors.LawnGreen);
            }
            else if (IsGroen && IsSolid)
            {
                recDag.Fill = new SolidColorBrush(Colors.LawnGreen);
                btnCreateMandag.BorderBrush = new SolidColorBrush(Colors.LawnGreen);
            }
            else if (IsGroen && !IsSolid)
            {
                imagebrush.ImageSource      = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "../../../images/groen-stippel.png"));
                recDag.Fill                 = imagebrush;
                btnCreateMandag.BorderBrush = new SolidColorBrush(Colors.LawnGreen);
            }
            else if (!IsGroen && IsSolid)
            {
                recDag.Fill = new SolidColorBrush(Colors.OrangeRed);
                btnCreateMandag.BorderBrush = new SolidColorBrush(Colors.OrangeRed);
            }
            else if (!IsGroen && !IsSolid)
            {
                imagebrush.ImageSource      = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "../../../images/rood-stippel.png"));
                recDag.Fill                 = imagebrush;
                btnCreateMandag.BorderBrush = new SolidColorBrush(Colors.OrangeRed);
            }
        }
Exemple #25
0
        internal static object XamlConverter(Stream stream, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter)
        {
            asyncObjectConverter = null;
            if (sandboxExternalContent)
            {
                if (SecurityHelper.AreStringTypesEqual(baseUri.Scheme, BaseUriHelper.PackAppBaseUri.Scheme))
                {
                    baseUri = BaseUriHelper.ConvertPackUriToAbsoluteExternallyVisibleUri(baseUri);
                }
                stream.Close();
                return(new WebBrowser
                {
                    Source = baseUri
                });
            }
            ParserContext parserContext = new ParserContext();

            parserContext.BaseUri = baseUri;
            parserContext.SkipJournaledProperties = isJournalNavigation;
            if (allowAsync)
            {
                XamlReader xamlReader = new XamlReader();
                asyncObjectConverter      = xamlReader;
                xamlReader.LoadCompleted += AppModelKnownContentFactory.OnParserComplete;
                return(xamlReader.LoadAsync(stream, parserContext));
            }
            return(XamlReader.Load(stream, parserContext));
        }
Exemple #26
0
 public void ClearDapAn()
 {
     txtAwsA.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "Image/button3.png")));
     txtAwsB.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "Image/button3.png")));
     txtAwsC.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "Image/button3.png")));
     txtAwsD.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "Image/button3.png")));
 }
Exemple #27
0
        // <summary>
        // Searches the available ResourceManagerWrapper list for one that matches the given Uri.
        // It could be either ResourceManagerWrapper for specific libary assembly or Application
        // main assembly. Package enforces that all Uri will be correctly formated.
        // </summary>
        // <param name="uri">Assumed to be relative</param>
        // <param name="partName">The name of the file in the resource manager</param>
        // <param name="isContentFile">A flag to indicate that this path is a known loose file at compile time</param>
        // <returns></returns>
        private ResourceManagerWrapper GetResourceManagerWrapper(Uri uri, out string partName, out bool isContentFile)
        {
            string assemblyName;
            string assemblyVersion;
            string assemblyKey;
            ResourceManagerWrapper rmwResult = ApplicationResourceManagerWrapper;

            isContentFile = false;

            BaseUriHelper.GetAssemblyNameAndPart(uri, out partName, out assemblyName, out assemblyVersion, out assemblyKey);

            if (!String.IsNullOrEmpty(assemblyName))
            {
                string key = assemblyName + assemblyVersion + assemblyKey;

                _registeredResourceManagers.TryGetValue(key.ToLowerInvariant(), out rmwResult);

                // first time. Add this to the hash table
                if (rmwResult == null)
                {
                    Assembly assembly;

                    assembly = BaseUriHelper.GetLoadedAssembly(assemblyName, assemblyVersion, assemblyKey);

                    if (assembly.Equals(Application.ResourceAssembly))
                    {
                        // This Uri maps to Application Entry assembly even though it has ";component".

                        rmwResult = ApplicationResourceManagerWrapper;
                    }
                    else
                    {
                        rmwResult = new ResourceManagerWrapper(assembly);
                    }

                    _registeredResourceManagers[key.ToLowerInvariant()] = rmwResult;
                }
            }

            if ((rmwResult == ApplicationResourceManagerWrapper))
            {
                if (rmwResult != null)
                {
                    // If this is not a resource from a component then it might be
                    // a content file and not an application resource.
                    if (ContentFileHelper.IsContentFile(partName))
                    {
                        isContentFile = true;
                        rmwResult     = null;
                    }
                }
                else
                {
                    // Throw when Application.ResourceAssembly is null.
                    throw new IOException(SR.Get(SRID.EntryAssemblyIsNull));
                }
            }

            return(rmwResult);
        }
Exemple #28
0
        /// <summary>
        /// Open Media
        /// </summary>
        private void OpenMedia(Uri source)
        {
            string toOpen = null;

            if (source != null && source.IsAbsoluteUri && source.Scheme == PackUriHelper.UriSchemePack)
            {
                try
                {
                    source = BaseUriHelper.ConvertPackUriToAbsoluteExternallyVisibleUri(source);
                }
                catch (InvalidOperationException)
                {
                    source = null;
                    _mediaEventsHelper.RaiseMediaFailed(new System.NotSupportedException(SR.Get(SRID.Media_PackURIsAreNotSupported, null)));
                }
            }

            // Setting a null source effectively disconects the MediaElement.
            if (source != null)
            {
                // get the base directory of the application; never expose this
                Uri appBase = SecurityHelper.GetBaseDirectory(AppDomain.CurrentDomain);
                // this extracts the URI to open
                Uri uriToOpen = ResolveUri(source, appBase);
                toOpen = DemandPermissions(uriToOpen);
            }
            else
            {
                toOpen = null;
            }

            // We pass in exact same URI for which we demanded permissions so that we can be sure
            // there is no discrepancy between the two.
            HRESULT.Check(MILMedia.Open(_nativeMedia, toOpen));
        }
Exemple #29
0
        // <summary>
        // Creates an object instance from a Baml stream and it's Uri
        // </summary>
        internal static object BamlConverter(Stream stream, Uri baseUri, bool canUseTopLevelBrowser, bool sandboxExternalContent, bool allowAsync, bool isJournalNavigation, out XamlReader asyncObjectConverter)
        {
            asyncObjectConverter = null;

            // If this stream comes from outside the application throw
            //
            if (!BaseUriHelper.IsPackApplicationUri(baseUri))
            {
                throw new InvalidOperationException(SR.Get(SRID.BamlIsNotSupportedOutsideOfApplicationResources));
            }

            // If this stream comes from a content file also throw
            Uri    partUri = PackUriHelper.GetPartUri(baseUri);
            string partName, assemblyName, assemblyVersion, assemblyKey;

            BaseUriHelper.GetAssemblyNameAndPart(partUri, out partName, out assemblyName, out assemblyVersion, out assemblyKey);
            if (ContentFileHelper.IsContentFile(partName))
            {
                throw new InvalidOperationException(SR.Get(SRID.BamlIsNotSupportedOutsideOfApplicationResources));
            }

            ParserContext pc = new ParserContext();

            pc.BaseUri = baseUri;
            pc.SkipJournaledProperties = isJournalNavigation;

            return(Application.LoadBamlStreamWithSyncInfo(stream, pc));
        }
Exemple #30
0
        private void satinal_Click(object sender, RoutedEventArgs e)
        {
            if (suankikullanici == 0)
            {
                Kaydir("Girisac", Giris);

                Giris.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "rsm/kırmızılı.jpg")));
            }
            else
            {
                int z = 0;
                if (sepetlist.Count != 0)
                {
                    for (int i = 0; i < sepetlist.Count; i++)
                    {
                        z += sepetlist.ElementAt(i).fiyat *sepetlist.ElementAt(i).adet;
                    }
                    sontutar.Content = "Toplam Tutar: " + z.ToString();
                    Kaydir("siparisitamamlaac", alisverisspnl);
                    Kaydir("Giriskapa", Giris);
                }
                else
                {
                    System.Windows.MessageBox.Show("Sepetiniz boş ");
                }
            }
            Kaydir("Sepetkapa", Sepet);
        }