Beispiel #1
0
        public Card()
        {
            _isTextPresent = -1;
            _isImagePresent = -1;
            _isVideoPresent = -1;
            _isAudioPresent = -1;
            _isUrlPresent = -1;

            MetaData = new MetaData();

            MetaData.Color = Colors.White;

            _decals = new ObservableCollection<Decal>();

            #if !SILVERLIGHT
            AddText = new DelegateCommand(() =>
            {
                TextDecal decal = new TextDecal();
                AddDecal(decal);

                decal.DelaySelect(true);
            }, CanAddText);

            AddImage = new DelegateCommand<string>((path) =>
            {
                ImageDecal Idecal = new ImageDecal();

                CommonOpenFileDialog cfd = new CommonOpenFileDialog((string)Application.Current.FindResource("Resource_SaveDialogTitle_AddImage"));

                cfd.EnsureReadOnly = true;

                // Set the initial location as the path of the library
                cfd.InitialDirectoryShellContainer = KnownFolders.PicturesLibrary as ShellContainer;

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    // Get the selection from the user.
                    ShellObject so = cfd.FileAsShellObject;
                    if(so.ParsingName != null)
                    {
                        ((ImageMetaData)Idecal.MetaData).Source = so.ParsingName;
                        AddDecal(Idecal);

                        Idecal.DelaySelect(true);
                    }
                }

            }, CanAddImage);

            AddVideo = new DelegateCommand<string>((path) =>
            {

                CommonOpenFileDialog cfd = new CommonOpenFileDialog((string)Application.Current.FindResource("Resource_SaveDialogTitle_AddVideo"));

                cfd.EnsureReadOnly = true;

                // Set the initial location as the path of the library
                cfd.InitialDirectoryShellContainer = KnownFolders.VideosLibrary as ShellContainer;

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    // Get the selection from the user.
                    ShellObject so = cfd.FileAsShellObject;
                    if (so.ParsingName != null)
                    {
                        VideoDecal Idecal = new VideoDecal();
                        ((VideoMetaData)Idecal.MetaData).Source = so.ParsingName;
                        AddDecal(Idecal);

                        VideoControlDecal control = new VideoControlDecal(Idecal);

                        Idecal.VideoControl = control;
                        AddDecal(control);

                        Idecal.DelaySelect(true);
                    }
                }

            }, CanAddVideo);

            AddAudio = new DelegateCommand(() =>
            {
                TextToSpeechDecal decal = new TextToSpeechDecal();
                AddDecal(decal);
                decal.DelaySelect(true);
            }, CanAddAudio);

            AddUrl = new DelegateCommand(() =>
            {
                InfoLinkDecal decal = new InfoLinkDecal();
                AddDecal(decal);
                decal.DelaySelect(true);
            }, CanAddUrl);

            RemoveDecal = new DelegateCommand<Decal>((decal) =>
            {
                if (decal == null)
                    decal = SelectedDecal;

                if (decal != null)
                {
                    decal.UnInitialize();
                    DeleteDecal(decal);
                }
            });
            #endif
        }
Beispiel #2
0
        public Card()
        {
            _isTextPresent  = -1;
            _isImagePresent = -1;
            _isVideoPresent = -1;
            _isAudioPresent = -1;
            _isUrlPresent   = -1;

            MetaData = new MetaData();

            MetaData.Color = Colors.White;

            _decals = new ObservableCollection <Decal>();

#if !SILVERLIGHT
            AddText = new DelegateCommand(() =>
            {
                TextDecal decal = new TextDecal();
                AddDecal(decal);

                decal.DelaySelect(true);
            }, CanAddText);

            AddImage = new DelegateCommand <string>((path) =>
            {
                ImageDecal Idecal = new ImageDecal();

                CommonOpenFileDialog cfd = new CommonOpenFileDialog((string)Application.Current.FindResource("Resource_SaveDialogTitle_AddImage"));

                cfd.EnsureReadOnly = true;

                // Set the initial location as the path of the library
                cfd.InitialDirectoryShellContainer = KnownFolders.PicturesLibrary as ShellContainer;

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    // Get the selection from the user.
                    ShellObject so = cfd.FileAsShellObject;
                    if (so.ParsingName != null)
                    {
                        ((ImageMetaData)Idecal.MetaData).Source = so.ParsingName;
                        AddDecal(Idecal);

                        Idecal.DelaySelect(true);
                    }
                }
            }, CanAddImage);

            AddVideo = new DelegateCommand <string>((path) =>
            {
                CommonOpenFileDialog cfd = new CommonOpenFileDialog((string)Application.Current.FindResource("Resource_SaveDialogTitle_AddVideo"));

                cfd.EnsureReadOnly = true;

                // Set the initial location as the path of the library
                cfd.InitialDirectoryShellContainer = KnownFolders.VideosLibrary as ShellContainer;

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    // Get the selection from the user.
                    ShellObject so = cfd.FileAsShellObject;
                    if (so.ParsingName != null)
                    {
                        VideoDecal Idecal = new VideoDecal();
                        ((VideoMetaData)Idecal.MetaData).Source = so.ParsingName;
                        AddDecal(Idecal);

                        VideoControlDecal control = new VideoControlDecal(Idecal);

                        Idecal.VideoControl = control;
                        AddDecal(control);

                        Idecal.DelaySelect(true);
                    }
                }
            }, CanAddVideo);

            AddAudio = new DelegateCommand(() =>
            {
                TextToSpeechDecal decal = new TextToSpeechDecal();
                AddDecal(decal);
                decal.DelaySelect(true);
            }, CanAddAudio);

            AddUrl = new DelegateCommand(() =>
            {
                InfoLinkDecal decal = new InfoLinkDecal();
                AddDecal(decal);
                decal.DelaySelect(true);
            }, CanAddUrl);

            RemoveDecal = new DelegateCommand <Decal>((decal) =>
            {
                if (decal == null)
                {
                    decal = SelectedDecal;
                }

                if (decal != null)
                {
                    decal.UnInitialize();
                    DeleteDecal(decal);
                }
            });
#endif
        }