Esempio n. 1
0
 void templateLoaded(object sender, TemplateOpenEventArgs e)
 {
     if (TemplateLoaded != null)
     {
         TemplateLoaded.Invoke(sender, e);
     }
 }
Esempio n. 2
0
        private void TemplateItemDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var infos = ((KeyValuePair <string, string>)((FrameworkElement)sender).Tag);

            if (infos.Key != null && Path.GetExtension(infos.Key) != null)
            {
                var fileExt = Path.GetExtension(infos.Key).ToLower().Substring(1);
                if (ComponentInformations.EditorExtension != null && ComponentInformations.EditorExtension.ContainsKey(fileExt))
                {
                    Type    editorType = ComponentInformations.EditorExtension[fileExt];
                    TabInfo info       = new TabInfo();
                    if (sender is CTTreeViewItem)
                    {
                        var templateItem = (CTTreeViewItem)sender;

                        info = new TabInfo()
                        {
                            Filename = templateItem.File,
                        };
                        //var tooltipInline = ((TextBlock) templateItem.ToolTip).Inlines.FirstOrDefault();
                        //if (tooltipInline != null)
                        //{
                        //    editor.Presentation.ToolTip = new TextBlock(tooltipInline) { TextWrapping = TextWrapping.Wrap, MaxWidth = 400 };
                        //}
                    }
                    else if (sender is ListBoxItem)
                    {
                        var searchItem = (ListBoxItem)sender;
                        info = (TabInfo)((System.Collections.ArrayList)((FrameworkElement)searchItem.Content).Tag)[0];

                        //var tooltipInline = ((TextBlock)searchItem.ToolTip).Inlines.FirstOrDefault();
                        //if (tooltipInline != null)
                        //{
                        //    editor.Presentation.ToolTip = new TextBlock(tooltipInline) { TextWrapping = TextWrapping.Wrap, MaxWidth = 400 };
                        //}
                        //editor.Presentation.Tag = ((Image)((StackPanel)searchItem.Content).Children[0]).Source;
                    }

                    if (TemplateLoaded != null)
                    {
                        TemplateLoaded.Invoke(this, new TemplateOpenEventArgs()
                        {
                            Info = info, Type = editorType
                        });
                    }
                    //OnOpenTab(editor, info, null);     //rename tab header
                    _recentFileList.AddRecentFile(infos.Key);
                }
            }
        }
        private void OpenSelectedTemplate()
        {
            if (RecentFileListBox.SelectedItem == null)
            {
                return;
            }

            var selectedItem = (RecentFileInfo)RecentFileListBox.SelectedItem;

            if (TemplateLoaded != null)
            {
                var info = new TabInfo()
                {
                    Filename = new FileInfo(selectedItem.File)
                };
                TemplateLoaded.Invoke(this, new TemplateOpenEventArgs()
                {
                    Type = typeof(WorkspaceManager.WorkspaceManagerClass), Info = info
                });
            }
            _recentFileList.AddRecentFile(selectedItem.File);
        }