public void OpenLog()
 {
     mOutputWin = mApplication.ToolWindows.OutputWindow;
     try
     {
         mPane = mOutputWin.OutputWindowPanes.Item("C++ Helper Output");
     }
     catch (Exception)
     {
         mPane = mOutputWin.OutputWindowPanes.Add("C++ Helper Output");
     }
 }
示例#2
0
 public Inflater(bool noHeader)
 {
     this.noHeader = noHeader;
     this.adler = new Adler32();
     this.input = new StreamManipulator();
     this.outputWindow = new OutputWindow();
     this.mode = noHeader ? 2 : 0;
 }
        private OutputWindowPane OutputWindowPaneExist(OutputWindow outputWindow)
        {
            foreach (OutputWindowPane pane in outputWindow.OutputWindowPanes)
            {
                if (pane.Name.Equals(Resources.OutputWindowPaneName))
                {
                    return pane;
                }
            }

            return null;
        }
示例#4
0
    protected override void Initialize()
    {
      lock (_s_applicationLock)
      {
        Application = (DTE2)GetService(typeof(SDTE));
        _events = Application.Application.Events;
        _dteEvents = _events.DTEEvents;
        _documentEvents = _events.DocumentEvents;

        var win =
          Application.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
        _outputWindow = win.Object as OutputWindow;
        if (_outputWindow != null)
        {
          _karmaOutputWindowPane =
            _outputWindow.OutputWindowPanes.Add("Karma");
        }
        _dteEvents.OnBeginShutdown += ShutdownKarma;
        _events.SolutionEvents.Opened += SolutionEventsOpened;

      }

      base.Initialize();

      // Add our command handlers for menu (commands must exist in .vsct file)
      var mcs =
        GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
      if (null == mcs) return;

      // Create the command for the menu item.
      var menuCommandId1 =
        new CommandID(
          GuidList.guidToggleKarmaVsUnitCmdSet,
          (int)PkgCmdIDList.cmdidToggleKarmaVsUnit
        );
      var menuItem1 = new MenuCommand(KarmaVsUnit, menuCommandId1);
      mcs.AddCommand(menuItem1);

      // Create the command for the menu item.
      var menuCommandId2 =
        new CommandID(
          GuidList.guidToggleKarmaVsE2eCmdSet,
          (int)PkgCmdIDList.cmdidToggleKarmaVsE2e
        );
      var menuItem2 = new MenuCommand(KarmaVsE2e, menuCommandId2);
      mcs.AddCommand(menuItem2);
    }
        protected override void OnExecute(object param)
        {
            ////OutputWindow ow = (LifetimeService.Instance.Container.Resolve<IOutputWindow>()) as OutputWindow;
            //////IUIController controller = (LifetimeService.Instance.Container.Resolve<IUIController>();
            //Window1 window = LifetimeService.Instance.Container.Resolve<Window1>();//App's main window

            ///// Get the reference of the output window container  /////
            OutputWindowContainer owc = (LifetimeService.Instance.Container.Resolve<IOutputWindowContainer>()) as OutputWindowContainer;
            IOutputWindow iow = new OutputWindow(); // create new output window
            ///  add new output window to the window container. This window will become active window
            owc.AddOutputWindow(iow);

            //owc.ActiveOutputWindow = iow;//setting as default
            //Window temp = iow as Window;
            //temp.Owner = window;
            //temp.Show();

        }
示例#6
0
        private void miOutput_Click(object sender, RoutedEventArgs e)
        {
            OutputWindow window = new OutputWindow(account, electricScaleProfile, factory);

            window.Show();
        }
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => {
                Isloaded = true;
                if (p == null)
                {
                    return;
                }

                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();
                if (loginWindow == null)
                {
                    return;
                }
                var loginVM = loginWindow.DataContext as LoginViewModel;
                if (loginVM.Islogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            UnitWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow Unitwd = new UnitWindow(); Unitwd.ShowDialog(); });
            SupplierWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SupplierWindow Supplierwd = new SupplierWindow(); Supplierwd.ShowDialog(); });
            CustomerWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomerWindow Cuswd = new CustomerWindow(); Cuswd.ShowDialog(); });
            ObjectWindowCommand   = new RelayCommand <object>((p) => { return(true); }, (p) => { ObjectWindow Objwd = new ObjectWindow(); Objwd.ShowDialog(); });
            UserWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UserWindow Userwd = new UserWindow(); Userwd.ShowDialog(); });
            InputWindowCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow Inputwd = new InputWindow(); Inputwd.ShowDialog(); });
            OutputWindowCommand   = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow Outputwd = new OutputWindow(); Outputwd.ShowDialog(); });
        }
示例#8
0
        static unsafe void HgtTest()
        {
            const string TestFile = "../../../N00E032.hgt";

            if (!File.Exists(TestFile))
            {
                throw new FileNotFoundException(TestFile);
            }

            var raw       = File.ReadAllBytes(TestFile);
            var rawValues = Enumerable.Range(0, raw.Length / 2).Select(i => (short)(ushort)(raw[i * 2] << 8 | raw[i * 2 + 1])).ToArray();

            Console.WriteLine();

            // --- Raw-Data ---
            Console.WriteLine("    Raw Size: {0:N0} Bytes", raw.Length);
            Console.WriteLine();

            // --- GZip (level 9) ---
            Console.WriteLine("     Gnu-Zip: {0:N0} Bytes", GZipTest(raw));
            Console.WriteLine();

            // --- Delta-GZip ---
            var deltaValues = new short[rawValues.Length];

            deltaValues[0] = rawValues[0];
            for (int i = 1; i < deltaValues.Length; i++)
            {
                deltaValues[i] = (short)(rawValues[i] - rawValues[i - 1]);
            }
            var deltaData = new byte[raw.Length];

            fixed(byte *deltaDataP = deltaData)
            fixed(short *deltaValuesP = deltaValues)
            {
                OutputWindow.CopyBytes((byte *)deltaValuesP, deltaDataP, deltaData.Length);
            }
            Console.WriteLine("  Delta-GZip: {0:N0} Bytes", GZipTest(deltaData));
            Console.WriteLine();

            // --- Protobuffer-Delta-GZip ---
            int outputProtoBytes = 0;
            var protoBuf         = new byte[deltaData.Length * 2];

            foreach (var val in deltaValues)
            {
                uint u = (uint)(val << 1 ^ val >> 31); // ZigZag
                if (u >= 128)
                {
                    protoBuf[outputProtoBytes++] = (byte)(128 | u & 127);
                    if ((u >> 7) >= 128)
                    {
                        protoBuf[outputProtoBytes++] = (byte)(128 | u >> 7 & 127);
                        if ((u >> 14) >= 128)
                        {
                            throw new IndexOutOfRangeException();
                        }
                        protoBuf[outputProtoBytes++] = (byte)(u >> 14);
                    }
                    else
                    {
                        protoBuf[outputProtoBytes++] = (byte)(u >> 7);
                    }
                }
                else
                {
                    protoBuf[outputProtoBytes++] = (byte)u;
                }
            }
            Array.Resize(ref protoBuf, outputProtoBytes);
            Console.WriteLine("  Proto-GZip: {0:N0} Bytes", GZipTest(protoBuf));
            Console.WriteLine();

            // --- Stats ---
            var stats      = string.Join("\r\n", rawValues.GroupBy(x => x).OrderBy(x => - x.Count()).Select(x => x.Key + ": " + x.Count()));
            var statsDelta = string.Join("\r\n", deltaValues.GroupBy(x => x).OrderBy(x => - x.Count()).Select(x => x.Key + ": " + x.Count()));
        }
示例#9
0
 private void SetupOutputWindow(DTE2 applicationObject)
 {
     window = applicationObject.Windows.Item(Constants.vsWindowKindOutput);
     outputWindow = (OutputWindow)window.Object;
     owp = outputWindow.OutputWindowPanes.Add("new pane");
     owp.OutputString("hello\n");
 }
 private static OutputWindowPane GetPane(OutputWindow outputWindow, string panelName)
 {
     if (!string.IsNullOrEmpty(panelName))
     {
         foreach (OutputWindowPane pane in outputWindow.OutputWindowPanes)
         {
             if (pane.Name.Equals(panelName, StringComparison.InvariantCultureIgnoreCase))
             {
                 return pane;
             }
         }
         return outputWindow.OutputWindowPanes.Add(panelName);
     }
     return outputWindow.ActivePane;
 }
 //17Jul2015 Remove command from History menu in OutputWindow whose reference is passed
 private void RemoveFromOutputWinHistory(OutputWindow ow )
 {
     ///Store executed command in "History" menu /// 04March2013
     UAMenuCommand command = (UAMenuCommand)parameter;
     if (ds != null)
         ow.History.RemoveCommand(ds.Name, command);
 }
示例#12
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            Mfconsulting.Vsprj2make.RegistryHelper regHlpr = new RegistryHelper();
            string[] monoVersions = regHlpr.GetMonoVersions();

            _applicationObject = (DTE2)application;
            _addInInstance     = (AddIn)addInInst;
            int selectedIndexForComboBox = 1;

            OutputWindow outputWindow = (OutputWindow)_applicationObject.Windows.Item(Constants.vsWindowKindOutput).Object;

            outputWindowPane = outputWindow.OutputWindowPanes.Add("Monoaddin Messages");

            if (connectMode == ext_ConnectMode.ext_cm_AfterStartup)
            {
                object [] contextGUIDS = new object[] { };
                Commands2 commands     = (Commands2)_applicationObject.Commands;
                string    toolsMenuName;

                _CommandBars    commandBars = (Microsoft.VisualStudio.CommandBars._CommandBars)_applicationObject.CommandBars;
                CommandBar      cmdBarMonoBarra;
                CommandBarPopup popMenu;        // Prj2Make popupmenu
                CommandBarPopup popMenu2;       // Explorer Current Project

                try
                {
                    //If you would like to move the command to a different menu, change the word "Tools" to the
                    //  English version of the menu. This code will take the culture, append on the name of the menu
                    //  then add the command to that menu. You can find a list of all the top-level menus in the file
                    //  CommandBar.resx.
                    ResourceManager resourceManager = new ResourceManager("monoaddin.CommandBar", Assembly.GetExecutingAssembly());
                    CultureInfo     cultureInfo     = new System.Globalization.CultureInfo(_applicationObject.LocaleID);
                    string          resourceName    = String.Concat(cultureInfo.TwoLetterISOLanguageName, "Tools");
                    toolsMenuName = resourceManager.GetString(resourceName);
                }
                catch
                {
                    //We tried to find a localized version of the word Tools, but one was not found.
                    //  Default to the en-US word, which may work for the current culture.
                    toolsMenuName = "Tools";
                }

                //Place the command on the tools menu.
                //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
                Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = (
                    (Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)["MenuBar"];

                //Find the Tools command bar on the MenuBar command bar:
                CommandBarControl  toolsControl = menuBarCommandBar.Controls[toolsMenuName];
                CommandBarControls commandBarControls;
                commandBarControls = ((CommandBarPopup)toolsControl).Controls;


                // Create Makefile
                Command command1 = null;
                // Generate MonoDevelop files
                Command command2 = null;
                // Generate a distribution unit
                Command command3 = null;
                // Import MonoDevelop Solutions
                Command command4 = null;
                // Run on Mono
                Command command5 = null;
                // vsprj2make Options
                Command command6 = null;
                // Explore current solution
                Command command7 = null;
                // Explore current Project
                Command command8 = null;


                // ------------- Add Pop-up menu ----------------
                popMenu2 = (CommandBarPopup)commandBarControls.Add(
                    MsoControlType.msoControlPopup,
                    System.Reflection.Missing.Value, // Object ID
                    System.Reflection.Missing.Value, // Object parameters
                    1,                               // Object before
                    true
                    );

                popMenu2.Caption = "&Windows Explore";

                // ------------- Add Pop-up menu ----------------
                popMenu = (CommandBarPopup)commandBarControls.Add(
                    MsoControlType.msoControlPopup,
                    System.Reflection.Missing.Value, // Object ID
                    System.Reflection.Missing.Value, // Object parameters
                    1,                               // Object before
                    true
                    );

                popMenu.Caption = "Prj&2Make";

                //This try/catch block can be duplicated if you wish to add multiple commands to be handled by your Add-in,
                //  just make sure you also update the QueryStatus/Exec method to include the new command names.
                try
                {
                    // Add the create makefile command -- command1
                    //command1 = commands.AddNamedCommand2(
                    //    _addInInstance, "CreateMake", "Create &Makefile",
                    //    "Generate Makefile", true, 59, ref contextGUIDS,
                    //    (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled,
                    //    (int)vsCommandStyle.vsCommandStylePictAndText,
                    //    vsCommandControlType.vsCommandControlTypeButton
                    //);

                    // Add the create makefile command -- command1
                    command1 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "CreateMake",
                        "Create &Makefile",
                        "Generate Makefile",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command1 == null) && (popMenu != null))
                    {
                        command1 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.CreateMake");
                        command1.AddControl(popMenu.CommandBar, 1);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    //If we are here, then the exception is probably because a command with that name
                    //  already exists. If so there is no need to recreate the command and we can
                    //  safely ignore the exception.
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the GenMDFiles command -- command2
                    command2 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "GenMDFiles",
                        "Create Mono&Develop Solution",
                        "Generate MonoDevelop Solution",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command2 == null) && (popMenu != null))
                    {
                        command2 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.GenMDFiles");
                        command2.AddControl(popMenu.CommandBar, 2);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the generate a dist unit command -- command3
                    command3 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "GenDistUnit",
                        "Generate Distribution &Unit",
                        "Generates a distribution unit (zip file)",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command3 == null) && (popMenu != null))
                    {
                        command3 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.GenDistUnit");
                        command3.AddControl(popMenu.CommandBar, 3);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the ImportMD Solution command -- command4
                    command4 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "PrjxToCsproj",
                        "&Import MonoDevelop Solution...",
                        "Imports a MonoDevelop Solution",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command4 == null) && (popMenu != null))
                    {
                        command4 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.PrjxToCsproj");
                        command4.AddControl(popMenu.CommandBar, 4);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the Run on Mono command -- command5
                    command5 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "RunOnMono",
                        "&Run on Mono",
                        "Run solution on mono",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command5 == null) && (popMenu != null))
                    {
                        command5 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.RunOnMono");
                        command5.AddControl(popMenu.CommandBar, 5);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the Options command -- command6
                    command6 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "Options",
                        "&Options...",
                        "Options for prj2make Add-in",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command6 == null) && (popMenu != null))
                    {
                        command6 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.Options");
                        command6.AddControl(popMenu.CommandBar, 6);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the ExploreCurrSln command -- command7
                    command7 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "ExploreCurrSln",
                        "Current &Solution",
                        "Explore the current solution",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command7 == null) && (popMenu != null))
                    {
                        command7 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.ExploreCurrSln");
                        command7.AddControl(popMenu2.CommandBar, 1);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                try
                {
                    // Add the ExploreCurrDoc command -- command8
                    command8 = CreateNamedCommand(
                        _addInInstance,
                        commands,
                        "ExploreCurrDoc",
                        "Current &Document",
                        "Explore the current Document",
                        ref contextGUIDS
                        );

                    //Add a control for the command to the tools menu:
                    if ((command8 == null) && (popMenu != null))
                    {
                        command8 = GetExistingNamedCommand(commands, "Mfconsulting.Vsprj2make.Connect.ExploreCurrDoc");
                        command8.AddControl(popMenu2.CommandBar, 2);
                    }
                }
                catch (System.ArgumentException exc)
                {
                    Trace.WriteLine(String.Format("Error during OnConnect of Add-in:\n {0}", exc.Message));
                }

                // Mono Toolbar
                CommandBar cmdBarBuild = (CommandBar)commandBars["Build"];

                try
                {
                    cmdBarMonoBarra = (CommandBar)commandBars["MonoBarra"];
                }
                catch (Exception)
                {
                    commands.AddCommandBar("MonoBarra",
                                           vsCommandBarType.vsCommandBarTypeToolbar,
                                           cmdBarBuild,
                                           1
                                           );

                    cmdBarMonoBarra         = (CommandBar)commandBars["MonoBarra"];
                    cmdBarMonoBarra.Visible = true;
                }

                if (testInMonoCommandBarButton == null)
                {
                    // Create the Run on Mono Button
                    testInMonoCommandBarButton = (CommandBarButton)cmdBarMonoBarra.Controls.Add(
                        Microsoft.VisualStudio.CommandBars.MsoControlType.msoControlButton,
                        System.Reflection.Missing.Value,
                        System.Reflection.Missing.Value,
                        1,
                        false
                        );

                    testInMonoCommandBarButton.Caption         = "Run on &Mono";
                    testInMonoCommandBarButton.DescriptionText = "Run solution with the mono runtime";
                    testInMonoCommandBarButton.TooltipText     = "Run on mono";
                    testInMonoCommandBarButton.ShortcutText    = "Run on &Mono";
                    testInMonoCommandBarButton.Style           = MsoButtonStyle.msoButtonCaption;
                    testInMonoCommandBarButton.Click          += new _CommandBarButtonEvents_ClickEventHandler(testInMonoCommandBarButton_Click);
                }

                if (versionComboBox == null)
                {
                    // Create the combobox
                    versionComboBox = (CommandBarComboBox)cmdBarMonoBarra.Controls.Add(
                        Microsoft.VisualStudio.CommandBars.MsoControlType.msoControlDropdown,
                        System.Reflection.Missing.Value,
                        System.Reflection.Missing.Value,
                        2,
                        false
                        );

                    for (int i = 0; i < monoVersions.Length; i++)
                    {
                        versionComboBox.AddItem(monoVersions[i], i + 1);
                        if (monoVersions[i].CompareTo(regHlpr.GetDefaultClr()) == 0)
                        {
                            selectedIndexForComboBox = i + 1;
                        }
                    }

                    versionComboBox.Change += new _CommandBarComboBoxEvents_ChangeEventHandler(versionComboBox_Change);

                    // Select the active index based on
                    // the current mono version
                    versionComboBox.ListIndex = selectedIndexForComboBox;
                }
            }
        }
示例#13
0
 private void OutputWindow_TextChanged(object sender, TextChangedEventArgs e)
 {
     OutputWindow.ScrollToEnd();
 }
示例#14
0
        public NativeData(string filename, DTE dte, OutputWindow output)
        {
            // Get file date (for modified checks)
            FileDate = new System.IO.FileInfo(filename).LastWriteTimeUtc;

            // Read file:
            using (var sr = new System.IO.StreamReader(filename))
            {
                string name = sr.ReadLine();
                while (name != null)
                {
                    if (name.StartsWith("FILE: "))
                    {
                        string currentFile = name.Substring("FILE: ".Length);
                        // If relative, we add solutionDir to relative directory.
                        if (!System.IO.Path.IsPathRooted(currentFile))
                        {
                            // Here: we can add a list of ordered registered folders and try to find file inside.
                            string solutionDir = System.IO.Path.GetDirectoryName(dte.Solution.FullName);
                            currentFile = System.IO.Path.Combine(solutionDir, currentFile);

                            if (!System.IO.File.Exists(currentFile))
                            {
                                output.WriteLine("Impossible to find into solution: {0}", currentFile);
                            }
                        }

                        string cov = sr.ReadLine();

                        if (cov.StartsWith("RES: "))
                        {
                            cov = cov.Substring("RES: ".Length);

                            BitVector currentVector = new Data.BitVector();

                            for (int i = 0; i < cov.Length; ++i)
                            {
                                char c = cov[i];
                                if (c == 'c' || c == 'p')
                                {
                                    currentVector.Set(i + 1, true);
                                }
                                else if (c == 'u')
                                {
                                    currentVector.Set(i + 1, false);
                                }
                                else
                                {
                                    currentVector.Ensure(i + 1);
                                }
                            }

                            ProfileVector currentProfile = new Data.ProfileVector(currentVector.Count);

                            string prof = sr.ReadLine();
                            if (prof.StartsWith("PROF: "))
                            {
                                prof = prof.Substring("PROF: ".Length);
                                int line = 0;

                                for (int i = 0; i < prof.Length;)
                                {
                                    int deep = 0;
                                    while (i < prof.Length && prof[i] != ',')
                                    {
                                        char c = prof[i];
                                        deep = deep * 10 + (c - '0');
                                        ++i;
                                    }
                                    ++i;

                                    int shallow = 0;
                                    while (i < prof.Length && prof[i] != ',')
                                    {
                                        char c = prof[i];
                                        shallow = shallow * 10 + (c - '0');
                                        ++i;
                                    }
                                    ++i;

                                    currentProfile.Set(line, deep, shallow);
                                    ++line;
                                }
                            }
                            else
                            {
                                name = prof;
                                continue;
                            }

                            try
                            {
                                lookup.Add(currentFile.ToLower(), new Tuple <BitVector, ProfileVector>(currentVector, currentProfile));
                            }
                            catch (Exception e)
                            {
                                output.WriteLine("Error loading coverage report: {0} with key {1}", e.Message, currentFile.ToLower());
                            }
                        }
                    }
                    // otherwise: ignore; grab next line

                    name = sr.ReadLine();
                }
            }
        }
示例#15
0
        public void ThenTheProjectShouldBuildAndItsTestsRunSuccessfully()
        {
            Trace.WriteLine("Building solution");

            AutoResetEvent autoResetEvent = new AutoResetEvent(false);

            bool buildSucceeded = false;

            this.dte.Events.BuildEvents.OnBuildProjConfigDone += (project, projectConfig, platform, solutionConfig, success) =>
            {
                Trace.WriteLine(
                    string.Format(
                        "Project {0} Project Configuration {1} Platform {2} Solution Configuration {3} Success {4}",
                        project,
                        projectConfig,
                        platform,
                        solutionConfig,
                        success));

                buildSucceeded = success;

                autoResetEvent.Set();
            };

            this.dte.ExecuteCommand("Build.RebuildSolution");

            autoResetEvent.WaitOne();

            Trace.WriteLine("Done building solution");

            if (!buildSucceeded)
            {
                const string buildOutputPaneGuid = "{1BD8A850-02D1-11D1-BEE7-00A0C913D1F8}";

                Window vsWindow = this.dte.Windows.Item(Constants.vsWindowKindOutput);

                OutputWindowPane objBuildOutputWindowPane = null;

                OutputWindow vsOutputWindow = (OutputWindow)vsWindow.Object;

                foreach (OutputWindowPane objOutputWindowPane in vsOutputWindow.OutputWindowPanes)
                {
                    if (objOutputWindowPane.Guid.ToUpper() == buildOutputPaneGuid)
                    {
                        objBuildOutputWindowPane = objOutputWindowPane;
                    }
                }

                Assert.IsNotNull(objBuildOutputWindowPane);

                TextDocument  txtOutput    = objBuildOutputWindowPane.TextDocument;
                TextSelection txtSelection = txtOutput.Selection;

                txtSelection.StartOfDocument();
                txtSelection.EndOfDocument(true);

                txtSelection = txtOutput.Selection;

                Assert.IsTrue(buildSucceeded, txtSelection.Text);
            }

            this.RunAllTests();
        }
示例#16
0
        private void ProjectContextMenuItemCallback(object sender, EventArgs e)
        {
            var dte = GetDTE().DTE;

            OutputWindow outputWindow = null;

            try
            {
                outputWindow = new OutputWindow(dte);

                OleMenuCommand menuCommand = sender as OleMenuCommand;
                if (menuCommand != null && dte != null)
                {
                    Array selectedProjects = (Array)dte.ActiveSolutionProjects;
                    //only support 1 selected project
                    if (selectedProjects.Length == 1)
                    {
                        EnvDTE.Project project = (EnvDTE.Project)selectedProjects.GetValue(0);
                        var            vcproj  = project.Object as VCProject;
                        if (vcproj != null)
                        {
                            IVCCollection   configs = (IVCCollection)vcproj.Configurations;
                            VCConfiguration cfg     = (VCConfiguration)vcproj.ActiveConfiguration;
                            VCDebugSettings debug   = (VCDebugSettings)cfg.DebugSettings;

                            string command          = null;
                            string arguments        = null;
                            string workingDirectory = null;
                            if (debug != null)
                            {
                                command          = cfg.Evaluate(debug.Command);
                                workingDirectory = cfg.Evaluate(debug.WorkingDirectory);
                                arguments        = cfg.Evaluate(debug.CommandArguments);
                            }

                            VCPlatform currentPlatform = (VCPlatform)cfg.Platform;

                            string platform = currentPlatform == null ? null : currentPlatform.Name;
                            if (platform != null)
                            {
                                platform = platform.ToLower();
                                if (platform.Contains("x64"))
                                {
                                    platform = "x64";
                                }
                                else if (platform.Contains("x86") || platform.Contains("win32"))
                                {
                                    platform = "x86";
                                }
                                else
                                {
                                    throw new NotSupportedException("Platform is not supported.");
                                }
                            }
                            else
                            {
                                cfg      = (VCConfiguration)configs.Item("Debug|x64");
                                platform = "x64";

                                if (cfg == null)
                                {
                                    throw new NotSupportedException("Cannot find x64 platform for project.");
                                }
                            }

                            if (command == null || String.IsNullOrEmpty(command))
                            {
                                command = cfg.PrimaryOutput;
                            }

                            if (command != null)
                            {
                                var solutionFolder = System.IO.Path.GetDirectoryName(dte.Solution.FileName);

                                CoverageExecution executor = new CoverageExecution(dte, outputWindow);
                                executor.Start(
                                    solutionFolder,
                                    platform,
                                    System.IO.Path.GetDirectoryName(command),
                                    System.IO.Path.GetFileName(command),
                                    workingDirectory,
                                    arguments);
                            }
                        }
                    }
                }
            }
            catch (NotSupportedException ex)
            {
                if (outputWindow != null)
                {
                    outputWindow.WriteLine("Error running coverage: {0}", ex.Message);
                }
            }
            catch (Exception ex)
            {
                if (outputWindow != null)
                {
                    outputWindow.WriteLine("Unexpected code coverage failure; error: {0}", ex.ToString());
                }
            }
        }
示例#17
0
        /// <summary>
        /// Displays the TRACE pragma messages of the compiler
        /// </summary>
        private static void DisplayTraceMessage(object sender, AssemblerMessageArgs e)
        {
            var pane = OutputWindow.GetPane <Z80BuildOutputPane>();

            pane.WriteLine($"TRACE: {e.Message}");
        }
示例#18
0
        void PanelsSetUp()
        {
            dockPanel1.BringToFront();
            dockPanel1.Dock = DockStyle.Fill;

            OutputWindow output = new OutputWindow();

            output.VisibleChanged += delegate(object sender, EventArgs e) { outputWindowToolStripMenuItem.Checked = ((DockContent)sender).Visible; };
            output.FormClosing    += pane_FormClosing;
            output.Show(dockPanel1);

            DockContent pane;

            //set up docking for the PropertyGrid
            Controls.Remove(PropertyGrid);
            pane      = new DockContent();
            pane.Icon = Icon.FromHandle(Properties.Resources.Properties.GetHicon());
            pane.Controls.Add(PropertyGrid);
            pane.DockAreas = DockAreas.DockRight |
                             DockAreas.DockLeft |
                             DockAreas.Float;
            PropertyGrid.Dock     = DockStyle.Fill;
            pane.Text             = @"Csla Object Info";
            pane.VisibleChanged  += delegate(object sender, EventArgs e) { objectPropertiesPanelToolStripMenuItem.Checked = ((DockContent)sender).Visible; };
            pane.FormClosing     += pane_FormClosing;
            propertyGridDockPanel = pane;
            pane.Show(dockPanel1);
            //set up docking for the web browser
            this.Controls.Remove(webBrowser1);
            pane = new DockContent();
            pane.Controls.Add(webBrowser1);
            webBrowser1.Dock     = DockStyle.Fill;
            pane.DockAreas       = DockAreas.Float | DockAreas.Document;
            pane.MdiParent       = this;
            pane.Text            = @"Start Page";
            pane.VisibleChanged += delegate(object sender, EventArgs e) { mainPageToolStripMenuItem.Checked = ((DockContent)sender).Visible; };
            pane.FormClosing    += pane_FormClosing;
            webBrowserDockPanel  = pane;
            pane.Show(dockPanel1);

            //set up docking for the object relations builder
            Controls.Remove(objectRelationsBuilder);
            pane = new DockContent();
            pane.Controls.Add(objectRelationsBuilder);
            objectRelationsBuilder.Dock = DockStyle.Fill;
            pane.DockAreas                  = DockAreas.Float | DockAreas.Document;
            pane.MdiParent                  = this;
            pane.Text                       = @"Object Relations Builder";
            pane.VisibleChanged            += delegate(object sender, EventArgs e) { objectRelationsBuilderPageToolStripMenuItem.Checked = ((DockContent)sender).Visible; };
            pane.FormClosing               += pane_FormClosing;
            objectRelationsBuilderDockPanel = pane;
            //            pane.Show(dockPanel1);
            webBrowserDockPanel.BringToFront();

            //set up docking for the Project Panel);
            Controls.Remove(projectPanel);
            projectPanel.Dock = DockStyle.Fill;
            pane      = new DockContent();
            pane.Icon = Icon.FromHandle(Properties.Resources.Classes.GetHicon());
            pane.Controls.Add(projectPanel);
            pane.DockAreas = DockAreas.DockLeft |
                             DockAreas.DockRight |
                             DockAreas.Float;
            pane.ShowHint        = DockState.DockLeft;
            pane.Text            = @"CslaGen Project";
            pane.VisibleChanged += delegate(object sender, EventArgs e) { projectPanelToolStripMenuItem.Checked = ((DockContent)sender).Visible; };
            pane.FormClosing    += pane_FormClosing;
            projectDockPanel     = pane;
            pane.Show(dockPanel1);
        }
示例#19
0
        public static void Initialize(VsDiffPackage package)
        {
            Package = package;

            OutputWindow.Initialize();
        }
示例#20
0
        bool TryCompileSingleFile()
        {
            DTE DTE = UnrealVSPackage.Instance.DTE;

            // Activate the output window
            Window Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);

            Window.Activate();
            OutputWindow OutputWindow = Window.Object as OutputWindow;

            // Try to find the 'Build' window
            OutputWindowPane BuildOutputPane = null;

            foreach (OutputWindowPane Pane in OutputWindow.OutputWindowPanes)
            {
                if (Pane.Guid.ToUpperInvariant() == "{1BD8A850-02D1-11D1-BEE7-00A0C913D1F8}")
                {
                    BuildOutputPane = Pane;
                    break;
                }
            }
            if (BuildOutputPane == null)
            {
                return(false);
            }

            // If there's already a build in progress, offer to cancel it
            if (ChildProcess != null && !ChildProcess.HasExited)
            {
                if (MessageBox.Show("Cancel current compile?", "Compile in progress", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    KillChildProcess();
                    BuildOutputPane.OutputString("1>  Build cancelled.\r\n");
                }
                return(true);
            }

            // Check we've got a file open
            if (DTE.ActiveDocument == null)
            {
                return(false);
            }

            // Grab the current startup project
            IVsHierarchy ProjectHierarchy;

            UnrealVSPackage.Instance.SolutionBuildManager.get_StartupProject(out ProjectHierarchy);
            if (ProjectHierarchy == null)
            {
                return(false);
            }
            Project StartupProject = Utils.HierarchyObjectToProject(ProjectHierarchy);

            if (StartupProject == null)
            {
                return(false);
            }
            Microsoft.VisualStudio.VCProjectEngine.VCProject VCStartupProject = StartupProject.Object as Microsoft.VisualStudio.VCProjectEngine.VCProject;
            if (VCStartupProject == null)
            {
                return(false);
            }

            // Get the active configuration for the startup project
            Configuration ActiveConfiguration     = StartupProject.ConfigurationManager.ActiveConfiguration;
            string        ActiveConfigurationName = String.Format("{0}|{1}", ActiveConfiguration.ConfigurationName, ActiveConfiguration.PlatformName);

            Microsoft.VisualStudio.VCProjectEngine.VCConfiguration ActiveVCConfiguration = VCStartupProject.Configurations.Item(ActiveConfigurationName);
            if (ActiveVCConfiguration == null)
            {
                return(false);
            }

            // Get the NMake settings for this configuration
            Microsoft.VisualStudio.VCProjectEngine.VCNMakeTool ActiveNMakeTool = ActiveVCConfiguration.Tools.Item("VCNMakeTool");
            if (ActiveNMakeTool == null)
            {
                return(false);
            }

            // Save all the open documents
            DTE.ExecuteCommand("File.SaveAll");

            // Check it's a cpp file
            string FileToCompile = DTE.ActiveDocument.FullName;

            if (!FileToCompile.EndsWith(".c", StringComparison.InvariantCultureIgnoreCase) && !FileToCompile.EndsWith(".cpp", StringComparison.InvariantCultureIgnoreCase))
            {
                MessageBox.Show("Invalid file extension for single-file compile.", "Invalid Extension", MessageBoxButtons.OK);
                return(true);
            }

            // If there's already a build in progress, don't let another one start
            if (DTE.Solution.SolutionBuild.BuildState == vsBuildState.vsBuildStateInProgress)
            {
                if (MessageBox.Show("Cancel current compile?", "Compile in progress", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    DTE.ExecuteCommand("Build.Cancel");
                }
                return(true);
            }

            // Make sure any existing build is stopped
            KillChildProcess();

            // Set up the output pane
            BuildOutputPane.Activate();
            BuildOutputPane.Clear();
            BuildOutputPane.OutputString(String.Format("1>------ Build started: Project: {0}, Configuration: {1} {2} ------\r\n", StartupProject.Name, ActiveConfiguration.ConfigurationName, ActiveConfiguration.PlatformName));
            BuildOutputPane.OutputString(String.Format("1>  Compiling {0}\r\n", FileToCompile));

            // Set up event handlers
            DTE.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin;

            // Create a delegate for handling output messages
            DataReceivedEventHandler OutputHandler = (Sender, Args) => { if (Args.Data != null)
                                                                         {
                                                                             BuildOutputPane.OutputString("1>  " + Args.Data + "\r\n");
                                                                         }
            };

            // Spawn the new process
            ChildProcess = new System.Diagnostics.Process();
            ChildProcess.StartInfo.FileName               = Path.Combine(Environment.SystemDirectory, "cmd.exe");
            ChildProcess.StartInfo.Arguments              = String.Format("/C {0} -singlefile=\"{1}\"", ActiveNMakeTool.BuildCommandLine, FileToCompile);
            ChildProcess.StartInfo.WorkingDirectory       = Path.GetDirectoryName(StartupProject.FullName);
            ChildProcess.StartInfo.UseShellExecute        = false;
            ChildProcess.StartInfo.RedirectStandardOutput = true;
            ChildProcess.StartInfo.RedirectStandardError  = true;
            ChildProcess.StartInfo.CreateNoWindow         = true;
            ChildProcess.OutputDataReceived              += OutputHandler;
            ChildProcess.ErrorDataReceived += OutputHandler;
            ChildProcess.Start();
            ChildProcess.BeginOutputReadLine();
            ChildProcess.BeginErrorReadLine();
            return(true);
        }
 public FindReplaceWindow(OutputWindow ow)
 {
     InitializeComponent();
     _ow = ow;
     findtxt.Focus();
 }
示例#22
0
        /// <summary>
        /// Logs a message
        /// </summary>
        /// <param name="message">Message to log</param>
        protected override void LogMessage(string message)
        {
            var pane = OutputWindow.GetPane <SpectrumVmOutputPane>();

            pane.WriteLine(message);
        }
 //17Jul2015 Save in History menu of OutputWindow whose reference is passed
 private void SaveInOutputWinHistory(OutputWindow ow )
 {
     UAMenuCommand command = (UAMenuCommand)parameter;
     if (ds != null)
     {
         ow.History.AddCommand(ds.Name, command);
     }
 }
示例#24
0
        /// <summary>
        /// Compiles the Z80 code file
        /// </summary>
        protected override async Task ExecuteAsync()
        {
            // --- Prepare the appropriate file to compile/run
            CodeInjected = false;

            // --- Step #1: Compile the code
            await base.ExecuteAsync();

            if (!CompileSuccess)
            {
                return;
            }

            // --- Step #2: Check machine compatibility
            var modelName = SpectNetPackage.Default.Solution.ActiveProject?.ModelName;
            SpectrumModelType modelType;

            if (Output.ModelType == null)
            {
                switch (modelName)
                {
                case SpectrumModels.ZX_SPECTRUM_48:
                    modelType = SpectrumModelType.Spectrum48;
                    break;

                case SpectrumModels.ZX_SPECTRUM_128:
                    modelType = SpectrumModelType.Spectrum128;
                    break;

                case SpectrumModels.ZX_SPECTRUM_P3_E:
                    modelType = SpectrumModelType.SpectrumP3;
                    break;

                case SpectrumModels.ZX_SPECTRUM_NEXT:
                    modelType = SpectrumModelType.Next;
                    break;

                default:
                    modelType = SpectrumModelType.Spectrum48;
                    break;
                }
            }
            else
            {
                modelType = Output.ModelType.Value;
            }

            // --- We may display dialogs, so we go back to the main thread
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            if (!SpectrumModels.IsModelCompatibleWith(modelName, modelType))
            {
                VsxDialogs.Show("The model type defined in the code is not compatible with the " +
                                "Spectrum virtual machine of this project.",
                                "Cannot run code.");
                return;
            }

            // --- Step #3: Check for zero code length
            if (Output.Segments.Sum(s => s.EmittedCode.Count) == 0)
            {
                VsxDialogs.Show("The length of the compiled code is 0, " +
                                "so there is no code to inject into the virtual machine and run.",
                                "No code to run.");
                return;
            }

            // --- Step #4: Check non-zero displacements
            var options = HostPackage.Options;

            if (Output.Segments.Any(s => (s.Displacement ?? 0) != 0) && options.ConfirmNonZeroDisplacement)
            {
                var answer = VsxDialogs.Show("The compiled code contains non-zero displacement" +
                                             "value, so the displaced code may fail. Are you sure you want to run the code?",
                                             "Non-zero displacement found",
                                             MessageBoxButton.YesNo, VsxMessageBoxIcon.Question, 1);
                if (answer == VsxDialogResult.No)
                {
                    return;
                }
            }

            var vm   = HostPackage.EmulatorViewModel;
            var pane = OutputWindow.GetPane <SpectrumVmOutputPane>();

            HostPackage.ShowToolWindow <SpectrumEmulatorToolWindow>();

            // --- Step #5: Prepare the machine to be in the appropriate mode
            if (IsInInjectMode)
            {
                if (vm.MachineState == VmState.Running ||
                    vm.MachineState != VmState.Paused && vm.MachineState != VmState.Stopped && vm.MachineState != VmState.None)
                {
                    VsxDialogs.Show("To inject the code into the virtual machine, please pause it first.",
                                    "The virtual machine is running");
                    return;
                }
            }
            else
            {
                var stopped = await SpectrumVmManager.StopSpectrumVmAsync(options.ConfirmMachineRestart);

                if (!stopped)
                {
                    return;
                }
            }

            // --- Step #6: Start the virtual machine and run it to the injection point
            if (vm.MachineState == VmState.Stopped || vm.MachineState == VmState.None)
            {
                await pane.WriteLineAsync("Starting the virtual machine in code injection mode.");

                // --- Use specific startup for each model.
                var started = true;
                try
                {
                    switch (modelName)
                    {
                    case SpectrumModels.ZX_SPECTRUM_48:
                        await VmStateFileManager.SetSpectrum48StartupState();

                        break;

                    case SpectrumModels.ZX_SPECTRUM_128:
                        if (modelType == SpectrumModelType.Spectrum48)
                        {
                            await VmStateFileManager.SetSpectrum128In48StartupState();
                        }
                        else
                        {
                            await VmStateFileManager.SetSpectrum128In128StartupState();
                        }
                        break;

                    case SpectrumModels.ZX_SPECTRUM_P3_E:
                        if (modelType == SpectrumModelType.Spectrum48)
                        {
                            await VmStateFileManager.SetSpectrumP3In48StartupState();
                        }
                        else
                        {
                            await VmStateFileManager.SetSpectrumP3InP3StartupState();
                        }
                        break;

                    case SpectrumModels.ZX_SPECTRUM_NEXT:
                        // --- Implement later
                        return;

                    default:
                        // --- Implement later
                        return;
                    }
                }
                catch (Exception)
                {
                    started = false;
                }
                if (!started)
                {
                    return;
                }
            }

            // --- Step #7: Inject the code into the memory, and force
            // --- new disassembly
            await pane.WriteLineAsync("Injecting code into the Spectrum virtual machine.");

            HostPackage.CodeManager.InjectCodeIntoVm(Output);
            CodeInjected = true;

            // --- Step #8: Jump to execute the code
            var continuationPoint = GetContinuationAddress();

            if (continuationPoint.HasValue)
            {
                vm.Machine.SpectrumVm.Cpu.Registers.PC = continuationPoint.Value;
                await pane.WriteLineAsync($"Resuming code execution at address {vm.Machine.SpectrumVm.Cpu.Registers.PC:X4}.");
            }
            vm.MemViewPoint    = (ushort)MemoryStartAddress;
            vm.DisAssViewPoint = (ushort)DisassemblyStartAddress;
            vm.StackDebugSupport.ClearStepOutStack();

            GetAffectedItem(out var hierarchy, out var itemId);
            if (hierarchy is IVsProject project)
            {
                project.GetMkDocument(itemId, out var itemFullPath);
            }

            if (Output.SourceType == "zxbasic")
            {
                // --- Push the MAIN_EXECUTION loop address to the stack
                var memDevice = vm.Machine.SpectrumVm.MemoryDevice;
                var spValue   = vm.Machine.SpectrumVm.Cpu.Registers.SP;
                var mainExec  = VmStateFileManager.SP48_MAIN_EXEC_ADDR;
                memDevice.Write((ushort)(spValue - 1), (byte)(mainExec >> 8));
                memDevice.Write((ushort)(spValue - 2), (byte)mainExec);
                vm.Machine.SpectrumVm.Cpu.Registers.SP -= 2;
            }
            ResumeVm();
        }
示例#25
0
 private static OutputWindowPane GetBuildPane(OutputWindow outputWindow)
 {
     foreach (OutputWindowPane owp in outputWindow.OutputWindowPanes)
         if (owp.Guid == "{1BD8A850-02D1-11D1-BEE7-00A0C913D1F8}")
             return owp;
     return null;
 }
示例#26
0
 /// <summary>
 /// Creates a new inflater.
 /// </summary>
 /// <param name="nowrap">
 /// true if no header and checksum field appears in the
 /// stream.  This is used for GZIPed input.  For compatibility with
 /// Sun JDK you should provide one byte of input more than needed in
 /// this case.
 /// </param>
 public Inflater(bool nowrap)
 {
     this.nowrap = nowrap;
     this.adler = new Adler32();
     input = new StreamManipulator();
     outputWindow = new OutputWindow();
     mode = nowrap ? DECODE_BLOCKS : DECODE_HEADER;
 }
示例#27
0
 private void ButtonCreateInstallerClick(object sender, RoutedEventArgs e)
 {
     var myNewForm = new OutputWindow();
     myNewForm.ShowDialog();
 }
示例#28
0
    private void initializeOutputWindow()
    {
        //create the dockable window for the output window
        DockableControl dock = new DockableControl() {
            Dock = DockStyle.Fill,
            Title = "Output"
        };

        //initialize the output window
        p_OutputWindow = new OutputWindow(p_WorkingBodyContainer.Panel2.Width);
        dock.WorkingArea.Controls.Add(p_OutputWindow);

        #region Output window events
        p_OutputWindow.FileGoto += delegate(ProjectFile file, int line, int column) {
            if (file == null) { return; }

            //get/create the tab for the file
            TabPage page = GetTab(file.PhysicalLocation);
            if (page == null) { page = AddTab(file.PhysicalLocation); }

            //select the line and column
            TextEditor editor = (TextEditor)page.Controls[0];
            editor.SelectWordAtColumn(line - 1, column);
        };
        #endregion

        #region Dock events
        dock.DockClicked += delegate(object sender, EventArgs e) {
            p_WorkingBodyContainer.Panel2Collapsed = false;
        };
        dock.UndockClicked += delegate(object sender, EventArgs e) {
            p_WorkingBodyContainer.Panel2Collapsed = true;
        };
        dock.CloseClicked += delegate(object sender, EventArgs e) {
            p_WorkingBodyContainer.Panel2Collapsed = true;
        };
        #endregion

        //add the dock to the bottom side of the body
        p_WorkingBodyContainer.Panel2.Controls.Add(dock);
        return;
    }
示例#29
0
        private void Output()
        {
            var builder = new StringBuilder();
            int maxTitleLength = this._subtitles.Max(c => GetLength(c.Name) + 10);

            builder.AppendLine("[pre]");
            builder.AppendFormat("{0} {1}   {2}   {3}   {4}   {5}", PadRightEx("��Ļ����", maxTitleLength), "��Ч����", "�����÷�", "��Ч����",
                "�����÷�",
                "�ܵ÷�");
            builder.AppendLine();
            decimal sum = 0;
            decimal d = decimal.TryParse(this._d, out d) ? d : 0;
            foreach (var subtitle in this._subtitles)
            {
                decimal itemSum = d * subtitle.Words * this._selectedParameter.A + d * subtitle.Lines * this._selectedParameter.B;
                sum += itemSum;

                builder.AppendFormat("{0} {1,-10} {2,-10} {3,-10} {4,-10} {5,-10}", PadRightEx(subtitle.Name, maxTitleLength),
                    subtitle.Words.ToString("0"), (d * subtitle.Words * this._selectedParameter.A).ToString("0.000"), subtitle.Lines.ToString("0"),
                    (d * subtitle.Lines * this._selectedParameter.B).ToString("0.000"),
                    itemSum.ToString("0.000"));
                builder.AppendLine();
            }
            builder.AppendFormat("D   ��{0}", d.ToString("0.000"));
            builder.AppendLine();
            builder.AppendFormat("�ܼƣ�{0}", sum.ToString("0.000"));
            builder.AppendLine();
            builder.AppendLine("[/pre]");

            var output = new OutputWindow();
            output.Output.Text = builder.ToString();
            output.ShowDialog();
        }
		private static OutputWindowPane GetPane(OutputWindow outputWindow, string panelName)
		{
			foreach(OutputWindowPane pane in outputWindow.OutputWindowPanes)
			{
				if(pane.Name.Equals(panelName, StringComparison.OrdinalIgnoreCase))
				{
					return pane;
				}
			}

			return outputWindow.OutputWindowPanes.Add(panelName);
		}
        private void PublishInCrmCallback(object sender, EventArgs e)
        {
            _myStopwatch = new Stopwatch();
            _myStopwatch.Start();

            _outputWindow = new OutputWindow();
            _outputWindow.Show();

            var selectedFilePath = GetSelectedFilePath();
            if (!CheckFileExtension(selectedFilePath))
            {
                AddErrorLineToOutputWindow("Error : Selected file extension is not valid.");
                return;
            }

            var solutionPath = GetSolutionPath();
            var connectionString = GetConnectionString(solutionPath);
            if (connectionString == string.Empty)
            {
                AddErrorLineToOutputWindow("Error : Connection string is not found.");

                var userCredential = new UserCredential();
                userCredential.ShowDialog();

                if (string.IsNullOrEmpty(userCredential.ConnectionString))
                {
                    AddErrorLineToOutputWindow("Error : Connection failed.");
                    return;
                }

                connectionString = userCredential.ConnectionString;

                WriteConnectionStringToFile(Path.GetFileNameWithoutExtension(solutionPath), connectionString, Path.GetDirectoryName(solutionPath));

            }

            AddLineToOutputWindow(string.Format("Publishig the {0} in Crm..", Path.GetFileName(selectedFilePath)));

            //Start the thread for updating and publishing the webresource.
            var thread =
                new Thread(o => UpdateTheWebresource(selectedFilePath, connectionString));
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
示例#32
0
 public UserCode()
 {
     joy = JoystickInput.Hook;
     output = new OutputWindow();
     output.Show();
 }
示例#33
0
        /// <summary>
        /// Shows the controls in workspaces
        /// </summary>
        /// <param name="workspace"></param>
        /// <param name="contentWorkspace"></param>
        public void Show(IWorkspace workspace, IWorkspace contentWorkspace)
        {
            DockingSmartPartInfo smartPartInfo;
            dockworkspace = workspace as DockableWorkSpace;
            tabbedMDIManagerWorkspace = contentWorkspace as TabbedMDIManagerWorkspace;

            //Adding TaskList
            taskList = this.Items.AddNew<TaskList>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Task List";
            smartPartInfo.DockStyle = DockingStyle.Bottom;
            smartPartInfo.Height = 200;
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            workspace.Show(taskList, smartPartInfo);

            ////Adding Output Window
            outputWindow = this.Items.AddNew<OutputWindow>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Output Window";
            smartPartInfo.DockStyle = DockingStyle.Tabbed;
            smartPartInfo.ParentName = "TaskList";
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            workspace.Show(outputWindow, smartPartInfo);

            //Adding Errorlist
            errorList = this.Items.AddNew<ErrorList>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Error List";
            smartPartInfo.DockStyle = DockingStyle.Tabbed;
            smartPartInfo.ParentName = "TaskList";
            smartPartInfo.Height = 200;
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            workspace.Show(errorList, smartPartInfo);

            //Adding toolbox
            groupBarView = this.Items.AddNew<Views.GroupBarView>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "ToolBox";
            smartPartInfo.DockStyle = DockingStyle.Left;
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            workspace.Show(groupBarView, smartPartInfo);
            Views.Toolbox.ToolBoxWorkItem toolBoxWorkItem = this.WorkItems.AddNew<Views.Toolbox.ToolBoxWorkItem>();
            toolBoxWorkItem.ShowToolBox(this.Workspaces[VSDemoCommon.WorkspaceNames.GroupBarWorkspace]);

            //Adding SolutionExplorer
            //solutionExplorer = this.Items.AddNew<SolutionExplorer>();
            nhapThongTinBenhNhan = this.Items.AddNew<NhapThongTinBenhNhan>();
               // this.UIExtensionSites.RegisterSite(VSDemoCommon.UIElements.TreeView, solutionExplorer.treeViewAdv1);
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Solution Explorer";
            smartPartInfo.DockStyle = DockingStyle.Right;
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
               // workspace.Show(solutionExplorer, smartPartInfo);
            workspace.Show(nhapThongTinBenhNhan, smartPartInfo);

            //Adding Properties Window
            /*propertiesWindow = this.Items.AddNew<PropertiesWindow>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Properties Window";
            smartPartInfo.DockStyle = DockingStyle.Tabbed;
            smartPartInfo.ParentName = "SolutionExplorer";
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            workspace.Show(propertiesWindow, smartPartInfo);

            //Adding ClassView
            classView = this.Items.AddNew<ClassView>();
            smartPartInfo = new DockingSmartPartInfo();
            smartPartInfo.Title = "Class View";
            smartPartInfo.DockStyle = DockingStyle.Tabbed;
            smartPartInfo.VisualStyle = VisualStyle.Office2007;
            smartPartInfo.ParentName = "SolutionExplorer";
            workspace.Show(classView, smartPartInfo);
             */
        }
        public MainWindowViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                isLoaded = true;
                if (p == null)
                {
                    return;
                }
                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                if (loginWindow.DataContext == null)
                {
                    return;
                }
                var loginVM = loginWindow.DataContext as LoginWindowViewModel;
                if (loginVM.IsLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            OpenUnitWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                UnitWindow unitWindow = new UnitWindow();
                unitWindow.ShowDialog();
            });

            OpenSuppliersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SuppliersWindow sW = new SuppliersWindow(); sW.ShowDialog(); });
            OpenCustomersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomersWindow cW = new CustomersWindow(); cW.ShowDialog(); });
            OpenProductsWindowCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductsWindow pW = new ProductsWindow(); pW.ShowDialog(); });
            OpenUsersWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UsersWindow pW = new UsersWindow(); pW.ShowDialog(); });
            OpenInputWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow pW = new InputWindow(); pW.ShowDialog(); });
            OpenOutputWindowCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow pW = new OutputWindow(); pW.ShowDialog(); });
        }
示例#35
0
        private void CreateOutputWindow(string winText)
        {
            ow = _app.ToolWindows.OutputWindow;

              ow.Parent.Activate();
              try {
            owp = ow.OutputWindowPanes.Item(winText);
            owp.Clear();
            ow.Parent.Activate();
            owp.Activate();
              }

              catch {
            owp = ow.OutputWindowPanes.Add(winText);
              }
        }
示例#36
0
        public Control BuildUI(StyleSheet styleSheet, QuestionStyleCollection questionStyles, QuestionForm questionForm, OutputWindow outputWindow)
        {
            _questionStyles  = questionStyles;
            _questionForm    = questionForm;
            _outputWindow    = outputWindow;
            _questionWidgets = new List <QuestionWidget>();

            return(VisitStyleSheet(styleSheet));
        }
示例#37
0
 public static void ActiveOutputWindow()
 {
     OutputWindow.Activate();
 }
        public void ListWindows()
        {
            OutputWindow outWindow = _dte.ToolWindows.OutputWindow;

            outWindow.Parent.AutoHides = false;
            outWindow.Parent.Activate();

            //string test = window.ActivePane.Name;

            OutputWindowPane buildPane = null;

            try
            {
                buildPane = outWindow.OutputWindowPanes.Item("Build");
            }
            catch
            {
                buildPane = outWindow.OutputWindowPanes.Add("Build");
            }
            finally
            {
                //buildPane.Clear();
            }



            for (int i = count; i < count + 20; ++i)
            {
                buildPane.OutputString("Line " + i + "\n");
            }


            buildPane.Activate();

            try
            {
                if (buildPane.TextDocument != null)
                {
                    TextDocument  doc = buildPane.TextDocument;
                    TextSelection sel = doc.Selection;

                    sel.StartOfDocument(false);
                    sel.EndOfDocument(true);

                    count += 20;


                    sel.GotoLine(count - 5);


                    try
                    {
                        sel.ActivePoint.TryToShow(vsPaneShowHow.vsPaneShowCentered, null);
                    }
                    catch (System.Exception ex)
                    {
                        Console.WriteLine("Exception! " + ex.ToString());
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Exception! " + ex.ToString());
            }
        }