コード例 #1
0
ファイル: P4DiffAgainstCommand.cs プロジェクト: KMStu/UETools
        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
ファイル: P4DiffAgainstCommand.cs プロジェクト: KMStu/UETools
        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);
                }
                    );
            }
        }