static void NotMain()
        {
            MyBol      Bol   = (x, y) => x == y;
            MyBol_2    Bol_2 = (x, s) => s.Length > x;
            calculator C     = (X, Y) => X * Y;
            VS         S     = () => Console.Write("我是无参数Labada表达式");

            //
            int[] numbers    = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
            int   oddNumbers = numbers.Count(n => n % 2 == 1);
            //
            List <People> people = LoadData();//初始化

            // 分解
            // 自己建的委托 delegate bool MyDele(People p);
            // 使用委托
            MyDele myDele = p => p.age > 20;
            // C#内置泛型委托  delegate TResult System.Func<int T, out TResult>(T arg)
            Func <People, bool> predicate = p => p.age > 20;

            IEnumerable <People> results2 = people.Where(predicate);

            // 委托的实例化:使用匿名方法
            // < 委托类型 > < 实例化名 >= delegate (< 函数参数 >){ 函数体};
            Func <People, bool>  predicate2 = delegate(People p) { return(p.age > 20); };
            IEnumerable <People> results4   = people.Where(predicate2);

            IEnumerable <People> results = people.Where(delegate(People p) { return(p.age > 20); });
            // 更简便的写法
            IEnumerable <People> results3 = people.Where(p => p.age > 20);
        }
Exemplo n.º 2
0
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            DTE2 dte = await VS.GetServiceAsync <EnvDTE.DTE, DTE2>();

            if (dte?.ActiveDocument == null)
            {
                return;
            }

            try
            {
                DocumentView docView = await VS.Documents.GetActiveDocumentViewAsync();

                if (docView?.TextView != null)
                {
                    ResetZoom(dte, docView.TextView);
                }
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
Exemplo n.º 3
0
    private static async Task HideUnloadedProjectsInSolutionExplorerAsync()
    {
        ISolutionExplorer solutionExplorer;


        await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

        solutionExplorer = await VS.GetRequiredServiceAsync <ISolutionExplorer, ISolutionExplorer>();

        // The solution has opened, but Solution Explorer may not have been populated
        // yet, so keep looping until there is something in Solution Explorer.
        while (true)
        {
            bool?empty;


            empty = await solutionExplorer.IsEmptyAsync();

            // If we know for sure that Solution Explorer is empty, then wait
            // a bit and try again. If we know it's not empty then we can hide
            // the unloaded projects. If we don't know if it's empty or not, then
            // we'll still try to hide the unloaded projects because if we don't now,
            // then we may never know, and then we'd end up looping here forever.
            if (empty.GetValueOrDefault())
            {
                await Task.Delay(1000);
            }
            else
            {
                break;
            }
        }

        await solutionExplorer.HideUnloadedProjectsAsync();
    }
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>Returns <see langword="true"/> if the command was succesfully executed; otherwise <see langword="false"/>.</returns>
        public static async Task <bool> ExecuteAsync(this CommandID cmd, string argument = "")
        {
            if (!await cmd.IsAvailableAsync())
            {
                return(false);
            }

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IOleCommandTarget cs = await VS.GetRequiredServiceAsync <SUIHostCommandDispatcher, IOleCommandTarget>();

            IntPtr vIn = IntPtr.Zero;
            Guid   g   = cmd.Guid;

            try
            {
                if (!string.IsNullOrWhiteSpace(argument))
                {
                    vIn = Marshal.AllocCoTaskMem(128);
                    Marshal.GetNativeVariantForObject(argument, vIn);
                }

                int hr = cs.Exec(ref g, unchecked ((uint)cmd.ID), (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, vIn, IntPtr.Zero);
                return(ErrorHandler.Succeeded(hr));
            }
            finally
            {
                if (vIn != IntPtr.Zero)
                {
                    NativeMethods.VariantClear(vIn);
                    Marshal.FreeCoTaskMem(vIn);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Calculates the organic loading rate of the digester.
        /// Assumption that Q and Qsum is measured in m^3/d.
        ///
        /// As a reference see:
        ///
        /// Handreichung Biogasgewinnung und -nutzung: Grundlagen der anaeroben
        /// Fermentation, S. 29.
        ///
        /// </summary>
        /// <param name="x">digester state vector</param>
        /// <param name="mySubstrates">
        /// substrates or sludge but not both!!! Because TS content is calculated
        /// out of COD in digester. If there is a mixture of substrate and sludge going
        /// into the digester, then the COD is aleardy decreased by the sludge, so no need
        /// to account for the lower TS of the sludge here.
        /// TODO: hier sollten es beide sein!
        /// </param>
        /// <param name="Q">
        /// Q of the substrates or sludge, but not both!
        /// TODO: hier sollten es beide sein!
        /// </param>
        /// <param name="Qsum">
        /// if there is sludge and substrate going into the digester, then Qsum will be
        /// bigger then math.sum(Q). Qsum is needed to account for full volumeflow
        /// going into the digester no matter if substrate or sludge.
        /// TODO: nach Änderung, dass Q alle feed enthält, ist Qsum= sum(Q)
        /// kann also als Parameter entfernt werden
        /// </param>
        /// <returns></returns>
        public physValue calcOLR(double[] x, substrates mySubstrates, double[] Q, double Qsum)
        {
            physValue Vliq = this.Vliq;

            physValue TS;

            // TODO
            // was mache ich hier!!!! ???????????????????
            // warum nehme ich nicht einfach VS aus den Substraten???
            physValue VS;//= calcVS(x, mySubstrates, Q, out TS);

            mySubstrates.get_weighted_mean_of(Q, "VS", out VS);
            mySubstrates.get_weighted_mean_of(Q, "TS", out TS);

            VS = biogas.substrate.convertFrom_TS_To_FM(VS, TS);
            VS = VS.convertUnit("100 %");

            physValue rho;

            mySubstrates.get_weighted_mean_of(Q, "rho", out rho);

            // hier wird die Annahme gemacht, dass rho von schlamm gleich ist
            // wie rho der substrate, aber egal (TODO)
            // evtl. wäre es besser gemessenes rho aus density_sensor zu nehmen
            // das ist dichte des inputs in den fermenter (Gemisch aus substrate und rezischlamm)
            physValue OLR = new physValue(Qsum, "m^3/d") * rho * VS / Vliq;

            OLR.Symbol = "OLR";

            return(OLR);
        }
Exemplo n.º 6
0
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            DTE2 dte = await VS.GetDTEAsync();

            if (dte?.ActiveDocument == null)
            {
                return;
            }

            try
            {
                IWpfTextView view = await VS.Editor.GetCurrentWpfTextViewAsync();

                if (view != null)
                {
                    ResetZoom(dte, view);
                }
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
        /// <summary>
        /// Converts the <see cref="IVsTextView"/> to an <see cref="IWpfTextView"/>/
        /// </summary>
        /// <returns></returns>
        internal static IWpfTextView?ToIWpfTextView(this IVsTextView nativeView)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsEditorAdaptersFactoryService?editorAdapter = VS.GetMefService <IVsEditorAdaptersFactoryService>();

            return(editorAdapter?.GetWpfTextView(nativeView));
        }
        /// <summary>
        /// Converts the <see cref="IVsTextView"/> to an <see cref="IWpfTextView"/>/
        /// </summary>
        /// <returns></returns>
        public static IVsTextView?ToIVsTextView(this IWpfTextView view)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsEditorAdaptersFactoryService?editorAdapter = VS.GetMefService <IVsEditorAdaptersFactoryService>();

            return(editorAdapter?.GetViewAdapter(view));
        }
Exemplo n.º 9
0
 private static void VS_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     for (int i = 0; i < VS.Count(); i++)
     {
         _vs[i].Index = i;
     }
     //throw new NotImplementedException();
 }
Exemplo n.º 10
0
 static XSharpXMLDocTools()
 {
     ThreadHelper.JoinableTaskFactory.Run(async delegate
     {
         _XMLMemberIndexService = await VS.GetServiceAsync <SVsXMLMemberIndexService, IVsXMLMemberIndexService>();
     });
     Assumes.Present(_XMLMemberIndexService);
     return;
 }
Exemplo n.º 11
0
    private static async Task LogFailureAsync(string message, int result)
    {
        ILogger logger;


        logger = await VS.GetRequiredServiceAsync <ILogger, ILogger>();

        await logger.WriteLineAsync($"{message} {Marshal.GetExceptionForHR(result).Message}");
    }
Exemplo n.º 12
0
 public void RightButten()
 {
     G_M1.transform.FindChild("L").GetComponent <UILabel> ().text = "주자상황";
     G_M2.transform.FindChild("L").GetComponent <UILabel> ().text = "이닝";
     //G_M3.transform.FindChild ("L").GetComponent<UILabel> ().text = "투수유형";
     Bot.GetComponent <UILabel> ().text = "Direction";
     VS.GetComponent <UILabel> ().text  = "VS " + "Team" + " 0 승 0 패 " + "평균자책 " + "0.00 | " + "Direction";
     transform.FindChild("<").GetComponent <UIButton> ().isEnabled = true;
     transform.FindChild(">").GetComponent <UIButton> ().isEnabled = false;
 }
        protected override async Task <object> InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken)
        {
            PropertyInfo[] properties = typeof(KnownMonikers).GetProperties(BindingFlags.Static | BindingFlags.Public);

            return(new ServicesDTO
            {
                Monikers = properties.Select(p => new KnownMonikersViewModel(p.Name, (ImageMoniker)p.GetValue(null, null))),
                DTE = await VS.GetDTEAsync()
            });
        }
Exemplo n.º 14
0
 public void LeftButten()
 {
     G_M1.transform.FindChild("L").GetComponent <UILabel> ().text = "시즌타율";
     G_M2.transform.FindChild("L").GetComponent <UILabel> ().text = "이닝별";
     //G_M3.transform.FindChild ("L").GetComponent<UILabel> ().text = "투수유형별";
     Bot.GetComponent <UILabel> ().text = "1,2루";
     VS.GetComponent <UILabel> ().text  = "VS " + "Team" + " 시즌 타율 0.200 | " + "Direction";
     transform.FindChild("<").GetComponent <UIButton> ().isEnabled = false;
     transform.FindChild(">").GetComponent <UIButton> ().isEnabled = true;
 }
Exemplo n.º 15
0
        public fDeliveries()
        {
            InitializeComponent();

            // Fill the routes combo
            cboRoute.ParentConn = Values.gDatos;
            cboRoute.Source($"select RouteCode from MasterRoutes where cod3='{Values.COD3}' order by RouteCode");

            // Fill the carriers combo
            cboCarrier.ParentConn = Values.gDatos;
            cboCarrier.Source($"select Codigo,Descripcion from GENERAL..transportistas where CarrierId is not null order by Codigo", txtCarrierDescription);

            //CTLM Definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "pDeliveriesCabAdd";
            CTLM.sSPUpp  = "pDeliveriesCabUpp";
            CTLM.sSPDel  = "pDeliveriesCabDel";
            CTLM.DBTable = "(Select * from DeliveriesCab where cod3='" + Values.COD3 + "') a";

            //Header
            CTLM.AddItem(txtDelivery, "DeliveryCode", false, true, true, 0, true, true);
            CTLM.AddItem(txtPlate, "Plate", true, true, false, 0, false, true);
            CTLM.AddItem(cboRoute, "Route", true, true, false, 0, false, true);
            CTLM.AddItem(txtDate, "xfec", false, false, false, 1, false, true);
            CTLM.AddItem(txtClosedDate, "ClosedDate", false, false, false, 0, false, false);
            CTLM.AddItem(cboCarrier, "CarrierCode", true, true, false, 0, false, false);
            CTLM.AddItem(txtCarrierDescription, "CarrierDesc", false, false, false, 0, false, false);
            CTLM.AddItem(Values.COD3, "cod3", true, true, true, 0, false, true);

            //VS Definitions
            VS.Conn    = Values.gDatos;
            VS.sSPAdd  = "";
            VS.sSPUpp  = "";
            VS.sSPDel  = "pDeliveriesDetDel";
            VS.DBTable = "vDeliveriesCabDet";

            //VS Details
            VS.AddColumn("DeliveryCode", txtDelivery, pSPDel: "@DeliveryCode", pVisible: true); // Can't make it invisible as it raises an error in CTLM that I should fix
            //VS.AddColumn("DeliveryCode", txtDelivery, "@DeliveryCode", "", "@DeliveryCode", pVisible: false);

            VS.AddColumn("HU", "HU", pSPDel: "@HU");
            VS.AddColumn("Type", "HUType", pSPDel: "@HU");
            VS.AddColumn("Finis", "Finis");
            VS.AddColumn("Qty", "Qty");
            VS.AddColumn("Dealer", "Dealer");
            VS.AddColumn("InContainer", "InContainer");
            VS.AddColumn("cod3", "cod3", pSPDel: "@cod3", pVisible: false);

            //Various
            CTLM.AddDefaultStatusStrip();
            CTLM.AddItem(VS);
            CTLM.Start();
            CTLM.AfterButtonClick += CTLM_AfterButtonClick;;
            Program.fDeliveries    = this;
        }
Exemplo n.º 16
0
        public fSimpleReceivals()
        {
            InitializeComponent();

            //CTLM Definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "PAdd_Cab_Recepcion";
            CTLM.sSPUpp  = "PUpp_Cab_Recepcion";
            CTLM.sSPDel  = "PDel_Cab_Recepcion";
            CTLM.DBTable = "(Select c.* from Cab_Recepcion c inner join Servicios s on s.codigo=c.servicio where s.cod3='" + Values.COD3 + "' and dbo.CheckFlag(s.flags,'SIMPLE')=1) a";

            //Header
            CTLM.AddItem(txtEntrada, "Entrada", false, true, true, 1, true, true);
            CTLM.AddItem(txtFecha, "Fecha", true, true, false, 0, false, false);
            CTLM.AddItem(cboServicio, "Servicio", true, true, false, 0, false, true);
            CTLM.AddItem(txtSuppDoc, "Doc_Proveedor", true, true, false, 0, false, true);
            CTLM.AddItem(txtNotes, "Notas", true, true, false, 0, false, false);
            CTLM.AddItem(lstFlags, "flags", false, false, false, 0, false, true);

            //empty header values
            CTLM.AddItem("", "transportista", true, true, false, 0, false, false);
            CTLM.AddItem("", "matricula", true, true, false, 0, false, false);
            CTLM.AddItem("@@@", "conductor", true, true, false, 0, false, false);
            CTLM.AddItem("", "documento_aduana", true, true, false, 0, false, false);
            CTLM.AddItem("01/01/2001 00:00", "fecha_doc_proveedor", true, true, false, 0, false, false);

            //fields
            cboServicio.Source("Select Codigo,Nombre from Servicios where dbo.CheckFlag(flags,'SIMPLE')=1 and cod3='" + Values.COD3 + "' order by codigo", txtDesServicio);
            cboServicio.SelectedValueChanged += CboServicio_SelectedValueChanged;
            lstFlags.Source("Select codigo,DescFlagEng from flags where Tabla='Cab_Recepcion'");



            //VS Definitions
            VS.Conn    = Values.gDatos;
            VS.sSPAdd  = "PAdd_Det_Recepcion";
            VS.sSPUpp  = "";
            VS.sSPDel  = "PDel_Det_Recepcion";
            VS.DBTable = "Det_Recepcion";

            //VS Details
            VS.AddColumn("Entrada", txtEntrada, "@entrada", "", "@entrada", pVisible: false);
            VS.AddColumn("Line", "linea", "", "", "@linea", pSortable: true);
            VS.AddColumn("PartNumber", "partnumber", "@partnumber", pSortable: true, pWidth: 90, aMode: AutoCompleteMode.SuggestAppend, aSource: AutoCompleteSource.CustomSource, aQuery: string.Format("select partnumber from referencias where servicio='{0}'", cboServicio.Value));
            VS.AddColumn("Description", "descripcion", "@descripcion", pSortable: true, pWidth: 200, pLocked: true);
            VS.AddColumn("Qty", "Qty", "@qty", pWidth: 90);
            VS.DataGridView.CellEndEdit += VS_CellEndEdit; //VS_CellValidating; ; ;

            //Various
            CTLM.AddDefaultStatusStrip();
            CTLM.AddItem(VS);
            CTLM.Start();
            CTLM.AfterButtonClick += CTLM_AfterButtonClick;
            toolStrip.Enabled      = false;
        }
Exemplo n.º 17
0
        public fReceivals()
        {
            InitializeComponent();

            //CTLM Definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "pPackReceivalsCabAdd";
            CTLM.sSPUpp  = "pPackReceivalsCabUpp";
            CTLM.sSPDel  = "pPackReceivalsCabDel";
            CTLM.DBTable = "vPackReceivalsCabCOD3";

            //Header
            CTLM.AddItem(txtReceivalNumber, "RecNumber", false, true, true, 1, true, true);
            CTLM.AddItem(cboService, "Service", true, true, true, 1, true, true);
            CTLM.AddItem(txtDate, "Date", false, true, false, 0, false, false);
            CTLM.AddItem(txtSupplierDoc, "SupplierDoc", true, true, false, 0, false, false);
            CTLM.AddItem(txtUser, "UserProc", true, true, false, 0, false, false);
            CTLM.AddItem(txtNotes, "Notes", true, true, false, 0, false, false);
            CTLM.AddItem(lstFlags, "Flags", true, true, false, 0, false, true);
            CTLM.AddItem(txtDescService, "DescService");
            CTLM.AddItem(Values.COD3, "cod3", pSearch: true);

            CTLM.ReQuery = true;

            //fields
            cboService.Source("Select ServiceCode,Description from MasterRepairServices where cod3='" + Values.COD3 + "' order by ServiceCode", txtDescService);
            cboService.SelectedValueChanged += CboService_SelectedValueChanged;
            lstFlags.Source("Select FlagCode,Caption from MasterFlags where TableName='PackReceivalsCab'");

            //VS Definitions
            VS.Conn        = Values.gDatos;
            VS.sSPAdd      = "pPackReceivalsDetAdd";
            VS.sSPDel      = "pPackReceivalsDetDel";
            VS.AllowInsert = true;
            VS.AllowUpdate = false;
            VS.AllowDelete = true;
            VS.DBTable     = "vPackReceivalsDet";

            //VS Columns
            VS.AddColumn("RecNumber", txtReceivalNumber, "@RecNumber", pSPDel: "@RecNumber", pVisible: false);
            VS.AddColumn("Service", cboService, "@Service", pSPDel: "@Service", pVisible: false);
            VS.AddColumn("UnitNumber", "UnitNumber", "@UnitNumber", pSPDel: "@UnitNumber");
            VS.AddColumn("Reference", "Reference", "@Reference", pSortable: true, pWidth: 90, aMode: AutoCompleteMode.SuggestAppend, aSource: AutoCompleteSource.CustomSource, aQuery: string.Format("select Reference from MasterRepairReferences where service='{0}'", cboService.Value));
            VS.AddColumn("Description", "Description", pSortable: true, pWidth: 200);
            //VS.AddColumn("Flags", "Flags", "");
            VS.CellEndEdit += VS_CellEndEdit;

            //Various
            CTLM.AddDefaultStatusStrip();
            CTLM.AddItem(VS);
            CTLM.Start();
            //CTLM.AfterButtonClick += CTLM_AfterButtonClick;
            //CTLM.BeforeButtonClick += CTLM_BeforeButtonClick;
            //toolStrip.Enabled = false;
        }
Exemplo n.º 18
0
        public fProductionOrders()
        {
            InitializeComponent();
            //CTLM Definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "PAdd_Cab_Ordenes_Produccion";
            CTLM.sSPUpp  = "PUpp_Cab_Ordenes_Produccion";
            CTLM.sSPDel  = "PDel_Cab_Ordenes_Produccion";
            CTLM.DBTable = "(Select c.* from Cab_Ordenes_Produccion c inner join Servicios s on s.codigo=c.servicio where s.cod3='" + Values.COD3 + "' and dbo.CheckFlag(s.flags,'SIMPLE')=1) a";

            //Header
            CTLM.AddItem(txtNumero, "Numero", false, true, true, 1, true, true);
            CTLM.AddItem(cboServicio, "Servicio", true, true, false, 0, false, true);
            CTLM.AddItem(txtFecha, "Fecha", true, false, false, 0, false, false, DateTime.Now);
            CTLM.AddItem(cboRuta, "Ruta", true, true, false, 0, false, false);
            CTLM.AddItem(txtExpedicion, "Expedicion", pSearch: true);
            //empty header values
            CTLM.AddItem(Values.gDatos.User, "Usuario_Proceso", true, false, false, pDefValue: Values.gDatos.User, pSPAddParamName: "usuario");
            CTLM.AddItem(DateTime.Now.ToString(), "Start_time", true, false, false, pDefValue: DateTime.Now.ToString(), pSPAddParamName: "start");
            CTLM.AddItem(DateTime.Now.ToString(), "End_time", true, false, false, pDefValue: DateTime.Now.ToString(), pSPAddParamName: "end");

            //fields
            cboServicio.Source("Select Codigo,Nombre from Servicios where dbo.CheckFlag(flags,'SIMPLE')=1 and cod3='" + Values.COD3 + "' order by codigo", txtDesServicio);
            cboServicio.SelectedValueChanged += CboServicio_SelectedValueChanged;

            //VS Definitions
            VS.Conn    = Values.gDatos;
            VS.sSPAdd  = "PAdd_Det_Ordenes_Produccion";
            VS.sSPUpp  = "PUpp_Det_Ordenes_Produccion";
            VS.sSPDel  = "PDel_Det_Ordenes_Produccion";
            VS.DBTable = "Det_Ordenes_Produccion";

            //VS Details
            VS.AddColumn("Numero", txtNumero, "@numero", "@numero", "@numero", pVisible: false);
            VS.AddColumn("Linea", "Linea", "", "@linea", "@linea");
            VS.AddColumn("PartNumber", "partnumber", "@partnumber", pSortable: true, pWidth: 90, aMode: AutoCompleteMode.SuggestAppend, aSource: AutoCompleteSource.CustomSource, aQuery: string.Format("select partnumber from referencias where servicio='{0}'", cboServicio.Value));
            VS.AddColumn("Descripcion", "descripcion", "@descripcion", pSortable: true, pWidth: 200);
            VS.AddColumn("Servicio", cboServicio, "@Servicio", pVisible: false);
            VS.AddColumn("Qty", "Qty", "@qty", "@qty", pWidth: 90);
            VS.AddColumn("Qty_ord", "Qty_Ord", "@Qty_ord", pVisible: false);
            VS.AddColumn("QTY_Embalajes", "QTY_Embalajes", "@QTY_Embalajes", "@QTY_Embalajes", pVisible: false);
            VS.AddColumn("PPM", "Qty_pzas_modulo", "@ppm", "@ppm", pVisible: false);
            VS.AddColumn("PPB", "Qty_pzas_pallet", "@ppb", "@ppb", pVisible: false);
            VS.AddColumn("BB2", "qty_pzas_block2", "@bb2", "@bb2", pVisible: false);
            VS.AddColumn("MOD", "mod", "@mod", "@mod", pVisible: false);
            VS.AddColumn("BLOCK", "block", "@block", "@block", pVisible: false);
            VS.AddColumn("BLOCK2", "block2", "@block2", "@block2", pVisible: false);

            //Various
            VS.CellEndEdit += VS_CellEndEdit;
            CTLM.AddDefaultStatusStrip();
            CTLM.AddItem(VS);
            CTLM.Start();
        }
Exemplo n.º 19
0
    private static async Task <TextFilterFactory> CreateTextFilterFactoryAsync()
    {
        IPatternMatcherFactory patternMatcherFactory;


        patternMatcherFactory = await VS.GetMefServiceAsync <IPatternMatcherFactory>();

        return((pattern, isRegularExpression) => isRegularExpression
            ? new RegexTextFilter(pattern)
            : new PatternTextFilter(pattern, patternMatcherFactory));
    }
        public override async Task <FrameworkElement> CreateAsync(int toolWindowId, CancellationToken cancellationToken)
        {
            // Simulate long running background task
            await Task.Delay(2000);

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            DTE2 dte = await VS.GetDTEAsync();

            return(new RunnerWindowControl(dte));
        }
Exemplo n.º 21
0
        /// <summary>
        /// Converts a <see cref="IVsHierarchy"/> to a <see cref="IVsHierarchyItem"/>.
        /// </summary>
        public static IVsHierarchyItem ToHierarchyItem(this IVsHierarchy hierarchy, uint itemId)
        {
            if (hierarchy == null)
            {
                throw new ArgumentNullException(nameof(hierarchy));
            }

            IVsHierarchyItemManager manager = VS.GetMefService <IVsHierarchyItemManager>();

            return(manager.GetHierarchyItem(hierarchy, itemId));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Converts a <see cref="IVsHierarchy"/> to a <see cref="IVsHierarchyItem"/>.
        /// </summary>
        public static async Task <IVsHierarchyItem> ToHierarchyItemAsync(this IVsHierarchy hierarchy, uint itemId)
        {
            if (hierarchy == null)
            {
                throw new ArgumentNullException(nameof(hierarchy));
            }

            IVsHierarchyItemManager manager = await VS.GetMefServiceAsync <IVsHierarchyItemManager>();

            return(manager.GetHierarchyItem(hierarchy, itemId));
        }
Exemplo n.º 23
0
        //public EspackFileDataContainer FdcData { get; set; } = new EspackFileDataContainer();

        public fDocumentControl()
        {
            InitializeComponent();
            //try
            //{
            //CTLM definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "pDocumentsCabAdd";
            CTLM.DBTable = "vDocumentControl";

            //var txtFileName = (EspackTextBox)fsFileData;
            var FdcData = new EspackFileDataContainer();

            //file containers
            fsFileData.FileData    = FdcData;
            fsFileData.PDFFileData = FdcPDFData;
            //Header
            CTLM.AddItem(txtDocumentCode, "DocumentCode", CTLMControlTypes.NoAddPK);
            CTLM.AddItem(txtTypeCode, "TypeCode", CTLMControlTypes.AddSearch);
            CTLM.AddItem(txtSubtype, "SubTypeCode", CTLMControlTypes.AddSearch);
            CTLM.AddItem(txtSection, "SectionCode", CTLMControlTypes.AddSearch);
            CTLM.AddItem(txtTitle, "Title", CTLMControlTypes.AddSearch);
            CTLM.AddItem(fsFileData, "DocumentFileName", CTLMControlTypes.AddSearch);
            CTLM.AddItem(FdcData, "DATA", CTLMControlTypes.AddNoSearch);
            CTLM.AddItem(FdcPDFData, "PDFDATA", CTLMControlTypes.AddNoSearch);
            CTLM.AddItem(txtEdition, "Edition", CTLMControlTypes.Search);
            CTLM.AddItem(txtStatus, "Status", CTLMControlTypes.Search);
            CTLM.AddItem(lstFlags, "flags", CTLMControlTypes.AddSearch);

            //Fields
            lstFlags.Source("Select codigo,DescFlagEng from flags where Tabla='DocumentsCab'");
            fsFileData.Click += BtnSearch_Click;
            VS.Conn           = Values.gDatos;
            VS.SQL            = "Select TypeCode,SectionCode,Title from DocumentsCab ";
            VS.Start();

            //Resize += FDocumentControl_Resize;

            VS.UpdateEspackControl();
            //CTLM.AddItem(VS);
            //start
            CTLM.ReQuery = true;
            CTLM.AddDefaultStatusStrip();
            CTLM.Start();
            //VS.AddFilterCell(EspackCellTypes.WILDCARDTEXT, 0, "Select distinct TypeCode from DocumentsCab order by TypeCode");
            this.Load += FDocumentControl_Load;
            var c = VS.DataCellCollection;
            //AcroPDFLib.AcroPDF acroPDF = new AcroPDFLib.AcroPDFClass();
            //} catch (Exception ex)
            //{
            //    CommonToolsWin.CTWin.MsgError(String.Format("Error 1: {0}\nError 2: {1}",ex.Message, ex.InnerException?.Message?? ""));
            //}
        }
Exemplo n.º 24
0
        /// <summary>
        /// Converts a <see cref="IVsHierarchy"/> to a <see cref="IVsHierarchyItem"/>.
        /// </summary>
        /// <returns>Returns <see langword="null"/> if unable to get the hierarchy item.</returns>
        public static IVsHierarchyItem?ToHierarchyItem(this IVsHierarchy hierarchy, uint itemId)
        {
            if (hierarchy == null)
            {
                return(null);
            }

            IVsHierarchyItemManager?manager = VS.GetMefService <IVsHierarchyItemManager>();

            manager.TryGetHierarchyItem(hierarchy, itemId, out IVsHierarchyItem? item);
            return(item);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Converts a <see cref="IVsHierarchy"/> to a <see cref="IVsHierarchyItem"/>.
        /// </summary>
        /// <returns>Returns <see langword="null"/> if unable to get the hierarchy item.</returns>
        public static async Task <IVsHierarchyItem?> ToHierarchyItemAsync(this IVsHierarchy hierarchy, uint itemId)
        {
            if (hierarchy == null)
            {
                return(null);
            }

            IVsHierarchyItemManager?manager = await VS.GetMefServiceAsync <IVsHierarchyItemManager>();

            manager.TryGetHierarchyItem(hierarchy, itemId, out IVsHierarchyItem? item);
            return(item);
        }
Exemplo n.º 26
0
        private void GoToDefinition()
        {
            Position current = new Position();

            current.Save();
            current.ClearUpTo(CommandEnd);

            Console.WriteLine();

            LocationWithinFile p = VS.GetCurrentLocation(Options.DatabasePath);

            if (p == null)
            {
                Console.WriteLine("Unable to find current cursor position.");
                return;
            }
            else
            {
                Console.WriteLine("Finding Symbol at {0}({1}, {2})", p.FilePath, p.Line, p.CharInLine);
            }

            RoslynDefinitionFinder finder = new RoslynDefinitionFinder(p.FilePath, this.References);
            MemberQuery            query  = finder.BuildQueryForMemberUsedAt(p.Line, p.CharInLine);

            query.IgnoreCase = Options.IgnoreCase;

            if (query == null)
            {
                Console.WriteLine("Unable to identify symbol.");
                return;
            }

            Console.Write("Roslyn identified as {0}", query.SymbolName);
            if (query.Parameters.Length > 0)
            {
                Console.Write("({0})", query.Parameters);
            }
            Console.WriteLine();

            PartialArray <Symbol> results = new PartialArray <Symbol>(1);

            if (query.TryFindMembers(this.Database, ref results))
            {
                OpenSymbol(results[0]);
            }
            else
            {
                Console.WriteLine("NOT FOUND");
            }

            CommandEnd.Save();
        }
Exemplo n.º 27
0
        //
        public fAlias()
        {
            InitializeComponent();

            //CTLM Definitions
            CTLM.Conn    = Values.gDatos;
            CTLM.sSPAdd  = "MAIL..pAddAliasCAB";
            CTLM.sSPUpp  = "MAIL..pUppAliasCAB";
            CTLM.sSPDel  = "MAIL..pDelAliasCAB";
            CTLM.DBTable = "MAIL..aliasCAB";

            //Header
            CTLM.AddItem(txtAddress, "Address", true, true, true, 1, true, true);
            CTLM.AddItem(txtLocalPart, "Local_Part");
            CTLM.AddItem(txtDomain, "Domain");
            CTLM.AddItem(lstFlags, "flags", true, true, false, 0, false, true);
            CTLM.AddItem(lstCOD3, "COD3", true, true, false, 0, false, true);

            lstFlags.Source("select codigo,descFlagEng from mail..flags where tabla='aliasCAB' order by DescFlagEng");
            lstCOD3.Source("select n.COD3,g.Descripcion from NetworkSedes n inner join general..sedes g on g.cod3=n.COD3 order by n.Cod3");

            //VS Definitions
            VS.Conn                = Values.gDatos;
            VS.sSPAdd              = "MAIL..pAddAliasDET";
            VS.sSPUpp              = "";
            VS.sSPDel              = "MAIL..pDelAliasDet";
            VS.DBTable             = "MAIL..aliasDET";
            VS.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            //Details
            VS.AddColumn("Address", txtAddress, "@Address", "", "@Address", pVisible: false);
            VS.AddColumn("Destinations", "gotoAddress", "@gotoAddress", "", "@gotoAddress", false, false, false, pWidth: 200, aMode: AutoCompleteMode.SuggestAppend, aSource: AutoCompleteSource.CustomSource, aQuery: "select email from mail..vEmailListAll order by email");



            //VS Definitions
            VSExceptions.Conn                = Values.gDatos;
            VSExceptions.sSPAdd              = "MAIL..pAddAliasExceptionsDET";
            VSExceptions.sSPUpp              = "";
            VSExceptions.sSPDel              = "MAIL..pDelAliasExceptionsDet";
            VSExceptions.DBTable             = "MAIL..aliasExceptionsDET";
            VSExceptions.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            //Details
            VSExceptions.AddColumn("Address", txtAddress, "@Address", "", "@Address", pVisible: false);
            VSExceptions.AddColumn("Exceptions", "gotoAddress", "@gotoAddress", "", "@gotoAddress", false, false, false, pWidth: 200, aMode: AutoCompleteMode.SuggestAppend, aSource: AutoCompleteSource.CustomSource, aQuery: "select email from mail..vEmailListAll order by email");

            //Various
            CTLM.AddDefaultStatusStrip();
            CTLM.AddItem(VS);
            CTLM.AddItem(VSExceptions);
            CTLM.Start();
        }
Exemplo n.º 28
0
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            var webservice = await VS.GetServiceAsync <SVsWebBrowsingService, IVsWebBrowsingService>();

            if (webservice != null)
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                string         url   = "https://www.xsharp.eu";
                IVsWindowFrame frame = null;
                webservice.Navigate(url, (uint)(__VSWBNAVIGATEFLAGS.VSNWB_WebURLOnly | __VSWBNAVIGATEFLAGS.VSNWB_ForceNew), out frame);
                frame.Show();
            }
        }
Exemplo n.º 29
0
        private void OpenSymbol(Symbol matchToOpen)
        {
            string localPath = SourceFileMap.GetLocalPath(matchToOpen);

            if (String.IsNullOrEmpty(localPath))
            {
                Console.WriteLine("ERROR: File Path unknown for '{0}'.", matchToOpen.Name.ToString());
            }
            else
            {
                Console.WriteLine("OPEN: {0}({1})", localPath, matchToOpen.Line);
                VS.OpenFileToLine(localPath, matchToOpen.Line, Options.DatabasePath);
            }
        }
Exemplo n.º 30
0
    void Start()
    {
        MyBol      Bol   = (x, y) => x == y;
        MyBol_2    Bol_2 = (x, s) => s.Length > x;
        calculator C     = (X, Y) => X * Y;
        VS         S     = () => Debug.Log("我是无参数Labada表达式");

        //
        int[] numbers    = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
        int   oddNumbers = numbers.Count(n => n % 2 == 1);
        //
        List <People>        people  = LoadData();//初始化
        IEnumerable <People> results = people.Where(delegate(People p) { return(p.age > 20); });
    }