Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var view = new ShellView();
            var viewModel = new ShellViewModel();

            view.ViewModel = viewModel;

            view.Show();
        }
Exemple #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var services = GetServiceProvider();

            var window = new ShellView
            {
                DataContext = services.GetRequiredService <ShellViewModel>()
            };

            window.Show();

            base.OnStartup(e);
        }
        private void MainItemGrid_OnTap(object sender, GestureEventArgs e)
        {
            TapedItem = (FrameworkElement)sender;

            var tapedItemContainer = TapedItem.FindParentOfType <ListBoxItem>();

            var result = ViewModel.OpenDialogDetails(TapedItem.DataContext as TLDialogBase);

            if (result)
            {
                ShellView.StartContinuumForwardOutAnimation(TapedItem, tapedItemContainer);
            }
        }
Exemple #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            IUnityContainer container = new UnityContainer();
            var iocConatiner = new UnityIocContainer(container);
            container.RegisterInstance<IIocContainer>(iocConatiner);
            container.RegisterInstance<IEventAggregator>(new EventAggregator());
            container.RegisterInstance<ICustomerService>(new InMemoryCustomerService());

            var window = new ShellView(new ShellViewModel(iocConatiner));
            window.Show();
        }
Exemple #5
0
        public MainWindow()
        {
            Title = "Pixiv Func";

            this.InitializeComponent();
            if (Instances.Get <IAccountService>().UserAccounts.Count > 0)
            {
                Content = new ShellView();
            }
            else
            {
                Content = new WelcomeView();
            }
        }
Exemple #6
0
        public DeviceListViewModel(IDeviceService deviceService, IShellService shellService, IEventAggregator eventAggregator)
        {
            _deviceService   = deviceService;
            _shellService    = shellService;
            _eventAggregator = eventAggregator;
            _isBusy          = true;

            DeleteDevice   = new DelegateCommand(DeleteDeviceAction, CanUpdateOrDelete);
            AddDevice      = new DelegateCommand(AddDeviceAction);
            UpdateDevice   = new DelegateCommand(UpdateDeviceAction, CanUpdateOrDelete);
            OpenCategories = new DelegateCommand(OpenCategoriesAction);
            OpenBrands     = new DelegateCommand(OpenBrandsAction);
            _addDeviceView = null;
        }
Exemple #7
0
        public async Task <MessageDialogResult> ShowMessageAsync(string title, string message)
        {
            using (await _lock.EnterAsync())
            {
                if (ShellView != null)
                {
                    return(await RunOnUIAsync(() => ShellView.ShowMessageAsync(title, message)));
                }

                return(MessageBox.Show(message, title) == MessageBoxResult.OK
                           ? MessageDialogResult.Affirmative
                           : MessageDialogResult.Negative);
            }
        }
Exemple #8
0
        private async void DialogHost_OnLoaded(object sender, RoutedEventArgs e)
        {
            var debugging = false;

#if DEBUG
            debugging = true;
#endif
            await Setup.DoSetup(MainSnackbar.MessageQueue, debugging, this);

            _shellViewModel       = Setup.GetShellViewModel();
            ShellView.DataContext = _shellViewModel;

            ShellView.EnableNavigation();
            await _shellViewModel.LoadAsync();
        }
Exemple #9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var configuration   = new ConfigurationBuilder().Build();
            var serviceProvider = BuildDi(configuration);

            ShutdownMode = ShutdownMode.OnLastWindowClose;

            var shell            = new ShellView();
            var viewModelFactory = serviceProvider.GetService <IViewModelFactoryService>();

            shell.DataContext = viewModelFactory.CreateViewModel <ShellViewModel>();
            shell.Show();
        }
        protected override void Run()
        {
            Dispatcher = Dispatcher.CurrentDispatcher;

            var shellView = new ShellView();

            shellView.Closed += OnShellClosed;
            Engine.Detect();

            shellView.Show();

            Dispatcher.Run();

            this.Engine.Quit(0);
        }
 public void UpdateSize(ShellView window)
 {
     if (window.ActualWidth < 800)
     {
         GraphRow    = 1;
         GraphColumn = 0;
         // GraphWidth = (int)e.NewSize.Width - 40;
     }
     else
     {
         GraphRow    = 0;
         GraphColumn = 1;
         // GraphWidth = (int)e.NewSize.Width - 340;
     }
     NotifyOfPropertyChange(() => GraphRow);
 }
        protected override void InitializeShell()
        {
            base.InitializeShell();
            ShellView shellView = Container.Resolve <ShellView>("ShellView");

            Container.RegisterInstance <IShellView>(shellView);
            shellView.ViewModel.Model.Version         = "V " + "0.14.1123";
            shellView.ViewModel.Model.ApplicationName = "Easy Tools";
            this.Shell             = shellView as DependencyObject;
            App.Current.MainWindow = (Window)this.Shell;

            EasyApp.Current.ServiceUrl = Properties.Settings.Default.ServiceUrl;
            EasyApp.Current.Container  = this.Container;
            EasyApp.Current.Initialized();

            App.Current.MainWindow.Show();
        }
Exemple #13
0
        public App()
        {
            Startup += (sender, e) => {
                DisposableViewModel = new ShellViewModel();
                MainWindow          = new ShellView {
                    DataContext = DisposableViewModel
                };
                MainWindow.Show();
            };

            Exit += (sender, e) => DisposableViewModel?.Dispose();

            DispatcherUnhandledException += (sender, e) => {
                ShowExceptionMessage(e.Exception, true);
                e.Handled = true;
            };
        }
        private void VerticalItem2_OnTap(object sender, GestureEventArgs e)
        {
            var frameworkElement = sender as FrameworkElement;

            if (frameworkElement == null)
            {
                return;
            }

            var with = frameworkElement.DataContext as TLObject;

            if (with == null)
            {
                return;
            }

            ClosePivotAction.SafeInvoke(Visibility.Visible);
            ViewModel.StateService.CollapseSearchControl = true;

            Execute.BeginOnUIThread(() =>
            {
                if (!ViewModel.OpenDialogDetails(with, true))
                {
                    return;
                }

                _lastTapedItem = sender as FrameworkElement;

                if (_lastTapedItem != null)
                {
                    if (!(_lastTapedItem.RenderTransform is CompositeTransform))
                    {
                        _lastTapedItem.RenderTransform = new CompositeTransform();
                    }

                    var tapedItemContainer = _lastTapedItem.FindParentOfType <ListBoxItem>();
                    if (tapedItemContainer != null)
                    {
                        tapedItemContainer = tapedItemContainer.FindParentOfType <ListBoxItem>();
                    }

                    ShellView.StartContinuumForwardOutAnimation(_lastTapedItem, tapedItemContainer);
                }
            });
        }
Exemple #15
0
        /// <summary>
        /// Called upon loadin plugin. Global plugin configuration tasks are performed here.
        /// Once configuration is ready, registers the plugin ribbon.
        /// </summary>
        /// <param name="UIApp"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            uicApp = application;

            shellForm = null;
            revonApp  = this;

            //initialize AssemblyName using reflection
            FileLocations.AssemblyName   = Assembly.GetExecutingAssembly().GetName().Name;
            FileLocations.AssemblyPath   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            FileLocations.AddInDirectory = application.ControlledApplication.AllUsersAddinsLocation + "\\" + FileLocations.AssemblyName + "\\";

            // Create a custom ribbon tab
            String tabName = "BIM System";

            application.CreateRibbonTab(tabName);
            RibbonPanel RevonRibbonPanel = application.CreateRibbonPanel(tabName, "BIM System");

            //load image resources
            BitmapImage largeIcon = GetEmbeddedImageResource("iconLarge.png");
            BitmapImage smallIcon = GetEmbeddedImageResource("iconLarge.png");

            // Create Commands

            // import command
            PushButtonData importButton = new PushButtonData(
                name: "Import",
                text: "BIM System",
                assemblyName: typeof(App).Assembly.Location,
                className: "Revon.UI.Commands.ShellCommand")
            {
                LargeImage = ScaledIcon(largeIcon, 32, 32),
                Image      = ScaledIcon(smallIcon, 16, 16),
                ToolTip    = "Import Families from BIMSystem cloud database.",
            };


            RevonRibbonPanel.AddItem(importButton);

            // initialize caliburn
            boot = new AppBootstrapper();

            return(Result.Succeeded);
        }
Exemple #16
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            NavigationService = new NavigationService();
            AppContext        = new AppContext();

            // odpowiednik StartupUri w XAML
            ShellView shellView = new ShellView();

            shellView.Show();

            // Tworzymy instancję NavigationService i przekazujemy referencję do naszego Frame
            //NavigationService = new NavigationService(shellView.ShellFrame);

            NavigationService.frame = shellView.ShellFrame;

            NavigationService.Navigate <StartView>();
        }
        public async Task <MessageDialogResult> ShowMessageAsync(string title, string message)
        {
            using (await _lock.EnterAsync())
            {
                if (ShellView != null)
                {
                    var dialogSettings = new MetroDialogSettings
                    {
                        AffirmativeButtonText = Resources.ChocolateyDialog_OK
                    };

                    return(await RunOnUIAsync(() => ShellView.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative, dialogSettings)));
                }

                return(MessageBox.Show(message, title) == MessageBoxResult.OK
                           ? MessageDialogResult.Affirmative
                           : MessageDialogResult.Negative);
            }
        }
Exemple #18
0
        public App()
        {
            // setup log
            log4net.Config.XmlConfigurator.Configure();
            _log = LogManager.GetLogger(typeof(App));

            // exception handling
            InitializeExceptionHandling();

            // setup main window
            ShellView mw = new ShellView();

            // show the main window
            mw.Show();


            // setup teh bootstrapper
            _bootstrapper = new AppBootstrapper();
        }
Exemple #19
0
        private async Task RestoreLastViewOrGoToMain(ShellView shellView)
        {
            if (_previousExecutionState == ApplicationExecutionState.Terminated)
            {
                try
                {
                    await SuspensionManager.RestoreAsync();
                }
                catch (SuspensionManagerException)
                {
                }
            }

            SuspensionManager.RegisterFrame(shellView.ShellFrame, "MainFrame");

            if (shellView.ShellFrame.SourcePageType == null)
            {
                _navigationService.NavigateToViewModel <MainViewModel>();
            }
        }
        public void FillPreviewPane(ShellView browser)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart)(() =>
            {
                if (this.Browser == null)
                {
                    this.Browser = browser;
                }

                if (this.Browser.SelectedItems.Count() == 1)
                {
                    this.SelectedItems = this.Browser.SelectedItems.ToArray();
                    this.SelectedItems[0].Thumbnail.CurrentSize = new Size(this.ActualHeight - 20, this.ActualHeight - 20);
                    icon.Source = this.SelectedItems[0].Thumbnail.BitmapSource;
                }

                this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("DisplayName"));
                this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("FileType"));
            }));
        }
        public void OnHandleDestroyed()
        {
            currentAbsolutePidl = IntPtr.Zero;

            // Release the IShellView
            if (ShellView != null)
            {
                ShellView.UIActivate((uint)SVUIA_STATUS.SVUIA_DEACTIVATE);
                ShellView.DestroyViewWindow();

                //  The shell view may have come from COM but may be a SharpShell view, so check if it's COM
                //  before we release it.
                if (Marshal.IsComObject(ShellView))
                {
                    Marshal.ReleaseComObject(ShellView);
                }

                ShellView = null;
            }
        }
Exemple #22
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Contains("/hint"))
            {
                // support headless mode
                var session       = _hintProviderService.EnumHints();
                var overlayWindow = new OverlayView()
                {
                    DataContext = new OverlayViewModel(session, _hintLabelService)
                };
                overlayWindow.Show();
            }
            else
            {
                // Prevent multiple startup in non-headless mode
                if (_singleLaunchMutex.AlreadyRunning)
                {
                    Current.Shutdown();
                    return;
                }

                // Create this as late as possible as it has a window
                _keyListenerService = new KeyListenerService();

                var shellViewModel = new ShellViewModel(
                    ShowOverlay,
                    ShowDebugOverlay,
                    ShowOptions,
                    _hintLabelService,
                    _hintProviderService,
                    _hintProviderService,
                    _keyListenerService);

                var shellView = new ShellView
                {
                    DataContext = shellViewModel
                };
                shellView.Show();
            }
            base.OnStartup(e);
        }
Exemple #23
0
        internal void Initialize()
        {
            var basePath     = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var settingsPath = Path.Combine(basePath, "appsettings.json");

            if (!File.Exists(settingsPath))
            {
                File.WriteAllText(settingsPath, "{}");
            }

            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(basePath)
                                            .AddJsonFile("appsettings.json", false, false);
            var config = builder.Build();

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton <IConfiguration>(config);
            serviceCollection.Configure <AppOptions>(config.GetSection("AppOptions"));

            var path = Path.Combine(basePath, "diary.sqlite");

            if (File.Exists(path))
            {
                Local.Register(serviceCollection);
            }
            else
            {
                Remote.Register(serviceCollection);
            }

            _serviceProvider = serviceCollection.BuildServiceProvider();

            var view = new ShellView();
            var vm   = _serviceProvider.GetRequiredService <ApplicationViewModel>();

            view.BindingContext = vm;
            var t = vm.InitializeAsync();

            this.MainPage = view;
        }
Exemple #24
0
        public override void NewFolder()
        {
            string spath = CreateNewFolder(path, "New Folder");

            if (string.IsNullOrEmpty(spath))
            {
                return;
            }
            //refrash all views
            IntPtr pParrent = ItemIdList.Create(null, PathData).Ptr;

            Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                   ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                   pParrent,
                                   IntPtr.Zero);
            Marshal.FreeCoTaskMem(pParrent);
            //

            using (MemoryStream ms = new MemoryStream())
            {
                FolderAttributes newFolderAttrs = FolderAttributes.Folder | FolderAttributes.HasPropSheet | FolderAttributes.CanMove | FolderAttributes.CanDelete | FolderAttributes.CanRename | FolderAttributes.CanCopy | FolderAttributes.CanLink | FolderAttributes.Browsable | FolderAttributes.DropTarget;
                BinaryWriter     w = new BinaryWriter(ms, Encoding.Default);
                w.Write(0);
                w.Write(string.Format("{0}{1}{2}", path, FD, spath));
                w.Write((int)newFolderAttrs);
                IFileObject foNew = new FileObject();
                foNew.Name     = spath;
                foNew.IsFolder = true;
                byte[] btFo = FileObject.ToByteArray(foNew);
                w.Write((int)btFo.Length);
                w.Write(btFo, 0, btFo.Length);
                byte[] persist = ms.ToArray();

                IntPtr pNewFolder = ItemIdList.Create(null, new byte[][] { persist }).Ptr;
                if (ShellView != null)
                {
                    ShellView.SelectItem(pNewFolder, _SVSIF.SVSI_EDIT | _SVSIF.SVSI_FOCUSED | _SVSIF.SVSI_ENSUREVISIBLE);
                }
                Marshal.FreeCoTaskMem(pNewFolder);
            }
        }
Exemple #25
0
        public App()
        {
            _pageService   = new PageService();
            _sqLiteService = new SqLiteService();
            InitializeComponent();

            Crashes.SetEnabledAsync(true);
            Microsoft.AppCenter.Analytics.Analytics.SetEnabledAsync(true);
            _isCartTableCreated = _pageService.GetIsCartTableCreated().Result;
            string uname = _pageService.ReturnUsername(string.Empty).Result;

            if (String.IsNullOrEmpty(uname))
            {
                MainPage = new LoginView();
            }
            else
            {
                MainPage = new ShellView();
            }
            //MainPage = new TestPage();
            //MainPage = new Calculation();
        }
        public ShellPage(IGestureService gestureService, IDialogService dialogService)
        {
            InitializeComponent();

            if (win.ApplicationModel.DesignMode.DesignModeEnabled ||
                win.ApplicationModel.DesignMode.DesignMode2Enabled)
            {
                return;
            }

            _gestureService = gestureService;
            _dialogService  = dialogService;

            ShellView.Start();

            ShellView.Loaded += (s, e) =>
            {
                SetupGestures();
                SetupBackButton();
                SetupControlBox();
            };
        }
Exemple #27
0
        private void MainItemGrid_OnTap(object sender, GestureEventArgs e)
        {
            TapedItem = (FrameworkElement)sender;

            if (!(TapedItem.DataContext is TLUserContact))
            {
                return;
            }

            if (!(TapedItem.RenderTransform is CompositeTransform))
            {
                TapedItem.RenderTransform = new CompositeTransform();
            }

            var listBoxItem = TapedItem.FindParentOfType <ListBoxItem>();

            ShellView.StartContinuumForwardOutAnimation(TapedItem, listBoxItem);

            Loaded += (o, args) =>
            {
            };
        }
Exemple #28
0
        public void ShowFloating(Action whenDoneAction)
        {
            if (Owner != null)
            {
                //Owner.ForceCursor = true;

                Owner.Cursor = Cursors.Wait;
                this.Cursor  = Cursors.Wait;
            }

            if (ShellView != null)
            {
                ShellView.RaiseEscapeEvent();
            }

            m_whenDoneAction = whenDoneAction;

            ensureVisible();

            ShowInTaskbar = true;

            ActiveAware.IsActive = true;

            try
            {
                Show();
            }
            catch
            {
                if (Owner != null)
                {
                    //Owner.ForceCursor = true;

                    Owner.Cursor = Cursors.Arrow;
                    this.Cursor  = Cursors.Arrow;
                }
            }
        }
Exemple #29
0
        public ShellViewModel()
        {
            SelectedProfile         = null;
            _mainWindow             = new ShellView();
            _mainWindow.Topmost     = Configuration.Instance.AlwaysOnTop;
            _mainWindow.DataContext = this;
            _mainWindow.Show();
            if (Configuration.Instance.LaunchProfileId != 0)
            {
                SelectedProfile = Configuration.ProfileById(Configuration.Instance.LaunchProfileId);
                _launchAndMove(null);
            }
            if (Configuration.Instance.LastOpenProfileId != 0)
            {
                SelectedProfile = Configuration.ProfileById(Configuration.Instance.LastOpenProfileId);
            }
            GithubUpdater updater = new GithubUpdater();

            if (Configuration.Instance.CheckForUpdates)
            {
                updater.LaunchUpdaterAsync();
            }
        }
Exemple #30
0
        private void diagramXmlParseBody_(XmlNode diagramElementNode, string xmlFilePath, TreeNode treeNode, int objectIndex)
        {
            string diagramElementName = diagramElementNode.Name;

            AlternateContent           altContent     = treeNode.Presentation.AlternateContentFactory.CreateAlternateContent();
            AlternateContentAddCommand cmd_AltContent =
                treeNode.Presentation.CommandFactory.CreateAlternateContentAddCommand(treeNode, altContent);

            treeNode.Presentation.UndoRedoManager.Execute(cmd_AltContent);



            Metadata diagramElementName_Metadata = treeNode.Presentation.MetadataFactory.CreateMetadata();

            diagramElementName_Metadata.NameContentAttribute              = new MetadataAttribute();
            diagramElementName_Metadata.NameContentAttribute.Name         = DiagramContentModelHelper.DiagramElementName;
            diagramElementName_Metadata.NameContentAttribute.NamespaceUri = null;
            diagramElementName_Metadata.NameContentAttribute.Value        = diagramElementName;
            AlternateContentMetadataAddCommand cmd_AltContent_diagramElementName_Metadata =
                treeNode.Presentation.CommandFactory.CreateAlternateContentMetadataAddCommand(
                    treeNode,
                    null,
                    altContent,
                    diagramElementName_Metadata,
                    null
                    );

            treeNode.Presentation.UndoRedoManager.Execute(cmd_AltContent_diagramElementName_Metadata);


            if (diagramElementNode.Attributes != null)
            {
                for (int i = 0; i < diagramElementNode.Attributes.Count; i++)
                {
                    XmlAttribute attribute = diagramElementNode.Attributes[i];


                    if (attribute.Name.StartsWith(XmlReaderWriterHelper.NS_PREFIX_XMLNS + ":"))
                    {
                        //
                    }
                    else if (attribute.Name == XmlReaderWriterHelper.NS_PREFIX_XMLNS)
                    {
                        //
                    }
                    else if (attribute.Name == DiagramContentModelHelper.TOBI_Audio)
                    {
                        string fullPath = null;
                        if (FileDataProvider.isHTTPFile(attribute.Value))
                        {
                            fullPath = FileDataProvider.EnsureLocalFilePathDownloadTempDirectory(attribute.Value);
                        }
                        else
                        {
                            fullPath = Path.Combine(Path.GetDirectoryName(xmlFilePath), attribute.Value);
                        }
                        if (fullPath != null && File.Exists(fullPath))
                        {
                            string extension = Path.GetExtension(fullPath);

                            bool isWav = extension.Equals(DataProviderFactory.AUDIO_WAV_EXTENSION, StringComparison.OrdinalIgnoreCase);

                            AudioLibPCMFormat wavFormat = null;
                            if (isWav)
                            {
                                Stream fileStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                                try
                                {
                                    uint dataLength;
                                    wavFormat = AudioLibPCMFormat.RiffHeaderParse(fileStream, out dataLength);
                                }
                                finally
                                {
                                    fileStream.Close();
                                }
                            }
                            string originalFilePath = null;

                            DebugFix.Assert(treeNode.Presentation.MediaDataManager.EnforceSinglePCMFormat);

                            bool wavNeedsConversion = false;
                            if (wavFormat != null)
                            {
                                wavNeedsConversion = !wavFormat.IsCompatibleWith(treeNode.Presentation.MediaDataManager.DefaultPCMFormat.Data);
                            }
                            if (!isWav || wavNeedsConversion)
                            {
                                originalFilePath = fullPath;

                                var audioFormatConvertorSession =
                                    new AudioFormatConvertorSession(
                                        //AudioFormatConvertorSession.TEMP_AUDIO_DIRECTORY,
                                        treeNode.Presentation.DataProviderManager.DataFileDirectoryFullPath,
                                        treeNode.Presentation.MediaDataManager.DefaultPCMFormat,
                                        false,
                                        m_UrakawaSession.IsAcmCodecsDisabled);

                                //filePath = m_AudioFormatConvertorSession.ConvertAudioFileFormat(filePath);

                                bool cancelled = false;

                                var converter = new AudioClipConverter(audioFormatConvertorSession, fullPath);

                                bool error = ShellView.RunModalCancellableProgressTask(true,
                                                                                       "Converting audio...",
                                                                                       converter,
                                                                                       () =>
                                {
                                    m_Logger.Log(@"Audio conversion CANCELLED", Category.Debug, Priority.Medium);
                                    cancelled = true;
                                },
                                                                                       () =>
                                {
                                    m_Logger.Log(@"Audio conversion DONE", Category.Debug, Priority.Medium);
                                    cancelled = false;
                                });

                                if (cancelled)
                                {
                                    //DebugFix.Assert(!result);
                                    break;
                                }

                                fullPath = converter.ConvertedFilePath;
                                if (string.IsNullOrEmpty(fullPath))
                                {
                                    break;
                                }

                                m_Logger.Log(string.Format("Converted audio {0} to {1}", originalFilePath, fullPath),
                                             Category.Debug, Priority.Medium);

                                //Stream fileStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                                //try
                                //{
                                //    uint dataLength;
                                //    wavFormat = AudioLibPCMFormat.RiffHeaderParse(fileStream, out dataLength);
                                //}
                                //finally
                                //{
                                //    fileStream.Close();
                                //}
                            }


                            ManagedAudioMedia manAudioMedia  = treeNode.Presentation.MediaFactory.CreateManagedAudioMedia();
                            AudioMediaData    audioMediaData = treeNode.Presentation.MediaDataFactory.CreateAudioMediaData(DataProviderFactory.AUDIO_WAV_EXTENSION);
                            manAudioMedia.AudioMediaData = audioMediaData;

                            FileDataProvider dataProv = (FileDataProvider)treeNode.Presentation.DataProviderFactory.Create(DataProviderFactory.AUDIO_WAV_MIME_TYPE);
                            dataProv.InitByCopyingExistingFile(fullPath);
                            audioMediaData.AppendPcmData(dataProv);

                            //                            Stream wavStream = null;
                            //                            try
                            //                            {
                            //                                wavStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read);

                            //                                uint dataLength;
                            //                                AudioLibPCMFormat pcmInfo = AudioLibPCMFormat.RiffHeaderParse(wavStream, out dataLength);

                            //                                if (!treeNode.Presentation.MediaDataManager.DefaultPCMFormat.Data.IsCompatibleWith(pcmInfo))
                            //                                {
                            //#if DEBUG
                            //                                    Debugger.Break();
                            //#endif //DEBUG
                            //                                    wavStream.Close();
                            //                                    wavStream = null;

                            //                                    var audioFormatConvertorSession =
                            //                                        new AudioFormatConvertorSession(
                            //                                        //AudioFormatConvertorSession.TEMP_AUDIO_DIRECTORY,
                            //                                        treeNode.Presentation.DataProviderManager.DataFileDirectoryFullPath,
                            //                                    treeNode.Presentation.MediaDataManager.DefaultPCMFormat, m_UrakawaSession.IsAcmCodecsDisabled);

                            //                                    string newfullWavPath = audioFormatConvertorSession.ConvertAudioFileFormat(fullPath);

                            //                                    FileDataProvider dataProv = (FileDataProvider)treeNode.Presentation.DataProviderFactory.Create(DataProviderFactory.AUDIO_WAV_MIME_TYPE);
                            //                                    dataProv.InitByMovingExistingFile(newfullWavPath);
                            //                                    audioMediaData.AppendPcmData(dataProv);
                            //                                }
                            //                                else // use original wav file by copying it to data directory
                            //                                {
                            //                                    FileDataProvider dataProv = (FileDataProvider)treeNode.Presentation.DataProviderFactory.Create(DataProviderFactory.AUDIO_WAV_MIME_TYPE);
                            //                                    dataProv.InitByCopyingExistingFile(fullPath);
                            //                                    audioMediaData.AppendPcmData(dataProv);
                            //                                }
                            //                            }
                            //                            finally
                            //                            {
                            //                                if (wavStream != null) wavStream.Close();
                            //                            }



                            AlternateContentSetManagedMediaCommand cmd_AltContent_diagramElement_Audio =
                                treeNode.Presentation.CommandFactory.CreateAlternateContentSetManagedMediaCommand(treeNode, altContent, manAudioMedia);
                            treeNode.Presentation.UndoRedoManager.Execute(cmd_AltContent_diagramElement_Audio);

                            //SetDescriptionAudio(altContent, audio, treeNode);
                        }
                    }
                    else
                    {
                        Metadata diagramElementAttribute_Metadata = treeNode.Presentation.MetadataFactory.CreateMetadata();
                        diagramElementAttribute_Metadata.NameContentAttribute              = new MetadataAttribute();
                        diagramElementAttribute_Metadata.NameContentAttribute.Name         = attribute.Name;
                        diagramElementAttribute_Metadata.NameContentAttribute.NamespaceUri = attribute.NamespaceURI;
                        diagramElementAttribute_Metadata.NameContentAttribute.Value        = attribute.Value;
                        AlternateContentMetadataAddCommand cmd_AltContent_diagramElementAttribute_Metadata =
                            treeNode.Presentation.CommandFactory.CreateAlternateContentMetadataAddCommand(
                                treeNode,
                                null,
                                altContent,
                                diagramElementAttribute_Metadata,
                                null
                                );
                        treeNode.Presentation.UndoRedoManager.Execute(
                            cmd_AltContent_diagramElementAttribute_Metadata);
                    }
                }
            }

            int nObjects = -1;

            XmlNode textNode = diagramElementNode;

            if (diagramElementName == DiagramContentModelHelper.D_SimplifiedImage ||
                diagramElementName == DiagramContentModelHelper.D_Tactile)
            {
                string  localTourName = DiagramContentModelHelper.StripNSPrefix(DiagramContentModelHelper.D_Tour);
                XmlNode tour          =
                    XmlDocumentHelper.GetFirstChildElementOrSelfWithName(diagramElementNode, false,
                                                                         localTourName,
                                                                         DiagramContentModelHelper.NS_URL_DIAGRAM);
                textNode = tour;

                IEnumerable <XmlNode> objects = XmlDocumentHelper.GetChildrenElementsOrSelfWithName(diagramElementNode, false,
                                                                                                    DiagramContentModelHelper.
                                                                                                    Object,
                                                                                                    DiagramContentModelHelper.
                                                                                                    NS_URL_ZAI, false);
                nObjects = 0;
                foreach (XmlNode obj in objects)
                {
                    nObjects++;
                }

                int i = -1;
                foreach (XmlNode obj in objects)
                {
                    i++;
                    if (i != objectIndex)
                    {
                        continue;
                    }

                    if (obj.Attributes == null || obj.Attributes.Count <= 0)
                    {
                        break;
                    }

                    for (int j = 0; j < obj.Attributes.Count; j++)
                    {
                        XmlAttribute attribute = obj.Attributes[j];


                        if (attribute.Name.StartsWith(XmlReaderWriterHelper.NS_PREFIX_XMLNS + ":"))
                        {
                            //
                        }
                        else if (attribute.Name == XmlReaderWriterHelper.NS_PREFIX_XMLNS)
                        {
                            //
                        }
                        else if (attribute.Name == DiagramContentModelHelper.Src)
                        {
                            //
                        }
                        else if (attribute.Name == DiagramContentModelHelper.SrcType)
                        {
                            //
                        }
                        else
                        {
                            Metadata diagramElementAttribute_Metadata = treeNode.Presentation.MetadataFactory.CreateMetadata();
                            diagramElementAttribute_Metadata.NameContentAttribute              = new MetadataAttribute();
                            diagramElementAttribute_Metadata.NameContentAttribute.Name         = attribute.Name;
                            diagramElementAttribute_Metadata.NameContentAttribute.NamespaceUri = attribute.NamespaceURI;
                            diagramElementAttribute_Metadata.NameContentAttribute.Value        = attribute.Value;
                            AlternateContentMetadataAddCommand cmd_AltContent_diagramElementAttribute_Metadata =
                                treeNode.Presentation.CommandFactory.CreateAlternateContentMetadataAddCommand(
                                    treeNode,
                                    null,
                                    altContent,
                                    diagramElementAttribute_Metadata,
                                    null
                                    );
                            treeNode.Presentation.UndoRedoManager.Execute(
                                cmd_AltContent_diagramElementAttribute_Metadata);
                        }
                    }

                    XmlAttribute srcAttr = (XmlAttribute)obj.Attributes.GetNamedItem(DiagramContentModelHelper.Src);
                    if (srcAttr != null)
                    {
                        XmlAttribute srcType =
                            (XmlAttribute)obj.Attributes.GetNamedItem(DiagramContentModelHelper.SrcType);

                        ManagedImageMedia img = treeNode.Presentation.MediaFactory.CreateManagedImageMedia();

                        string imgFullPath = null;
                        if (FileDataProvider.isHTTPFile(srcAttr.Value))
                        {
                            imgFullPath = FileDataProvider.EnsureLocalFilePathDownloadTempDirectory(srcAttr.Value);
                        }
                        else
                        {
                            imgFullPath = Path.Combine(Path.GetDirectoryName(xmlFilePath), srcAttr.Value);
                        }
                        if (imgFullPath != null && File.Exists(imgFullPath))
                        {
                            string extension = Path.GetExtension(imgFullPath);

                            ImageMediaData imgData = treeNode.Presentation.MediaDataFactory.CreateImageMediaData(extension);
                            if (imgData != null)
                            {
                                imgData.InitializeImage(imgFullPath, Path.GetFileName(imgFullPath));
                                img.ImageMediaData = imgData;

                                AlternateContentSetManagedMediaCommand cmd_AltContent_Image =
                                    treeNode.Presentation.CommandFactory.CreateAlternateContentSetManagedMediaCommand(
                                        treeNode, altContent, img);
                                treeNode.Presentation.UndoRedoManager.Execute(cmd_AltContent_Image);
                            }
                        }
                    }
                }
            }

            if (textNode != null)
            {
                string strText = textNode.InnerXml;

                if (!string.IsNullOrEmpty(strText))
                {
                    strText = strText.Trim();
                    strText = Regex.Replace(strText, @"\s+", " ");
                    strText = strText.Replace("\r\n", "\n");
                }

                if (!string.IsNullOrEmpty(strText))
                {
                    TextMedia txtMedia = treeNode.Presentation.MediaFactory.CreateTextMedia();
                    txtMedia.Text = strText;
                    AlternateContentSetManagedMediaCommand cmd_AltContent_Text =
                        treeNode.Presentation.CommandFactory.CreateAlternateContentSetManagedMediaCommand(treeNode,
                                                                                                          altContent,
                                                                                                          txtMedia);
                    treeNode.Presentation.UndoRedoManager.Execute(cmd_AltContent_Text);
                }
            }

            if (nObjects > 0 && ++objectIndex <= nObjects - 1)
            {
                diagramXmlParseBody_(diagramElementNode, xmlFilePath, treeNode, objectIndex);
            }
        }
 public ShellView()
 {
     InitializeComponent();
     View = this;
 }
Exemple #32
0
 public ShellView()
 {
     InitializeComponent();
     View = this;
 }
Exemple #33
0
 public void Loaded(ShellView view)
 {
 }
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     ShellView = (ShellView)Locator.Current.GetService<IViewFor<ShellViewModel>>();
     ShellView.Show();
 }
Exemple #35
0
 public void Initialize(ShellView shellView)
 {
     _shellView = shellView;
 }
        protected override DependencyObject CreateShell()
        {
            this.view = this.Container.TryResolve<ShellView>();
            this.view.Show();

            return this.view;
        }
 public ShellView()
 {
     CurrentInstance = this;
     InitializeComponent();
 }
 public GuiInteractionService(ShellView shellView)
 {
     ShellView = shellView;
 }