当前位置: 首页>>代码示例>>C#>>正文


C# Boss.Get方法代码示例

本文整理汇总了C#中Boss.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Boss.Get方法的具体用法?C# Boss.Get怎么用?C# Boss.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Boss的用法示例。


在下文中一共展示了Boss.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TextController

        public TextController(string bossName)
            : base(NSObject.AllocAndInitInstance("TextController"))
        {
            m_boss = ObjectModel.Create(bossName);
            Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("text-editor"), this);

            m_textView = new IBOutlet<NSTextView>(this, "textView");
            m_lineLabel = new IBOutlet<NSButton>(this, "lineLabel");
            m_decPopup = new IBOutlet<NSPopUpButton>(this, "decsPopup");
            m_scrollView = new IBOutlet<NSScrollView>(this, "scrollView");
            m_restorer = new RestoreViewState(this);

            var wind = m_boss.Get<IWindow>();
            wind.Window = window();

            m_applier = new ApplyStyles(this, m_textView.Value);
            DoSetTextOptions();

            Broadcaster.Register("text default color changed", this);
            Broadcaster.Register("languages changed", this);
            Broadcaster.Register("directory prefs changed", this);
            DoUpdateDefaultColor(string.Empty, null);

            m_textView.Value.Call("onOpened:", this);

            ActiveObjects.Add(this);
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:27,代码来源:TextController.cs

示例2: GetDatabasePath

        public static string GetDatabasePath(Boss boss)
        {
            var editor = boss.Get<IDirectoryEditor>();
            string name = Path.GetFileName(editor.Path);

            string path = Paths.GetAssemblyDatabase(name);

            return path;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:9,代码来源:Populate.cs

示例3: ShortForm

        public ShortForm(Boss boss, TextWriter writer)
        {
            m_boss = boss;
            m_writer = writer;

            var editor = m_boss.Get<IDirectoryEditor>();
            m_addSpace = editor.AddSpace;
            m_addBraceLine = editor.AddBraceLine;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:9,代码来源:ShortForm.cs

示例4: GetDirectoryEditor

        public Boss GetDirectoryEditor(Boss window)
        {
            Boss result = null;

            if (window != null)
            {
                if (window.Has<IDirectoryEditor>())
                {
                    result = window;
                }
                else if (window.Has<ITextEditor>())
                {
                    result = DoFindAssociatedBoss(window.Get<ITextEditor>());
                }
            }

            if (result == null)
            {
                result = DoFindDefaultBoss();
            }

            return result;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:23,代码来源:FindDirectoryEditor.cs

示例5: DoExecute

        private void DoExecute(Boss boss)
        {
            var editor = boss.Get<ITextEditor>();
            if (editor.Path != null)
            {
                var text = boss.Get<IText>();

                Boss b = ObjectModel.Create("CsParser");
                var parses = b.Get<IParses>();
                Parse parse = parses.Parse(editor.Key, text.EditCount, text.Text);
                if (parse.ErrorLength == 0 && parse.Globals != null)
                {
                    NSRange sel = text.Selection;
                    string type = text.Text.Substring(sel.location, sel.length);
                    string ns = DoGetNamespace(boss, type);
                    if (ns != null)
                    {
                        b = ObjectModel.Create("Refactors");
                        var refactors = b.Get<IRefactors>();

                        refactors.Init(text.Text);
                        refactors.QueueAddUsing(parse.Globals, ns);
                        string result = refactors.Process();

                        if (result != text.Text)
                        {
                            text.Replace(result, 0, text.Text.Length, "Resolve Namespace");
                        }
                    }
                }
            }
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:32,代码来源:ResolveNamespace.cs

示例6: DoAddTitle

 private void DoAddTitle(Boss boss)
 {
     if (boss.Has<ITextEditor>() && !boss.Has<IDocumentWindowTitle>())
     {
         var editor = boss.Get<ITextEditor>();
         if (editor.Path != null && editor.Path.StartsWith(m_timeMachineDir))
         {
             boss.ExtendWithInterface(typeof(TimeMachineWindowTitle), typeof(IDocumentWindowTitle));
         }
     }
 }
开发者ID:andyhebear,项目名称:Continuum,代码行数:11,代码来源:TimeMachine.cs

示例7: Instantiated

        public void Instantiated(Boss boss)
        {
            m_boss = boss;

            m_root = DoGetRoot();
            m_timeMachineDir = DoGetTimeMachineDir();

            if (m_timeMachineDir != null)
            {
                boss = ObjectModel.Create("Application");
                var handler = boss.Get<IMenuHandler>();

                handler.Register(this, 43, this.DoOpen, this.DoCanOpen);
                Broadcaster.Register("opening document window", this);
                Broadcaster.Register("document path changed", this);
                Broadcaster.Register("closed document window", this);
            }
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:18,代码来源:TimeMachine.cs

示例8: DoGetLineAtSelection

        private int DoGetLineAtSelection(Boss boss)
        {
            var text = boss.Get<IText>();
            int offset = text.Selection.location;

            var metrics = boss.Get<ITextMetrics>();
            int line = metrics.GetLine(offset);

            return line;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:10,代码来源:Breakpoints.cs

示例9: DoGetFile

        private string DoGetFile(Boss boss)
        {
            var editor = boss.Get<ITextEditor>();
            string file = null;
            if (boss.Has<ICodeViewer>())
            {
                var viewer = boss.Get<ICodeViewer>();
                file = viewer.Path;
            }
            else
            {
                file = editor.Path;
            }

            return file;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:16,代码来源:Breakpoints.cs

示例10: DoCreateBreakpoint

        private ITextAnnotation DoCreateBreakpoint(Boss boss, string file, int line)
        {
            var metrics = boss.Get<ITextMetrics>();
            var range = new NSRange(metrics.GetLineOffset(line), 1);

            var bp = new Breakpoint(file, line);

            var editor = boss.Get<ITextEditor>();
            ITextAnnotation annotation = editor.GetAnnotation(range, AnnotationAlignment.Center);
            annotation.BackColor = m_resolved.Contains(bp) ? ms_resolvedColor : ms_unresolvedColor;
            annotation.Text = "B";
            annotation.Draggable = false;
            annotation.Visible = true;

            return annotation;
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:16,代码来源:Breakpoints.cs

示例11: DoExecute

		private void DoExecute(Boss boss)
		{
			var editor = boss.Get<ITextEditor>();
			if (editor.Path != null)
			{
				var text = boss.Get<IText>();
				NSRange range = text.Selection;
				if (range.length == 0)
					throw new OperationCanceledException("Selection is empty");
				
				// Note that we don't use ICachedCsDeclarations here because we want 
				// to ensure that the text is well formed. TODO: there's a malformed
				// flag now though so we can use this if the editCount is current.
				Boss b = ObjectModel.Create("CsParser");
				var parses = b.Get<IParses>();
				Parse parse = parses.Parse(editor.Key, text.EditCount, text.Text);
				if (parse.ErrorLength == 0 && parse.Globals != null)
				{
					CsGlobalNamespace globals = parse.Globals;
					CsDeclaration first = DoFindDeclaration(globals, range.location, range.length);
					string name = DoGetName(first);
					
					string path = DoGetPath(editor.Path, name + ".cs");
					if (path != null)
					{
						var builder = new StringBuilder();
						name = Path.GetFileNameWithoutExtension(path);
						
						DoBuildNewFile(name, globals, first, builder, text.Text, range.location, range.length);
						b = ObjectModel.Create("Refactor");
						var script = b.Get<IRefactorScript>();
						string contents = script.Expand(text.Boss, builder.ToString());
						
						File.WriteAllText(path, contents, Encoding.UTF8);
						text.Replace(string.Empty, range.location, range.length, "Cut");
					}
				}
			}
		}
开发者ID:andyhebear,项目名称:Continuum,代码行数:39,代码来源:MoveSelectionToFile.cs

示例12: Instantiated

        public void Instantiated(Boss boss)
        {
            m_boss = boss;

            boss = ObjectModel.Create("Application");
            var handler = boss.Get<IMenuHandler>();

            handler.Register(this, 41, this.DoFindOnApple, this.DoNeedsFindOnApple);
            handler.Register(this, 42, this.DoFindOnMSDN, this.DoNeedsFindOnMSDN);
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:10,代码来源:FindOnSites.cs

示例13: Populate

        public void Populate(NSMenu menu, NSTextView view, Boss window)
        {
            // ITextContextCommands expect that the main window is the one the user
            // is working with.
            view.window().makeKeyAndOrderFront(view);

            // We don't extend the default menu because it has tons of stuff that we
            // don't really want. But we should add the services...
            //			NSMenu menu = SuperCall("menuForEvent:", evt).To<NSMenu>();
            //			menu.addItem(NSMenuItem.separatorItem());

            try
            {
                // Get the selection.
                m_view = view;
                m_range = view.selectedRange();
                m_selection = null;
                if (m_range.length > 0)
                    view.string_().getCharacters_range(m_range, out m_selection);

                // Get the language.
                string language = null;
                if (window.Has<ITextEditor>())
                {
                    var editor = window.Get<ITextEditor>();
                    language = editor.Language;
                }

                // Get the commands.
                var watch = new Stopwatch();
                watch.Start();
                m_entries.Clear();
                if (window != null)
                    DoGetEntries(view, m_selection, language, window);
                DoGetEntries(view, m_selection, language, m_boss);

                if (m_entries.Count == 0)
                {
                    if (window != null)
                        DoGetEntries(view, null, language, window);
                    DoGetEntries(view, null, language, m_boss);
                }
                Log.WriteLine("ContextMenu", "took {0:0.000} secs to open the menu", watch.ElapsedMilliseconds/1000.0);

                m_entries.Sort(this.DoCompareEntry);

                // Remove duplicate separators and any at the start or end.
                for (int i = m_entries.Count - 1; i > 0; --i)
                {
                    if (m_entries[i].Command.Name == null && m_entries[i - 1].Command.Name == null)
                        m_entries.RemoveAt(i);
                }
                while (m_entries.Count > 0 && m_entries[0].Command.Name == null)
                    m_entries.RemoveAt(0);
                while (m_entries.Count > 0 && m_entries[m_entries.Count - 1].Command.Name == null)
                    m_entries.RemoveAt(m_entries.Count - 1);

                // Build the menu.
                menu.removeAllItems();
                for (int i = 0; i < m_entries.Count; ++i)
                {
                    NSMenuItem item = null;

                    if (m_entries[i].Command.Name != null)
                    {
                        if (m_entries[i].Command.Name != Constants.Ellipsis)
                        {
                            item = NSMenuItem.Create(m_entries[i].Command.Name, "dispatchTextContextMenu:");

                            if (m_entries[i].Command.Title != null)
                                item.setAttributedTitle(m_entries[i].Command.Title);
                        }
                        else
                            item = NSMenuItem.Create(Constants.Ellipsis);
                        item.setTag(i);
                    }
                    else
                    {
                        Contract.Assert(m_entries[i].Command.Handler == null, "names is null, but handlers is not");
                        item = NSMenuItem.separatorItem();
                    }

                    if (item != null)
                        menu.addItem(item);
                }
            }
            catch (DatabaseLockedException)
            {
                NSString title = NSString.Create("Database was locked.");
                NSString message = NSString.Create("Try again.");
                Unused.Value = Functions.NSRunAlertPanel(title, message);
            }
            catch (Exception e)
            {
                Log.WriteLine(TraceLevel.Error, "App", "Error building context menu:");
                Log.WriteLine(TraceLevel.Error, "App", "{0}", e);

                NSString title = NSString.Create("Error building the menu.");
                NSString message = NSString.Create(e.Message);
                Unused.Value = Functions.NSRunAlertPanel(title, message);
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:Continuum,代码行数:101,代码来源:BuildTextContextMenu.cs

示例14: Instantiated

        public void Instantiated(Boss boss)
        {
            m_boss = boss;
            m_text = m_boss.Get<IText>();
            m_tokens = m_boss.Get<ISearchTokens>();

            boss = ObjectModel.Create("CsParser");
            m_locals = boss.Get<ICsLocalsParser>();
            m_parses = boss.Get<IParses>();
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:10,代码来源:AutoComplete.cs

示例15: DirectoryController

        public DirectoryController(string path)
            : base(NSObject.AllocAndInitInstance("DirectoryController"))
        {
            m_boss = ObjectModel.Create("DirectoryEditor");
            m_path = path;
            m_dirStyler = new DirectoryItemStyler(path);

            Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("directory-editor"), this);
            m_table = new IBOutlet<NSOutlineView>(this, "table").Value;
            m_targets = new IBOutlet<NSPopUpButton>(this, "targets").Value;
            m_prefs = new IBOutlet<DirPrefsController>(this, "prefsController");

            m_name = System.IO.Path.GetFileName(path);
            window().setTitle(NSString.Create(m_name));
            Unused.Value = window().setFrameAutosaveName(NSString.Create(window().title().ToString() + " editor"));
            window().makeKeyAndOrderFront(this);

            m_table.setDoubleAction("doubleClicked:");
            m_table.setTarget(this);

            var wind = m_boss.Get<IWindow>();
            wind.Window = window();

            m_builder = new GenericBuilder(path);

            m_targets.removeAllItems();
            if (m_builder.CanBuild)
            {
                var handler = m_boss.Get<IMenuHandler>();
                handler.Register(this, 50, this.DoBuild, this.DoBuildEnabled);
                handler.Register(this, 51, this.DoBuildVariables, this.DoHaveBuilder);
                handler.Register(this, 52, this.DoBuildFlags, this.DoHaveBuilder);
                handler.Register(this, 599, () => m_builder.Cancel(), this.DoCancelEnabled);
                handler.Register(this, 1000, this.DoShowPrefs);

                DoLoadPrefs(path);
                Broadcaster.Register("global ignores changed", this);
                Broadcaster.Register("finished building", this);
                DoUpdateTargets(string.Empty, null);
            }
            else
                DoLoadPrefs(path);

            m_root = new FolderItem(m_path, m_dirStyler, this);
            m_table.reloadData();

            m_watcher = DoCreateWatcher(path);
            if (m_watcher != null)
                m_watcher.Changed += this.DoDirChanged;

            //			m_watcher = new FileSystemWatcher(path);
            //			m_watcher.IncludeSubdirectories = true;
            //			m_watcher.Created += this.DoDirChanged;
            //			m_watcher.Deleted += this.DoDirChanged;
            //			m_watcher.Renamed += this.DoDirChanged;

            foreach (IOpened open in m_boss.GetRepeated<IOpened>())
            {
                open.Opened();
            }
            Broadcaster.Invoke("opened directory", m_boss);

            ActiveObjects.Add(this);
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:64,代码来源:DirectoryController.cs


注:本文中的Boss.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。