Inheritance: SmartCmdArgs.Helper.PropertyChangedBase
Example #1
0
        public ToolWindow(CmdArgsPackage package, ViewModel.ToolWindowViewModel viewModel)
            : base(null)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            base.Package = package;
            this.Caption = "Command Line Arguments";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.view    = new View.ToolWindowControl(viewModel);
            this.Content = view;

            // Id from VSPackage.resx.
            BitmapResourceID = 300;

            // The index is actually zero-based, in contrast to the bitmaps in the vsct-file.
            BitmapIndex = 0;

            this.ToolBar = new CommandID(PackageGuids.guidCmdArgsToolBarCmdSet, PackageIds.TWToolbar);

            matchCaseSearchOption = new WindowSearchBooleanOption("Match Case", "Enable to make search case sensitive.", false);
            searchOptions         = new List <IVsWindowSearchOption> {
                matchCaseSearchOption
            };
        }
        public static void Serialize(ToolWindowViewModel vm, Stream stream)
        {
            if (vm == null)
                throw new ArgumentNullException(nameof(vm));
            if (stream == null)
                throw new ArgumentNullException(nameof(stream));

            var data = new ToolWindowStateSolutionData();

            foreach (var kvp in vm.SolutionArguments)
            {
                var list = new ToolWindowStateProjectData();
                data.Add(kvp.Key.UniqueName, list);

                foreach (var item in kvp.Value.DataCollection)
                {
                    list.DataCollection.Add(new ToolWindowStateProjectData.ListEntryData()
                    {
                        Id = item.Id,
                        Command = item.Command,
                        //Project = item.Project,   // deprecated
                        Enabled = item.Enabled
                    });
                }
            }

            string jsonStr = JsonConvert.SerializeObject(data);

            StreamWriter sw = new StreamWriter(stream);
            sw.Write(jsonStr);
            sw.Flush();
        }
Example #3
0
        public ToolWindow(ViewModel.ToolWindowViewModel viewModel)
            : base(null)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            this.Caption = "Commandline Arguments";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.view    = new View.ToolWindowControl(viewModel);
            this.Content = view;

            this.ToolBar = new CommandID(Commands.CmdArgsToolBarCmdSet, Commands.TWToolbar);
        }
        public ToolWindow(ViewModel.ToolWindowViewModel viewModel)
            : base(null)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            this.Caption = "Commandline Arguments";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.view    = new View.ToolWindowControl(viewModel);
            this.Content = view;

            this.ToolBar = new CommandID(Commands.CmdArgsToolBarCmdSet, Commands.TWToolbar);

            matchCaseSearchOption = new WindowSearchBooleanOption("Match Case", "Enable to make search case sensitive.", false);
            searchOptions         = new List <IVsWindowSearchOption> {
                matchCaseSearchOption
            };
        }
Example #5
0
 public static void Init(ToolWindowViewModel vm, int size = 500)
 {
     _vm     = vm;
     _buffer = new HistoryRingBuffer <SuoDataJson>(size);
 }