using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Foo.Platform.Win32;

namespace Foo.WorkspaceMgr.Hiders
{
    internal class ShowNHide_Generic : IShowNHide
    {

        #region IShowNHide Members

        /// <summary>
        /// Default behavior is to just return success ** Should Check if Window is hidden?/shown???
        /// </summary>
        /// <param name="strArtifactLocation">location of the path + file to launch</param>
        /// <returns></returns>
        public FuncDepBoolType IQueryShow(string strArtifactLocation)
        {
            if (!String.IsNullOrEmpty(strArtifactLocation))
                return FuncDepBoolType.Success;

            return FuncDepBoolType.ParametersInvalid;
        }

        /// <summary>
        /// Calls ShowWindow to Show the Window
        /// </summary>
        /// <param name="strArtifactLocation">location of the path + file to launch</param>
        /// <returns></returns>
        public FuncDepBoolType IShow(string strArtifactLocation)
        {
            if (!String.IsNullOrEmpty(strArtifactLocation))
            {
                IntPtr hWnd = IntPtr.Zero;              // ToDo : Implement RAT
                Win32Functions.ShowWindow(hWnd, (int)WindowAction.SW_SHOW);
                return FuncDepBoolType.Success;
            }
            return FuncDepBoolType.ParametersInvalid;
        }

        /// <summary>
        /// Default behavior is to just return success ** Should Check if Window is hidden?/shown???
        /// </summary>
        /// <param name="strArtifactLocation">location of the path + file to launch</param>
        /// <returns></returns>
        public FuncDepBoolType IQueryHide(string strArtifactLocation)
        {
            if (!String.IsNullOrEmpty(strArtifactLocation))
                return FuncDepBoolType.Success;
            
            return FuncDepBoolType.ParametersInvalid;
        }

        /// <summary>
        /// Calls ShowWindow to Hide the Window
        /// </summary>
        /// <param name="strArtifactLocation">location of the path + file to launch</param>
        /// <returns></returns>
        public FuncDepBoolType IHide(string strArtifactLocation)
        {
            if (!String.IsNullOrEmpty(strArtifactLocation))
            {
                IntPtr hWnd = IntPtr.Zero;              // ToDo : Implement RAT
                Win32Functions.ShowWindow(hWnd, (int)WindowAction.SW_HIDE);
                return FuncDepBoolType.Success;
            }
            return FuncDepBoolType.ParametersInvalid;
        }
        
        #endregion
    }
}
