예제 #1
0
        private static void OnBeforeQueryStatus(object sender, EventArgs args)
        {
            P4DiffAgainstCommand matchedCommand = (P4DiffAgainstCommand)sender;

            bool isRootItem = matchedCommand.MatchedCommandId == 0;
            int  itemIndex  = isRootItem ? 0 : matchedCommand.MatchedCommandId - matchedCommand.BaseCommandID;

            if ((itemIndex >= 0) && (itemIndex < Options.Options.P4Paths.Length))
            {
                matchedCommand.Enabled = true;
                matchedCommand.Text    = Options.Options.P4Paths[itemIndex];
            }
            else
            {
                matchedCommand.Enabled = false;
                matchedCommand.Text    = "No items";
            }

            matchedCommand.MatchedCommandId = 0;
        }
예제 #2
0
        private static void OnInvoked(object sender, EventArgs args)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            P4DiffAgainstCommand matchedCommand = (P4DiffAgainstCommand)sender;

            bool isRootItem = matchedCommand.MatchedCommandId == 0;
            int  itemIndex  = isRootItem ? 0 : matchedCommand.MatchedCommandId - matchedCommand.BaseCommandID;

            if ((itemIndex >= 0) && (itemIndex < Options.Options.P4Paths.Length))
            {
                _ = Task.Run(
                    async() =>
                {
                    string result = await matchedCommand.ExecuteCommandAsync(itemIndex);
                    await Helper.VSHelper.OutputLineAsync("Result: {0}", result);
                }
                    );
            }
        }