public override void AfterSelect(IUserIO handler, WidgetCfgSample <T> sample)
        {
            base.AfterSelect(handler, sample);

            if (sample.WidgetConfig.ClickAction.Type == ClickActionType.OpenOtherApp)
            {
                try
                {
                    var appAdapter = new OtherAppAdapter(AndroidHelpers.Tools.HelperContext);
                    int iApp       = AndroidHelpers.Tools.ShowSingleChoiseDlg(AndroidHelpers.Tools.HelperContext, "select", appAdapter).Result;
                    if (iApp < 0)
                    {
                        throw new Exception();
                    }
                    ApplicationInfo appInfo = appAdapter[iApp];

                    sample.WidgetConfig.ClickAction        = new ClickAction(ClickActionType.OpenOtherApp);
                    sample.WidgetConfig.ClickAction.Params = new string[] { "PackageName=" + appInfo.PackageName };
                    if (sample.WidgetConfig is WidgetCfg_ActionButton)
                    {
                        sample.WidgetConfig.WidgetTitle = appInfo.LoadLabel(Application.Context.PackageManager);
                    }
                }
                catch
                {
                    sample.WidgetConfig.ClickAction = new ClickAction(ClickActionType.OpenSettings);
                }
            }
        }
Beispiel #2
0
        private Order MakeEdits(IUserIO io, Order target, OrderManager manager)
        {
            string newName      = io.PromptReplaceName("Enter customer name", target.Name);
            bool   nameChanged  = !target.Name.Equals(newName);
            bool   orderChanged = false;

            State oldState = new State("unknown", target.StateAbbr, target.TaxRate);
            State newState = io.PromptReplaceState("Enter order state", oldState, manager.GetStates());

            orderChanged |= oldState.StateAbbr != newState.StateAbbr;

            Product oldProduct = new Product(target.ProductType, target.CostPSF, target.LaborCostPSF);
            Product newProduct = io.PromptReplaceProduct("Enter product", oldProduct, manager.GetProducts());

            orderChanged |= !oldProduct.ProductType.Equals(newProduct.ProductType, StringComparison.CurrentCultureIgnoreCase);

            decimal newArea = io.PromptReplaceArea("Enter area", target.Area);

            orderChanged |= target.Area != newArea;

            if (orderChanged)
            {
                Order newOrder = new Order(target.Date, newName, newState, newProduct, newArea);
                newOrder.UpdateNum(target.OrderNum);
                return(newOrder);
            }
            else if (nameChanged)
            {
                Order newOrder = new Order(target.Date, newName, oldState, oldProduct, target.Area);
                newOrder.UpdateNum(target.OrderNum);
                return(newOrder);
            }
            return(target);
        }
Beispiel #3
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_CalendarCircleWave> sample)
        {
            base.AfterSelect(handler, sample);

            if (sample.WidgetConfig.DayBackgroundGradient.GradientS[0].CustomColors == null || sample.WidgetConfig.DayBackgroundGradient.GradientS[0].CustomColors.Length == 0)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            }
        }
Beispiel #4
0
        public override void PerformPreperation(IUserIO handler)
        {
            base.PerformPreperation(handler);
            string cTitle = handler.UserInputText(localize.WidgetTitle, null, BaseSample.WidgetConfig.WidgetTitle).Result;

            if (cTitle != null)
            {
                BaseSample.WidgetConfig.WidgetTitle = cTitle;
            }
            handler.TriggerPositiveButtonClicked();
        }
Beispiel #5
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            var clr = await handler.UserSelectColor(localize.IconColor);

            if (clr != null)
            {
                var cfg = BaseSample.GetConfigClone();
                cfg.IconColor = clr.Value;
                BaseSample    = new WidgetCfgSample <WidgetCfg_ActionButton>("custom", cfg);
            }

            handler.TriggerPositiveButtonClicked();
        }
Beispiel #6
0
        /// <summary>
        /// Public constructor.
        /// <param name="userIO">An interface for communication with the user.</param>
        /// <param name="workingDir">The path of the dir to save/load files.</param>
        /// <param name="targetClassname">A characteristic classname registered by the target process. The classname is used to identify the target's process.</param>
        /// <param name="targetName">The name of the target - only used for logging.</param>
        /// <param name="targetPath">The path to the target executable.</param>
        /// <param name="targetStartIfNeeded">A flag indicating whether Skype should be launched if it is not running already.</param>
        /// </summary>
        public InProcess(IUserIO userIO, String workingDir, String targetName, String targetClassname, String targetPath = "", bool targetStartIfNeeded = false)
        {
            this.targetClassname = targetClassname;
            this.targetPath = targetPath;
            this.targetName = targetName;

            this.userIO = userIO;
            this.workingDir = workingDir;
            this.initSuccessful = false;

            hTarget = new HANDLE();

            hookTarget(targetStartIfNeeded);
        }
Beispiel #7
0
        public override void PerformPreperation(IUserIO handler)
        {
            base.PerformPreperation(handler);

            var cfg = BaseSample.GetConfigClone();

            if (cfg.ColorBackground != WidgetCfg.tcBlack)
            {
                cfg.IconColor = WidgetCfg.tcBlack;
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.colorcfgBlack, cfg));
            }

            if (cfg.ColorBackground != WidgetCfg.tcWhite)
            {
                cfg           = BaseSample.GetConfigClone();
                cfg.IconColor = WidgetCfg.tcWhite;
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>("White", cfg));
            }

            if (cfg.ColorBackground != WidgetCfg.tcDark)
            {
                cfg           = BaseSample.GetConfigClone();
                cfg.IconColor = WidgetCfg.tcDark;
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>("Dark", cfg));
            }

            if (cfg.ColorBackground != WidgetCfg.tcLight)
            {
                cfg           = BaseSample.GetConfigClone();
                cfg.IconColor = WidgetCfg.tcLight;
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>("Light", cfg));
            }

            int i     = 0;
            var cDone = new List <string>();

            foreach (var clrs in DynamicColors.SampleColorSetS)
            {
                i++;
                var clr = xColor.FromHex(clrs[2]);
                if (!cDone.Contains(clr.HexString) && cfg.ColorBackground != clr)
                {
                    cDone.Add(clr.HexString);
                    cfg           = BaseSample.GetConfigClone();
                    cfg.IconColor = clr;
                    Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(clr.HexString, cfg));
                }
            }
        }
Beispiel #8
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_ActionButton> sample)
        {
            base.AfterSelect(handler, sample);
            if (sample.WidgetConfig.Style == ActionButton_Style.iChronEye && sample.WidgetConfig.AnimateOnFirstClick)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_AnimationDuriation);
            }

            if (sample.WidgetConfig.Style == ActionButton_Style.Icon)
            {
                if (!sample.WidgetConfig.IconName.Contains("_clrd"))
                {
                    NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_IconColor);
                }
            }
        }
Beispiel #9
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            var clr = await handler.UserSelectColor(localize.text_TodayColor);

            if (clr != null)
            {
                var cfg = BaseSample.GetConfigClone();
                cfg.ColorTodayBackground = clr.Value;
                BaseSample = new WidgetCfgSample <WidgetCfg_CalendarCircleWave>("custom", cfg);
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            handler.TriggerPositiveButtonClicked();
        }
        private DateTime GetFutureDate(IUserIO io)
        {
            //TODO: move to UI
            DateTime target;
            bool     firstTry = true;

            do
            {
                if (!firstTry)
                {
                    io.WriteLine("Order date must be in the future.");
                }
                target   = io.GetDate("Please enter a date for the order:");
                firstTry = false;
            } while (target < DateTime.Now);
            return(target);
        }
        private string GetCustomerName(IUserIO io)
        {
            //TODO: Move to UI
            string userIn;
            bool   firstTime = true;

            do
            {
                if (!firstTime)
                {
                    io.WriteLine("Invalid input. Names may only contain letters, numbers, spaces, commas, and periods.");
                }
                userIn    = io.GetString("Please enter your name.");
                firstTime = false;
            } while (!userIn.All(c => Char.IsLetterOrDigit(c) || c == ' ' || c == ',' || c == '.'));
            return(userIn);
        }
Beispiel #12
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            if (await handler.UserShowYesNoMessage(localize.DayColorType, localize.DayColorTypeCustomInfo, localize.action_continue, localize.action_abort))
            {
                List <xColor> xclrs = new List <xColor>();
                int           iClr  = 0;
                while (true)
                {
                    iClr++;

                    var clr = await handler.UserSelectColor("Color number " + iClr);

                    if (clr == null)
                    {
                        break;
                    }
                    else
                    {
                        xclrs.Add(clr.Value);
                    }
                }
                if (xclrs.Count > 0)
                {
                    var cfg = BaseSample.GetConfigClone();
                    cfg.DayBackgroundGradient = new DateGradient()
                    {
                        GradientS = { new DynamicGradient(cfg.TimeUnit, xclrs.ToArray()) }
                    };
                    BaseSample = new WidgetCfgSample <WidgetCfg_CalendarCircleWave>("custom", xclrs.ToArray(), cfg);
                }

                NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_CutomDayColorGradientTimeSpan);
                handler.TriggerPositiveButtonClicked();
            }
        }
Beispiel #13
0
 public Settings(string pkcs11LibraryPath, Mechanism encryptionMechanism, IUserIO userIO)
 {
     this.pkcs11LibraryPath   = pkcs11LibraryPath;
     this.encryptionMechanism = encryptionMechanism;
     this.userIO = userIO;
 }
Beispiel #14
0
 public Settings(string pkcs11LibraryPath, IUserIO userIO)
 {
     this.pkcs11LibraryPath = pkcs11LibraryPath;
     encryptionMechanism    = new Mechanism(CKM.CKM_RSA_PKCS);
     this.userIO            = userIO;
 }
Beispiel #15
0
 public BaseProblem(IUserIO userIO)
 {
     this.userIO = userIO;
 }
Beispiel #16
0
 public CharacterManager(IUserIO io, ICharacterService characterService)
 {
     this.io           = io;
     _characterService = characterService;
 }
 public void SetUp()
 {
     _mockRoverManager = MockRepository.GenerateMock <IRoverManager>();
     _mockUserIo       = MockRepository.GenerateMock <IUserIO>();
 }
Beispiel #18
0
 public GameRunner()
 {
     ui = new ConsoleIO();
     game = new TicTacToeGame();
 }
 public PokeManager(IUserIO io, IPokemonRepository repo)
 {
     this.repo = repo;
     this.io = io;
 }
Beispiel #20
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_Calendar> sample)
        {
            base.AfterSelect(handler, sample);

            NextStepAssistantType = (sample.Tag as Type);
        }
Beispiel #21
0
 public MathHelper(IUserIO userIO)
 {
     this.userIO = userIO;
 }
Beispiel #22
0
 public MissionControl(IRoverManager roverManager, IUserIO userIo)
 {
     _roverManager = roverManager;
     _userIo       = userIo;
 }
 public CharacterManager(IUserIO io, ICharacterRepository repo)
 {
     this.repo = repo;
     this.io   = io;
 }
Beispiel #24
0
 /// <summary>
 /// The public constructor.
 /// </summary>
 /// <param name="handleSelf">The handle of the local user</param>
 /// <param name="userIO">An interface for communication with the user.</param>
 /// <param name="workingDir">Path of the directory to work in.</param>
 public SharedLibrary(String handleSelf, IUserIO userIO, String workingDir)
 {
     this.workingDir = workingDir;
     this.handleSelf = handleSelf;
     this.userIO = userIO;
 }
 public AdditionProblem(IUserIO userIO)
     : base(userIO)
 {
     this.AnswerDelta = 0;
     this.ProblemType = "Addition";
 }
Beispiel #26
0
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <param name="comGeneric">An already connected COM object of type KryptoniteCOM.Generic.</param>
        /// <param name="comCrypto">An already connected COM object of type KryptoniteCOM.Crypto.</param>
        /// <param name="handlePartner">The name of the communication-partner to bind the instance to.</param>
        /// <param name="userIO">The interface used for communication with the user.</param>
        public SessionExternalComm(KryptoniteCOM.Generic comGeneric, KryptoniteCOM.Crypto comCrypto, String handlePartner, IUserIO userIO)
        {
            this.comGeneric = comGeneric;
            this.comCrypto = comCrypto;

            this.handlePartner = handlePartner;
            this.userIO = userIO;

            this.secure = false;
        }
Beispiel #27
0
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <param name="comGeneric">An already connected COM object of type BottomCOM.Generic.</param>
        /// <param name="comHookEngine">An already connected COM object of type BottomCOM.HookingEngine.</param>
        /// <param name="handlePartner">The handle of the communication parter.</param>
        /// <param name="userIO">An interface for communication with the user.</param>
        public SessionExternalComm(BottomCOM.Generic comGeneric, BottomCOM.HookingEngine comHookEngine, String handlePartner, IUserIO userIO)
        {
            this.comGeneric = comGeneric;
            this.comHookEngine = comHookEngine;
            this.handlePartner = handlePartner;
            this.userIO = userIO;

            this.gotSessionKey = false;
        }