mCleaner.Logics.Commands.CommandLogic_Clipboard.ExecuteCommand C# (CSharp) Method

ExecuteCommand() public method

public ExecuteCommand ( bool preview = false ) : Task
preview bool
return Task
        public async Task<bool> ExecuteCommand(bool preview = false)
        {
            bool ret = false;
            string text = "Clean clipboard";

            if (preview)
            {
                UpdateProgressLog(text, text);
                ret = true;
            }
            else
            {
                Thread t = new Thread(new ThreadStart(() => { Clipboard.Clear(); }));
                t.SetApartmentState(ApartmentState.STA); 
                t.Start();
                ret = true;
            }

            return ret;
        }
    }