Esempio n. 1
0
        public void OnNavigatedTo(FirstFloor.ModernUI.Windows.Navigation.NavigationEventArgs e)
        {
            if (IDEProject.inst() == null)
            {
                IDEProject.open();
                System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    IDEProject.inst().Settings   = IDESettings.GetOrCreate(dlg.SelectedPath);
                    IDEProject.inst().ProjectDir = dlg.SelectedPath;
                    UserData.inst().AddRecentFile(dlg.SelectedPath);
                }
                else
                {
                    MainWindow.inst().ContentSource = new Uri("Screens/LaunchScreen.xaml", UriKind.Relative);
                    IDEProject.inst().destroy();
                    return;
                }
            }

            if (IDEProject.inst() == null)
            {
                project_ = new IDEProject();
            }
            else
            {
                project_ = IDEProject.inst();
            }
            if (folder_ == null)
            {
                folder_ = new Folder {
                    Path = project_.ProjectDir
                }
            }
            ;
            fileTree.DataContext         = folder_;
            objectTree.DataContext       = IDEProject.inst();
            txtConsole.DataContext       = IDEProject.inst();
            gridErrors.DataContext       = IDEProject.inst();
            errorTabCount.DataContext    = IDEProject.inst();
            stackErrorHeader.DataContext = IDEProject.inst();

            eventsDoc.Tree.DataContext = IDEProject.inst().Documentation.DocumentNode.Children[0];
            eventsDoc.CommandText      = new string[] { "Copy Subscription", "Copy Unsubscription" };
            eventsDoc.CommandFormats   = new string[] { "SubscribeToEvent(\"{0}\",\"Handle{0}\");", "UnsubscribeFromEvent(\"Handle{0}\");" };
            eventsDoc.LowerText        = new string[] { "Copy event getter" };
            eventsDoc.LowerCommands    = new string[] { "eventData[\"{0}\"];" };

            attrDoc.Tree.DataContext   = IDEProject.inst().Documentation.DocumentNode.Children[1];
            scriptDoc.Tree.DataContext = IDEProject.inst().Documentation.DocumentNode.Children[2];
            //eventsDoc.MiddleMenuBuilder = new Controls.EventSubscriptionDocMenu();
            //eventsDoc.BottomMenuBuilder = new Controls.EventDataDocMenu();
            //eventsDoc.Root = IDEProject.inst().Documentation.DocumentNode.Children[0];
            //attrDoc.Shallow = true;
            //attrDoc.MiddleMenuBuilder = new Controls.AttrDocMenu();
            //attrDoc.Root = IDEProject.inst().Documentation.DocumentNode.Children[1];
            //scriptDoc.Shallow = true;
            //scriptDoc.Root = IDEProject.inst().Documentation.DocumentNode.Children[2];
        }
Esempio n. 2
0
 public bool NewProject()
 {
     Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
     dlg.DefaultExt = "prj";
     dlg.Filter     = "Project files (*.prj)|*.prj";
     if (dlg.ShowDialog() == true)
     {
         IDEProject prj = new IDEProject()
         {
             FilePath = dlg.FileName, ProjectDir = Path.GetDirectoryName(dlg.FileName)
         };
         prj.Settings = IDESettings.GetOrCreate(dlg.FileName);
         prj.Save();
         UserData.inst().AddRecentFile(dlg.FileName);
     }
     return(false);
 }
        public void OnNavigatedTo(FirstFloor.ModernUI.Windows.Navigation.NavigationEventArgs e)
        {
            if (e.NavigationType == FirstFloor.ModernUI.Windows.Navigation.NavigationType.New)
            {
                if (IDEProject.inst() == null)
                {
                    IDEProject.open();
                    System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        IDEProject.inst().Settings   = IDESettings.GetOrCreate(dlg.SelectedPath);
                        IDEProject.inst().ProjectDir = dlg.SelectedPath;
                        UserData.inst().AddRecentFile(dlg.SelectedPath);
                    }
                    else
                    {
                        MainWindow.inst().ContentSource = new Uri("Screens/LaunchScreen.xaml", UriKind.Relative);
                        IDEProject.inst().destroy();
                        return;
                    }
                }

                if (IDEProject.inst() == null)
                {
                    project_ = new IDEProject();
                }
                else
                {
                    project_ = IDEProject.inst();
                }
                if (folder_ == null)
                {
                    folder_ = new Folder {
                        Path = project_.ProjectDir
                    }
                }
                ;
                if (fileTree.DataContext == null)
                {
                    fileTree.DataContext = folder_;
                }
                Action <object> searchAction = delegate(object o)
                {
                    if (o == null)
                    {
                        return;
                    }
                    leftSideTabs.SelectedItem = classesTab;
                    objectTree.SelectItemNamed(((PropInfo)o).Type.Name);
                };
                objectTree.DataContext    = IDEProject.inst();
                objectTree.ItemBinding    = new Binding("GlobalTypes.TypeInfo");
                objectTree.CallOnViewType = searchAction;

                globalsTree.DataContext    = IDEProject.inst();
                globalsTree.CallOnViewType = searchAction;
                globalsTree.ItemBinding    = new Binding("GlobalTypes.UIView");

                localsTree.DataContext    = IDEProject.inst();
                localsTree.CallOnViewType = searchAction;
                localsTree.ItemBinding    = new Binding("LocalTypes.AllUIView");

                txtConsole.DataContext       = IDEProject.inst();
                gridErrors.DataContext       = IDEProject.inst();
                errorTabCount.DataContext    = IDEProject.inst();
                stackErrorHeader.DataContext = IDEProject.inst();

                if (infoTabs.Items.Count == 0)
                {
                    foreach (PluginLib.IInfoTab infoTab in PluginManager.inst().InfoTabs)
                    {
                        PluginLib.IExternalControlData data = infoTab.CreateTabContent(IDEProject.inst().ProjectDir);
                        if (data == null)
                        {
                            continue;
                        }
                        TabItem item = new TabItem
                        {
                            Header  = infoTab.GetTabName(),
                            Tag     = data,
                            Content = data.Control
                        };
                        infoTabs.Items.Add(item);
                    }
                }
            }
            else
            {
                infoTabs.Items.Clear();
            }
        }