Esempio n. 1
0
 static XrmBooleanEditor()
 {
     BooleanEditor = delegate(EditorArguments args)
     {
         XrmBooleanEditor editor = new XrmBooleanEditor(args);
         return editor;
     };
 }
 static XrmLookupEditor()
 {
     LookupEditor = delegate(EditorArguments args)
     {
         XrmLookupEditor editor = new XrmLookupEditor(args);
         return editor;
     };
 }
Esempio n. 3
0
 static XrmDateEditor()
 {
     CrmDateEditor = delegate(EditorArguments args)
     {
         XrmDateEditor editor = new XrmDateEditor(args);
         return editor;
     };
 }
Esempio n. 4
0
 static XrmDurationEditor()
 {
     DurationEditor = delegate(EditorArguments args)
     {
         XrmDurationEditor editor = new XrmDurationEditor(args);
         return editor;
     };
 }
Esempio n. 5
0
 static XrmOptionSetEditor()
 {
     EditorFactory = delegate(EditorArguments args)
     {
         XrmOptionSetEditor editor = new XrmOptionSetEditor(args);
         return editor;
     };
 }
Esempio n. 6
0
        static XrmMoneyEditor()
        {
            MoneyEditor = delegate(EditorArguments args)
            {
                XrmMoneyEditor editor = new XrmMoneyEditor(args);
                return editor;

            };
        }
Esempio n. 7
0
        static XrmNumberEditor()
        {
            NumberEditor = delegate(EditorArguments args)
            {
                XrmNumberEditor editor = new XrmNumberEditor(args);
                return editor;

            };
        }
        private static void CommentOrUncommentSelection(
            string code,
            IEnumerable <TextChange> expectedChanges,
            IEnumerable <Span> expectedSelectedSpans,
            bool supportBlockComments,
            Operation operation)
        {
            using var disposableView = EditorFactory.CreateView(TestExportProvider.ExportProviderWithCSharpAndVisualBasic, code);
            var selectedSpans = SetupSelection(disposableView.TextView);

            CommentOrUncommentSelection(disposableView.TextView, expectedChanges, expectedSelectedSpans, supportBlockComments, operation);
        }
 protected void Edit_Click(object sender, EventArgs e)
 {
     if (isEditorInline)
     {
         displayControl.Enabled = true;
     }
     else
     {
         var    eType     = editorFactory.GetEditorTypeByEntry(entryElement);
         string panelName = EditorFactory.GetEditorName(eType);
         swooshManager.PushPanel((Swoosh.ISwoosh)editorFactory.CreateEditorForEntry(entryElement), panelName);
     }
 }
Esempio n. 10
0
        //-------------------------------------- 控件 ----------------------------------------------

        /// <summary>
        /// 编辑器,工具栏只包括基本按钮
        /// </summary>
        /// <param name="propertyName">属性名称(也是编辑器名称)</param>
        /// <param name="propertyValue">需要被编辑的内容</param>
        /// <param name="height">编辑器高度(必须手动指定px单位)</param>
        protected void editor(String propertyName, String propertyValue, String height)
        {
            if (ctx.route.isAdmin)
            {
                editorFull(propertyName, propertyValue, height);
                return;
            }

            IEditor ed = EditorFactory.NewOne(propertyName, propertyValue, height, Editor.ToolbarType.Basic);

            ed.AddUploadUrl(ctx);
            set("Editor", ed);
        }
Esempio n. 11
0
        public void SetSite()
        {
            VisualStudioHaskellPackage package = new VisualStudioHaskellPackage();

            //Create the editor factory
            EditorFactory editorFactory = new EditorFactory(package);

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Site the editor factory
            Assert.AreEqual(0, editorFactory.SetSite(serviceProvider), "SetSite did not return S_OK");
        }
Esempio n. 12
0
        // ========================================
        // method
        // ========================================
        public override void Execute()
        {
            var data = EditorFactory.CreateDataObject(_targets);

            var man = _targets.First().Site.EditorCopyExtenderManager;

            foreach (var ext in man.Extenders)
            {
                ext(_targets, data);
            }

            Clipboard.SetDataObject(data, true);
        }
Esempio n. 13
0
        public void MapLogicalViewSupportedIdTest()
        {
            EditorFactory target = editorFactory;

            string pbstrPhysicalView = string.Empty;

            // specify a primary physical view
            Guid rguidLogicalView = VSConstants.LOGVIEWID_Primary;
            int  actual_result    = target.MapLogicalView(ref rguidLogicalView, out pbstrPhysicalView);

            Assert.IsNull(pbstrPhysicalView, "pbstrPhysicalView out parameter not initialized by null");
            Assert.AreEqual(VSConstants.S_OK, actual_result, "In case of supported view ID was expected S_OK result");
        }
Esempio n. 14
0
        public void MapLogicalViewNotSupportedIdTest()
        {
            EditorFactory target = editorFactory;

            string pbstrPhysicalView = string.Empty;

            // specify a not supported view ID
            Guid rguidLogicalView = VSConstants.LOGVIEWID_TextView;
            int  actual_result    = target.MapLogicalView(ref rguidLogicalView, out pbstrPhysicalView);

            Assert.IsNull(pbstrPhysicalView, "pbstrPhysicalView out parameter not initialized by null");
            Assert.AreEqual(VSConstants.E_NOTIMPL, actual_result, "In case of supported view ID was expected E_NOTIMPL result");
        }
Esempio n. 15
0
        public void OpenTab(EditorBrowseInfo browseInfo, bool openCopy, bool makeDirty)
        {
            if (browseInfo == null)
            {
                throw new ArgumentNullException(nameof(browseInfo), Resources.NullParameterErrorMessage);
            }

            TabPage page = null;

            // If we are not opening a copy, always create a new page and do not use an already open page.
            if (!openCopy)
            {
                page = FindTab(browseInfo.SystemType, browseInfo.Id);
            }

            if (page != null)
            {
                tabContent.SelectedTab = page;
            }
            else
            {
                var builder = EditorFactory.Builders[EnumerationExtensions.GetEnum <SystemTypes>((int)browseInfo.SystemType)];
                if (!builder.HasEditor())
                {
                    return;
                }

                // Create a new edit control based on the selected node
                var editControl =
                    EditorFactory.Create(EnumerationExtensions.GetEnum <SystemTypes>((int)browseInfo.SystemType),
                                         browseInfo.ClassId);

                // Initialize the new control with the content that was dclicked
                editControl.InitContent(browseInfo.Id);
                var tabName = editControl.ControlName;
                if (openCopy)
                {
                    editControl.MakeCopy();
                    tabName = "*" + editControl.ControlName + "*";
                }
                else if (makeDirty)
                {
                    editControl.MakeDirty();
                    tabName = "*" + editControl.ControlName + "*";
                }

                tabName = $"[{editControl.Id}] {tabName}";

                CreateContentTab(tabName, editControl);
            }
        }
Esempio n. 16
0
        private void PopulateEffectsGrid(Month month)
        {
            foreach (var effect in month.Effects)
            {
                var row = new DataGridViewRow {
                    Tag = effect
                };

                var cellEffect = row.Cells["Effect"] as DataGridViewLinkCell;
                cellEffect.Value = EditorFactory.GetBrowseInfo(SystemTypes.Effect, effect.Effect.Id);

                gridEffects.Rows.Add(row);
            }
        }
Esempio n. 17
0
        public override void loadItemData(int aDefId)
        {
            DataTable dt = Database.getData("item_book_map", "item_def_id", aDefId, null);

            if (dt == null)
            {
                return;
            }
            if (dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dt.Rows[0];

            mItemMapId = (int)dataRow["item_book_map_id"];
            EditorFactory.setupLink(linkAbility, EditorSystemType.Ability, Database.getNullableId(dataRow, "ability_def_id"));

            DataTable pageTable = Database.getData("item_book_page_map", "item_def_id", aDefId, null);

            if (pageTable == null)
            {
                return;
            }
            if (pageTable.Rows.Count == 0)
            {
                return;
            }

            mPages.Clear();
            listBoxPages.Items.Clear();
            foreach (DataRow pageRow in pageTable.Rows)
            {
                BookPage bookPage = new BookPage();
                bookPage.book_page_def_id = (int)pageRow["item_book_page_map_id"];
                bookPage.page_number      = (int)pageRow["page_number"];
                bookPage.page_text        = pageRow["page_text"].ToString();
                mPages.Add(bookPage);

                /* Find the first page and select it by default */
                listBoxPages.Items.Add(bookPage.page_number.ToString());
            }
            pageTable.Dispose();
            dt.Dispose();

            loadListToUI();
            if (listBoxPages.Items.Count != 0)
            {
                listBoxPages.SelectedIndex = 0;
            }
        }
Esempio n. 18
0
        private void loadExitGrid(int aId)
        {
            gridExits.Rows.Clear();

            DataTable dt = Database.getData("space_exit_map", "space_def_id", aId, null);

            if (dt == null)
            {
                return;
            }
            foreach (DataRow rowView in dt.Rows)
            {
                int             gridIndex = gridExits.Rows.Add();
                DataGridViewRow gridRow   = gridExits.Rows[gridIndex];

                DataGridViewComboBoxCell cellDirection = gridRow.Cells["ref_direction_id"] as DataGridViewComboBoxCell;
                ComboUtils.fillComboCellWithRefTable(cellDirection, "ref_direction", "ref_direction_id", "name", (int)rowView["ref_direction_id"]);

                DataGridViewLinkCell cellSpace = gridRow.Cells["destination_space_def_id"] as DataGridViewLinkCell;
                cellSpace.Value = EditorFactory.getBrowseInfo(EditorSystemType.Space, rowView, "destination_space_def_id");

                int flags = (int)rowView["flags"];

                DataGridViewCheckBoxCell cellHidden = gridRow.Cells["is_hidden"] as DataGridViewCheckBoxCell;
                cellHidden.Value = ((flags & Globals.EXIT_FLAG_Hidden) != 0) ? true : false;

                DataGridViewCheckBoxCell cellOneWay = gridRow.Cells["is_oneway"] as DataGridViewCheckBoxCell;
                cellOneWay.Value = ((flags & Globals.EXIT_FLAG_OneWay) != 0) ? true : false;

                DataGridViewCheckBoxCell cellTransparent = gridRow.Cells["is_transparent"] as DataGridViewCheckBoxCell;
                cellTransparent.Value = ((flags & Globals.EXIT_FLAG_Transparent) != 0) ? true : false;

                DataGridViewComboBoxCell cellDifficulty = gridRow.Cells["ref_difficulty_id"] as DataGridViewComboBoxCell;
                if (Database.getNullableId(rowView, "ref_difficulty_id") == 0)
                {
                    ComboUtils.fillComboCellWithRefTable(cellDifficulty, "ref_difficulty", "ref_difficulty_id", "name", 6);
                }
                //cellDifficulty.Value = 6;   // None
                else
                {
                    ComboUtils.fillComboCellWithRefTable(cellDifficulty, "ref_difficulty", "ref_difficulty_id", "name", Database.getNullableId(rowView, "ref_difficulty_id"));
                }

                DataGridViewLinkCell cellBarrier = gridRow.Cells["barrier_def_id"] as DataGridViewLinkCell;
                cellBarrier.Value = EditorFactory.getBrowseInfo(EditorSystemType.Barrier, rowView, "barrier_def_id");

                gridRow.Tag = (int)rowView["space_exit_map_id"];
            }
            dt.Dispose();
        }
Esempio n. 19
0
 public MainContainerPresenter(MainContainer mainContainer)
 {
     _mainContainer = mainContainer;
     _editorFactory = Documento.getInstance().EditorFactory;
     _deleters      = new Dictionary <Type, Deleter>();
     FillDeleters();
     FillNuovoMenu();
     OnLibreriaChange(this, EventArgs.Empty);
     _mainContainer.CambiaModelloButton.Click     += OnModelChangeClick;
     _mainContainer.LibreriaView.MouseDoubleClick += OnLibreriaDoubleClick;
     _mainContainer.LibreriaView.MouseClick       += OnLibreriaClick;
     _mainContainer.NuovoProgetto.Click           += OnNuovoProgettoClick;
     Documento.getInstance().LibreriaChanged += OnLibreriaChange;
 }
Esempio n. 20
0
        public override void initContentImpl(int aId)
        {
            DataTable dt = Database.getData("npc_def", "npc_def_id", aId, null);

            if (dt == null)
            {
                Program.MainForm.logError("Could not load NPC [" + aId + "]");
                return;
            }
            if (dt.Rows.Count == 0)
            {
                Program.MainForm.logError("Could not load NPC [" + aId + "]");
                return;
            }

            Program.MainForm.logInfo("NPC loaded [" + aId + "]");
            DataRow dataRow = dt.Rows[0];

            txtSystemName.Text         = dataRow["system_name"].ToString();
            txtDisplayName.Text        = dataRow["display_name"].ToString();
            txtDisplayDescription.Text = dataRow["display_description"].ToString();

            numAccessLevel.Value = (int)dataRow["access_level"];

            ComboUtils.fillCombo(cboGender, "ref_gender", "name", "ref_gender_id", (int)dataRow["ref_gender_id"]);
            EditorFactory.setupLink(linkRace, EditorSystemType.Race, Database.getNullableId(dataRow, "race_def_id"));
            EditorFactory.setupLink(linkShop, EditorSystemType.Shop, Database.getNullableId(dataRow, "shop_def_id"));
            if (linkShop.Text != "")
            {
                chkIsShop.Checked = true;
            }

            EditorFactory.setupLink(linkFaction, EditorSystemType.Faction, Database.getNullableId(dataRow, "faction_def_id"));
            EditorFactory.setupLink(linkTreasure, EditorSystemType.Treasure, Database.getNullableId(dataRow, "treasure_def_id"));
            if (linkTreasure.Text != "")
            {
                chkHasTreasure.Checked = true;
            }
            numLevel.Value = Database.getNullableId(dataRow, "npc_level");

            dt.Dispose();
            ControlName = txtSystemName.Text;

            loadStatisticsGrid(aId);
            loadAbilitiesGrid(aId);
            loadItemsGrid(aId);
            loadNodesGrid(aId);
            loadConversationsGrid(aId);
        }
Esempio n. 21
0
        public void DisposeDisposableMembersTest()
        {
            VisualStudioHaskellPackage package = new VisualStudioHaskellPackage();

            EditorFactory      editorFactory   = new EditorFactory(package);
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            editorFactory.SetSite(serviceProvider);
            object service = editorFactory.GetService(typeof(IProfferService));

            Assert.IsNotNull(service);
            editorFactory.Dispose(); //service provider contains no services after this call
            service = editorFactory.GetService(typeof(IProfferService));
            Assert.IsNull(service, "serviceprovider has not beed disposed as expected");
        }
Esempio n. 22
0
        private static ITextSnapshot GetSampleCodeSnapshot()
        {
            var exportProvider =
                EditorTestCompositions.EditorFeatures.ExportProviderFactory.CreateExportProvider();

            // to make verification simpler, each line of code is 4 characters and will be joined to other lines
            // with a single newline character making the formula to calculate the offset from a given line and
            // column thus:
            //   position = row * 5 + column
            var lines    = new string[] { "goo1", "bar1", "goo2", "bar2", "goo3", "bar3", };
            var code     = string.Join("\n", lines);
            var snapshot = EditorFactory.CreateBuffer(exportProvider, code).CurrentSnapshot;

            return(snapshot);
        }
Esempio n. 23
0
        public void ShowEditor(INode2 node)
        {
            // TODO: Kind of a hack
            switch (node.NodeInfo.Type)
            {
            case NodeType.Dynamic:
            case NodeType.Effect:
                EditorFactory.OpenEditor(node.InternalCOMInterf);
                break;

            default:
                FVVVVHost.ShowEditor(node.InternalCOMInterf);
                break;
            }
        }
Esempio n. 24
0
        public SequenzaEditorPresenter(Modello modello)
        {
            _editor        = new SequenzaEditor();
            _editorFactory = Documento.getInstance().EditorFactory;
            _editor.Dock   = DockStyle.Fill;
            Sequenza s = new Sequenza();

            s.AggiungiElemento(Elemento.Default, 30);
            CaricaSequenza(new PersisterMapper <Sequenza>(s));

            _draggedElementIndex = -1;

            PopulateElementChoices();
            OnLibreriaChange(this, EventArgs.Empty);
            AttachHandlers();
        }
Esempio n. 25
0
        public static void Setup(this LinkLabel value, SystemTypes systemType, int key)
        {
            Validation.IsNotNull(value, "value");

            if (key > 0)
            {
                var browseInfo = EditorFactory.GetBrowseInfo(systemType, key);
                value.Tag  = browseInfo;
                value.Text = browseInfo.Name;
            }
            else
            {
                value.Tag  = new EditorBrowseInfo(systemType, string.Empty, 0, 0);
                value.Text = string.Empty;
            }
        }
        public static void Init()
        {
            PageEx.MajorVersion = 2013;

            jQuery.OnDocumentReady(delegate()
            {
                ValidationApi.RegisterExtenders();

                // Init settings
                OrganizationServiceProxy.GetUserSettings();
                SimpleEditableGridViewModel vm = new SimpleEditableGridViewModel();

                // Create Grid
                GridDataViewBinder dataViewBinder      = new GridDataViewBinder();
                dataViewBinder.AddCheckBoxSelectColumn = true;
                dataViewBinder.SelectActiveRow         = true;
                dataViewBinder.MultiSelect             = false;
                List <Column> columns    = new List <Column>();
                EditorFactory textEditor = (EditorFactory)Script.Literal("Slick.Editors.Text");

                XrmTextEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Title", 150, "title"));
                XrmTextEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Author", 150, "author"));
                XrmDateEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Published", 150, "publishdate"), true);
                XrmMoneyEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Price", 150, "price"), 0, 100);
                XrmNumberEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Copies", 150, "numberofcopies"), 0, 1000, 0);
                XrmLookupEditorOptions languageLookupOptions =
                    (XrmLookupEditorOptions)XrmLookupEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Language", 150, "language"), vm.GetLanguages, "id", "name", null).Options;
                languageLookupOptions.showImage = false;

                OptionSetBindingOptions formatBindingOptions = new OptionSetBindingOptions();
                formatBindingOptions.allowEmpty            = true;
                formatBindingOptions.GetOptionSetsDelegate = vm.GetFormats;

                XrmOptionSetEditor.BindColumnWithOptions(GridDataViewBinder.AddColumn(columns, "Format", 150, "format"), formatBindingOptions);
                XrmDurationEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Audio Length", 150, "audiolength"));
                XrmTimeEditor.BindColumn(GridDataViewBinder.AddColumn(columns, "Start Time", 150, "starttime"));

                Grid grid = dataViewBinder.DataBindXrmGrid(vm.Books, columns, "booksGridContainer", null, true, true);
                ViewBase.RegisterViewModel(vm);

                Window.SetTimeout(delegate()
                {
                    vm.LoadBooks();
                    grid.ResizeCanvas();
                }, 0);
            });
        }
Esempio n. 27
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (editorPackage != null)
         {
             editorPackage.Dispose();
             editorPackage = null;
         }
         if (editorFactory != null)
         {
             editorFactory.Dispose();
             editorFactory = null;
         }
         GC.SuppressFinalize(this);
     }
 }
Esempio n. 28
0
        /// <summary>
        /// modelに対応するeditorを生成し,子に追加する.
        /// Controllerへの通知も行う.
        /// </summary>
        internal Editor InsertChild(object childModel, int index)
        {
            var containerCtrl = Controller as IContainerController;

            Contract.Requires(containerCtrl != null);
            //Require.Argument(containerCtrl.CanCreateChild(childModel), "childModel");

            var childEditor = EditorFactory.CreateEditor(childModel, Site.ControllerFactory);

            /// InsertChildEditorしてからcontainerCtrl.InsertChild()しないと
            /// PropertyChangedでcontrolからRefresh()が呼ばれて子editorが二重登録される.
            /// なので必ずInsertChildEditor(),containerCtrl.InsertChild()の順に呼ぶ.
            InsertChildEditor(childEditor, index);
            containerCtrl.InsertChild(childModel, index);

            return(childEditor);
        }
        public override void loadEffectData(int aEffectDefId)
        {
            DataTable dt = Database.getData("effect_healthchange_map", "effect_def_id", aEffectDefId, null);

            if (dt == null)
            {
                return;
            }
            if (dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dt.Rows[0];

            mEffectMapId = (int)dataRow["effect_healthchange_map_id"];

            int healthChangeType = (int)dataRow["health_change_type_id"];

            if (healthChangeType == Globals.HEALTH_CHANGE_TYPE_Damage)
            {
                rdoDamage.Checked = true;
            }
            else if (healthChangeType == Globals.HEALTH_CHANGE_TYPE_Heal)
            {
                rdoHeal.Checked = true;
            }
            else if (healthChangeType == Globals.HEALTH_CHANGE_TYPE_Steal)
            {
                rdoSteal.Checked = true;
            }
            else
            {
                rdoResurrect.Checked = true;
            }

            numHealthMin.Value   = Database.getNullableId(dataRow, "health_change_min");
            numHealthMax.Value   = Database.getNullableId(dataRow, "health_change_max");
            numHealthBonus.Value = Database.getNullableId(dataRow, "health_change_bonus");

            EditorFactory.setupLink(linkResistStat, EditorSystemType.Statistic, Database.getNullableId(dataRow, "resist_statistic_def_id"));
            EditorFactory.setupLink(linkOnFail, EditorSystemType.Effect, Database.getNullableId(dataRow, "onfail_effect_def_id"));
            EditorFactory.setupLink(linkOnResist, EditorSystemType.Effect, Database.getNullableId(dataRow, "onresist_effect_def_id"));

            ComboUtils.fillCombo(cboDamage, "ref_damage_type", "name", "ref_damage_type_id", Database.getNullableId(dataRow, "ref_damage_type_id"));
            dt.Dispose();
        }
Esempio n. 30
0
        public virtual int Close()
        {
            if (this.site != null)
            {
                if (this.editorFactory != null)
                {
                    Guid editorGuid        = this.editorFactory.GetType().GUID;
                    IVsRegisterEditors vre = (IVsRegisterEditors)site.GetService(typeof(SVsRegisterEditors));
                    vre.UnregisterEditor(this.editorFactoryCookie);
                    this.editorFactory.Close();
                    this.editorFactory = null;
                }
                if (this.projectFactory != null)
                {
                    IVsRegisterProjectTypes rpt = (IVsRegisterProjectTypes)this.site.GetService(typeof(IVsRegisterProjectTypes));
                    if (rpt != null)
                    {
                        rpt.UnregisterProjectType(this.projectFactoryCookie);
                    }
                    this.projectFactoryCookie = 0;
                    this.projectFactory.Close();
                    this.projectFactory = null;
                }
            }
            foreach (ILanguageService svc in this.languageServices.Values)
            {
                svc.Done();
            }
            this.languageServices.Clear();

            if (this.componentID != 0)
            {
                this.componentManager.FRevokeComponent(this.componentID);
                this.componentID = 0;
            }
            this.componentManager = null;

            if (site != null)
            {
                site.Dispose();
            }
            this.site = null;
            GC.Collect();
            return(0);
        }
Esempio n. 31
0
        private void CreateProductToolStripMenuItemClick(object sender, EventArgs e)
        {
            var browseInfo = treeBrowse.SelectedNode?.Tag as EditorBrowseInfo;

            if (browseInfo == null || browseInfo.Id <= 0)
            {
                return;
            }

            var editControl = EditorFactory.Create(browseInfo.SystemType, browseInfo.ClassId);

            editControl.InitContent(browseInfo.Id);
            browseInfo = editControl.MakeProduct();
            if (browseInfo != null)
            {
                OpenTab(browseInfo, false, true);
            }
        }
Esempio n. 32
0
        public override void loadEffectData(int aEffectDefId)
        {
            DataTable dt = Database.getData("effect_spaceeffect_map", "effect_def_id", aEffectDefId, null);

            if (dt == null)
            {
                return;
            }
            if (dt.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dt.Rows[0];

            mEffectMapId = (int)dataRow["effect_spaceeffect_map_id"];
            EditorFactory.setupLink(linkSpaceEffect, EditorSystemType.SpaceEffect, Database.getNullableId(dataRow, "space_effect_def_id"));
            dt.Dispose();
        }
Esempio n. 33
0
        private void lstMaps_SelectedIndexChanged(object sender, EventArgs e)
        {
            var map = lstMaps.SelectedItem as MapModel;

            if (map != null)
            {
                btnRemoveMap.Enabled = btnMapUp.Enabled = btnMapDown.Enabled = true;

                grpChildMap.Controls.Clear();
                var control = EditorFactory.GetEditor(_edSvc, _group, map.Map);
                control.Dock = DockStyle.Fill;
                grpChildMap.Controls.Add(control);
            }
            else
            {
                btnRemoveMap.Enabled = btnMapUp.Enabled = btnMapDown.Enabled = false;
            }
        }
        protected async Task AssertFormatAsync(string expected, string code, bool debugMode = false, Dictionary <OptionKey, object> changedOptionSet = null, bool useTab = false, bool testWithTransformation = true)
        {
            using (var workspace = TestWorkspace.CreateCSharp(code))
            {
                var hostdoc = workspace.Documents.First();

                // get original buffer
                var buffer = hostdoc.GetTextBuffer();

                // create new buffer with cloned content
                var clonedBuffer = EditorFactory.CreateBuffer(
                    buffer.ContentType.TypeName,
                    workspace.ExportProvider,
                    buffer.CurrentSnapshot.GetText());

                var document   = workspace.CurrentSolution.GetDocument(hostdoc.Id);
                var syntaxTree = await document.GetSyntaxTreeAsync();

                var formattingRuleProvider = workspace.Services.GetService <IHostDependentFormattingRuleFactoryService>();

                var options = workspace.Options;
                if (changedOptionSet != null)
                {
                    foreach (var entry in changedOptionSet)
                    {
                        options = options.WithChangedOption(entry.Key, entry.Value);
                    }
                }

                options = options.WithChangedOption(FormattingOptions.UseTabs, LanguageNames.CSharp, useTab);

                var root = await syntaxTree.GetRootAsync();

                var rules = formattingRuleProvider.CreateRule(workspace.CurrentSolution.GetDocument(syntaxTree), 0).Concat(Formatter.GetDefaultFormattingRules(workspace, root.Language));

                AssertFormat(workspace, expected, options, rules, clonedBuffer, root);

                if (testWithTransformation)
                {
                    // format with node and transform
                    AssertFormatWithTransformation(workspace, expected, options, rules, root);
                }
            }
        }
Esempio n. 35
0
        public void RebuildChildren()
        {
            if (Figure == null || Controller == null)
            {
                return;
            }
            var container = Controller as IContainerController;

            if (container == null)
            {
                return;
            }

            /// Editorの子構造とModelの子構造を同期
            using (Figure.DirtManager.BeginDirty()) {
                /// ModelにはあるけどEditorにない子のEditorを作成
                foreach (var cChild in container.Children)
                {
                    var found = Children.Find(childEditor => childEditor.Model == cChild);
                    if (found == null)
                    {
                        var childEditor = EditorFactory.CreateEditor(cChild, Site.ControllerFactory);
                        AddChildEditor(childEditor);
                        childEditor.Enable();
                    }
                }

                /// EditorにはあるけどModelにはない子のEditorを削除
                var removeds = new List <Editor>();
                if (_structure.HasChildren)
                {
                    foreach (var childEditor in Children)
                    {
                        var found = container.Children.Find(child => childEditor.Model == child);
                        if (found == null)
                        {
                            removeds.Add(childEditor);
                            childEditor.Disable();
                        }
                    }
                }
                removeds.ForEach(e => RemoveChildEditor(e));
            }
        }
Esempio n. 36
0
        protected async Task AssertFormatAsync(string expected, string code, IEnumerable <TextSpan> spans, bool debugMode = false, Dictionary <OptionKey, object> changedOptionSet = null, int?baseIndentation = null)
        {
            using var workspace = TestWorkspace.CreateCSharp(code);
            var hostdoc = workspace.Documents.First();
            var buffer  = hostdoc.GetTextBuffer();

            var document   = workspace.CurrentSolution.GetDocument(hostdoc.Id);
            var syntaxTree = await document.GetSyntaxTreeAsync();

            // create new buffer with cloned content
            var clonedBuffer = EditorFactory.CreateBuffer(
                workspace.ExportProvider,
                buffer.ContentType,
                buffer.CurrentSnapshot.GetText());

            var formattingRuleProvider = workspace.Services.GetService <IHostDependentFormattingRuleFactoryService>();

            if (baseIndentation.HasValue)
            {
                var factory = formattingRuleProvider as TestFormattingRuleFactoryServiceFactory.Factory;
                factory.BaseIndentation = baseIndentation.Value;
                factory.TextSpan        = spans.First();
            }

            var options = workspace.Options;

            if (changedOptionSet != null)
            {
                foreach (var entry in changedOptionSet)
                {
                    options = options.WithChangedOption(entry.Key, entry.Value);
                }
            }

            var root = await syntaxTree.GetRootAsync();

            var rules = formattingRuleProvider.CreateRule(workspace.CurrentSolution.GetDocument(syntaxTree), 0).Concat(Formatter.GetDefaultFormattingRules(workspace, root.Language));

            AssertFormat(workspace, expected, options, rules, clonedBuffer, root, spans);

            // format with node and transform
            AssertFormatWithTransformation(workspace, expected, options, rules, root, spans);
        }
Esempio n. 37
0
        public override void initContentImpl(int aId)
        {
            DataTable dt = Database.getData("barrier_def", "barrier_def_id", aId, null);

            if (dt == null)
            {
                Program.MainForm.logError("Could not load Barrier [" + aId + "]");
                return;
            }
            if (dt.Rows.Count == 0)
            {
                Program.MainForm.logError("Could not load Barrier [" + aId + "]");
                return;
            }

            Program.MainForm.logInfo("Barrier loaded [" + aId + "]");
            DataRow dataRow = dt.Rows[0];

            txtSystemName.Text = dataRow["system_name"].ToString();
            ComboUtils.fillCombo(cboMaterialTypes, "ref_material", "name", "ref_material_id", (int)dataRow["ref_material_id"]);
            EditorFactory.setupLink(linkLock, EditorSystemType.Item, Database.getNullableId(dataRow, "lock_item_def_id"));
            EditorFactory.setupLink(linkTrap, EditorSystemType.Item, Database.getNullableId(dataRow, "trap_item_def_id"));
            ComboUtils.fillCombo(cboCondition, "ref_condition", "name", "ref_condition_id", (int)dataRow["ref_condition_id"]);
            EditorFactory.setupLink(linkKey, EditorSystemType.Item, Database.getNullableId(dataRow, "key_item_def_id"));

            int flags = (int)dataRow["flags"];

            chkCloseable.Checked   = ((flags & Globals.BARRIER_FLAG_Closeable) != 0) ? true : false;
            chkClosed.Checked      = ((flags & Globals.BARRIER_FLAG_Closed) != 0) ? true : false;
            chkOneWay.Checked      = ((flags & Globals.BARRIER_FLAG_OneWay) != 0) ? true : false;
            chkTransparent.Checked = ((flags & Globals.BARRIER_FLAG_Transparent) != 0) ? true : false;
            chkDestroyable.Checked = ((flags & Globals.BARRIER_FLAG_Destroyable) != 0) ? true : false;
            chkDestroyed.Checked   = ((flags & Globals.BARRIER_FLAG_Destroyed) != 0) ? true : false;
            chkDispellable.Checked = ((flags & Globals.BARRIER_FLAG_Dispellable) != 0) ? true : false;
            chkLockable.Checked    = ((flags & Globals.BARRIER_FLAG_Lockable) != 0) ? true : false;
            chkTrapable.Checked    = ((flags & Globals.BARRIER_FLAG_Trapable) != 0) ? true : false;
            chkJumpable.Checked    = ((flags & Globals.BARRIER_FLAG_Jumpable) != 0) ? true : false;
            chkClimbable.Checked   = ((flags & Globals.BARRIER_FLAG_Climbable) != 0) ? true : false;
            chkSwimable.Checked    = ((flags & Globals.BARRIER_FLAG_Swimmable) != 0) ? true : false;

            dt.Dispose();
            ControlName = txtSystemName.Text;
        }
Esempio n. 38
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            String installDir = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            if (installDir.StartsWith("file:///"))
            {
                installDir = installDir.Remove(0, 8);
            }
            installDir = System.IO.Path.GetDirectoryName(installDir);
            //Trace.WriteLine(string.Format("Installation dir: {0}", installDir));

            // Create our editor factory and register it
            this.editorFactory = new EditorFactory(this);
            base.RegisterEditorFactory(this.editorFactory);

            // Offer the language service.
            IServiceContainer serviceContainer = this as IServiceContainer;
            HaskellService haskellService = new HaskellService(installDir);
            haskellService.SetSite(this);
            serviceContainer.AddService(typeof(HaskellService), haskellService, true);

            // Register a timer to call our language service during
            // idle periods.
            IOleComponentManager mgr = GetService(typeof(SOleComponentManager))
                                       as IOleComponentManager;
            if (m_componentID == 0 && mgr != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                                              (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                              (uint)_OLECADVF.olecadvfRedrawOff |
                                              (uint)_OLECADVF.olecadvfWarningsOff;
                crinfo[0].uIdleTimeInterval = 1000;
                int hr = mgr.FRegisterComponent(this, crinfo, out m_componentID);
            }
        }
Esempio n. 39
0
    public virtual void Close()	{
      if (this.site != null) {
        if (this.editorFactory != null) {
          Guid editorGuid = this.editorFactory.GetType().GUID;
          IVsRegisterEditors vre = (IVsRegisterEditors)site.QueryService( VsConstants.SID_SVsRegisterEditors, typeof(IVsRegisterEditors));
          vre.UnregisterEditor(this.editorFactoryCookie);
          this.editorFactory.Close();
          this.editorFactory = null;
        }
        if (this.projectFactory != null) {
          IVsRegisterProjectTypes rpt = (IVsRegisterProjectTypes)this.site.QueryService(VsConstants.SID_IVsRegisterProjectTypes, typeof(IVsRegisterProjectTypes));
          if (rpt != null) {
            rpt.UnregisterProjectType(this.projectFactoryCookie);          
          }
          this.projectFactoryCookie = 0;
          this.projectFactory.Close();
          this.projectFactory = null;
        }

      }
      foreach (ILanguageService svc in this.languageServices.Values) {
        svc.Done();
      }
      this.languageServices.Clear();
      
      if (this.componentID != 0) {
        this.componentManager.FRevokeComponent(this.componentID);
        this.componentID = 0;
      }
      this.componentManager = null;

      if (site != null) site.Dispose();
      this.site = null;
      GC.Collect();
    }
Esempio n. 40
0
    public virtual void SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site){

      this.site = new ServiceProvider(site);
      this.editorFactory = CreateEditorFactory();
      if (this.editorFactory != null) {
        this.editorFactory.SetSite(site);
        Guid editorGuid = this.editorFactory.GetType().GUID;
        IVsRegisterEditors vre = (IVsRegisterEditors)this.site.QueryService( VsConstants.SID_SVsRegisterEditors, typeof(IVsRegisterEditors));
        vre.RegisterEditor(ref editorGuid, editorFactory, out this.editorFactoryCookie);
      }

      this.projectFactory = CreateProjectFactory();
      if (this.projectFactory != null) {
        this.projectFactory.SetSite(site);
        IVsRegisterProjectTypes rpt = (IVsRegisterProjectTypes)this.site.QueryService(VsConstants.SID_IVsRegisterProjectTypes, typeof(IVsRegisterProjectTypes));
        if (rpt != null) {
          Guid projectType = this.projectFactory.GetType().GUID;
          rpt.RegisterProjectType(ref projectType, this.projectFactory, out this.projectFactoryCookie);          
        }
      }

      uint lcid = VsShell.GetProviderLocale(this.site);
      
      languageServices = new Hashtable();
      string thisPackage = "{"+this.GetType().GUID.ToString() + "}";
      ServiceProvider thisSite = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)this);

      ILocalRegistry3 localRegistry = (ILocalRegistry3)this.site.QueryService( VsConstants.SID_SLocalRegistry, typeof(ILocalRegistry3));
      string root = null;        
      if (localRegistry != null) {
        localRegistry.GetLocalRegistryRoot(out root);
      }      
      using (RegistryKey rootKey = Registry.LocalMachine.OpenSubKey(root)) {
        if (rootKey != null) {
          using (RegistryKey languages = rootKey.OpenSubKey("Languages\\Language Services")) {
            if (languages != null) {
              foreach (string languageName in languages.GetSubKeyNames()) {
                using (RegistryKey langKey = languages.OpenSubKey(languageName)) {
                  object pkg = langKey.GetValue("Package");
                  if (pkg is string && string.Compare((string)pkg, thisPackage, false) == 0) {
                    object guid = langKey.GetValue(null);
                    if (guid is string) {
                      Guid langGuid = new Guid((string)guid);
                      if (!this.languageServices.Contains(langGuid.ToString())){
                        ILanguageService svc = CreateLanguageService(ref langGuid);
                        if (svc != null) {
                          svc.Init(thisSite, ref langGuid, lcid, GetFileExtensions(rootKey, (string)guid));
                          this.languageServices.Add(langGuid.ToString(), svc);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

      //register with ComponentManager for Idle processing
      this.componentManager = (IOleComponentManager)this.site.QueryService(VsConstants.SID_SOleComponentManager, typeof(IOleComponentManager));
      if (componentID == 0)
      {
          OLECRINFO[]   crinfo = new OLECRINFO[1];
          crinfo[0].cbSize   = (uint)Marshal.SizeOf(typeof(OLECRINFO));
          crinfo[0].grfcrf   = (uint)OLECRF.olecrfNeedIdleTime |
                               (uint)OLECRF.olecrfNeedPeriodicIdleTime; 
          crinfo[0].grfcadvf = (uint)OLECADVF.olecadvfModal |
                               (uint)OLECADVF.olecadvfRedrawOff |
                               (uint)OLECADVF.olecadvfWarningsOff;
          crinfo[0].uIdleTimeInterval = 1000;
          this.componentManager.FRegisterComponent(this, crinfo, out componentID);
      }

    }