示例#1
0
        public CustomBinding(PropertyInfo propSource, TSource source, PropertyInfo propTarget, TTarget target, EMode mode)
        {
            this.IsCustomBindingSourceUpdate = false;
            this.IsCustomBindingTargetUpdate = false;
            this.PropertySource = propSource;
            this.PropertyTarget = propTarget;
            this.ValueSource    = source;
            this.ValueTarget    = target;
            this.Mode           = mode;
            switch (this.Mode)
            {
            case EMode.OnceSourceToTarget:
                this.UpdateTargetValueFromSource();
                break;

            case EMode.SourceToTarget:
                this.ValueSource.PropertyChanged += this.Source_PropertyChanged;
                this.UpdateTargetValueFromSource();
                break;

            case EMode.TargetToSource:
                this.ValueTarget.PropertyChanged += this.Target_PropertyChanged;
                this.UpdateSourceValueFromTarget();
                break;

            case EMode.TwoWay:
                this.ValueSource.PropertyChanged += this.Source_PropertyChanged;
                this.ValueTarget.PropertyChanged += this.Target_PropertyChanged;
                this.UpdateTargetValueFromSource();
                break;
            }
        }
示例#2
0
        public Button(String label, EMode mode = EMode.BackgroundLabel, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            Mode = mode;

            if (Mode == EMode.BackgroundLabel)
            {
                BackgroundTextures = new Dictionary<EState, Texture>()
                {
                    { EState.Normal, Create.Texture("ButtonBackgroundN") },
                    { EState.MouseOver, Create.Texture("ButtonBackgroundO") }
                };

                Background = new PictureBox(GetCurrentTexture());
            }

            else if (Mode == EMode.LabelEffect)
            {
                Mode = EMode.LabelEffect;
                ClickOffset = DEFAULT_LABEL_CLICKOFFSET;
            }

            Label = new Label(label);
            AddWidget(Label);

            State = EState.Normal;

            ShortCutMode = shortCutMode && label != null;

            if (label != null && Label.Text.Length > 0)
                ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
        }
示例#3
0
 public void ChangeMode(EMode mode)
 {
     if (mode == EMode.Scroll)
         ChangeMode(mode, SCROLL_MODE_DEFAULT_SIZE);
     else
         ChangeMode(mode, NORMAL_MODE_DEFAULT_SIZE);
 }
示例#4
0
 public ViewStateInfo(Type stateType, EMode mode)
 {
     Type = stateType;
     Mode = mode;
     Instance = null;
     CreateInstance();
 }
        private static int GetNewIndex(int HouseNumber, char letter, EMode mode)
        {
            int index    = GetIndexEncryptedText(letter) ?? 0;
            int newIndex = index - (mode == EMode.Decrypting ? HouseNumber : HouseNumber * -1);

            return(mode == EMode.Decrypting ? (newIndex < 0 ? (26 - (newIndex * -1)) : newIndex) : (newIndex >= 26 ? (newIndex - 26) : newIndex));
        }
示例#6
0
        public ThreekArrayControl()
        {
            iAlphaMiddle      = 0.0f;
            iBlendStateMiddle = EBlendState.eUnknown;
            iTickerMiddle     = new Ticker();

            iTimer = new System.Threading.Timer(TimerElapsed);
            iTimer.Change(Timeout.Infinite, Timeout.Infinite);

            iHitRectLeft   = new Rectangle(26, 40, 50, 50);
            iHitRectMiddle = new Rectangle(79, 19, 93, 92);
            iHitRectRight  = new Rectangle(175, 40, 50, 50);

            iControlLeftEnabled   = true;
            iControlMiddleEnabled = true;
            iControlRightEnabled  = true;

            iPlaylistLeftEnabled   = true;
            iPlaylistMiddleEnabled = true;
            iPlaylistRightEnabled  = true;

            iMode = EMode.eControl;

            InitializeComponent();
        }
示例#7
0
        public Border(Vector2f dimension, EMode mode = EMode.Window, Boolean noBackgroundMode = false)
        {
            Dimension = dimension;

            Mode = mode;

            NoBackgroundMode = noBackgroundMode;

            if (!NoBackgroundMode)
                Background = new Texture(Border.WindowBackgroundTexture);

            Visible = true;

            Borders = new Dictionary<BorderType, List<Sprite>>();
            foreach (BorderType borderType in Enum.GetValues(typeof(BorderType)))
                Borders[borderType] = new List<Sprite>();

            Corners = new Dictionary<CornerType, Sprite>();

            RefreshInfo = new RefreshInfo();

            Color = DEFAULT_AMBIENT_COLOR;

            BackgroundAlphaFactor = DEFAULT_BACKGROUND_ALPHA_FACTOR;

            Build();
        }
        public FormDefineAnalysisCasePallet(EMode mode, double length, double width, double height)
        {
            InitializeComponent();

            uCtrlCase.Visible   = (mode == EMode.PACK_CASE);
            uCtrlBundle.Visible = (mode == EMode.PACK_BUNDLE);

            switch (mode)
            {
            case EMode.PACK_CASE:
            {
                Text                 = Resources.ID_DEFINECASEPALLETANALYSIS;
                _uctrlPackable       = uCtrlCase;
                uCtrlCase.Dimensions = new double[] { length, width, height };
                uCtrlCase.Weight     = 1.0;
            }
            break;

            case EMode.PACK_BUNDLE:
            {
                Text                   = Resources.ID_DEFINEBUNDLEPALLETANALYSIS;
                _uctrlPackable         = uCtrlBundle;
                uCtrlBundle.Dimensions = new double[] { length, width, height };
                uCtrlBundle.UnitWeight = 0.1;
                uCtrlBundle.NoFlats    = 10;
            }
            break;

            default:
                break;
            }
        }
示例#9
0
        public void ResetStatus(bool _forward)
        {
            if (Mode == EMode.Once)
            {
                TargetTime = Duration + Counter * Duration;
            }
            else
            {
                TargetTime = Duration * 2 + Counter * Duration * 2;
            }

            if (_forward)
            {
                CurrentTime = -DelayTime;
                UpdateTween(0);
            }
            else
            {
                CurrentTime = TargetTime + DelayTime;
                UpdateTween(Mode == EMode.Once ? 1 : 0);
            }

            Way       = 0;
            myMode    = Mode;
            myCounter = Counter;
        }
示例#10
0
 private void LoadMatchSettings()
 {
     gameData.SetGameLevel((BuildIndex)SceneManager.GetActiveScene().buildIndex);
     scoreLimit = gameData.GetScoreLimit();
     timeLimit  = gameData.GetTimeLimit();
     gameMode   = gameData.GetGameMode();
 }
示例#11
0
        private void btnRMode_Click(object sender, EventArgs e)
        {
            if (comMon == null)
            {
                labStatus.Text      = CLanguage.Lan("请确定串口是否打开?");
                labStatus.ForeColor = Color.Red;
                return;
            }

            if (txtAddr.Text == "")
            {
                labStatus.Text      = CLanguage.Lan("请输入模块地址");
                labStatus.ForeColor = Color.Red;
                return;
            }
            string er = string.Empty;

            int idAddr = System.Convert.ToInt32(txtAddr.Text);

            EMode mode = EMode.A;

            if (comMon.GetRecordMode(idAddr, out mode, out er))
            {
                cmdMode.SelectedIndex = (int)mode;
                labStatus.Text        = CLanguage.Lan("读取模块工作模式成功");
                labStatus.ForeColor   = Color.Blue;
            }
            else
            {
                labStatus.Text      = CLanguage.Lan("读取模块工作模式失败") + ":" + er;
                labStatus.ForeColor = Color.Red;
            }
        }
示例#12
0
 public ViewStateInfo(Type stateType, EMode mode)
 {
     Type     = stateType;
     Mode     = mode;
     Instance = null;
     CreateInstance();
 }
示例#13
0
        public static String DateDisplayLocalization(DateTime _time, EMode _mode)
        {
            String _specifier = "D2";

            switch (_mode)
            {
            case EMode.Month:
                return(_time.Year + " " + DateFormat.Table(_time.Month, true));

            case EMode.DayDigit:
                return(_time.Year + "-" + _time.Month.ToString(_specifier) + "-" + _time.Day.ToString(_specifier));

            case EMode.Day:
            {
                if (CultureInfo.CurrentCulture.Parent.Name == "fr")
                {
                    return(_time.Day.ToString(_specifier) + " " + DateFormat.Table(_time.Month, true) + " " + _time.Year);
                }
                else
                {
                    return(DateFormat.Table(_time.Month, true) + " " + _time.Day.ToString(_specifier) + ", " + _time.Year);
                }
            }

            case EMode.Hour:
                return(_time.Date.Day.ToString(_specifier) + " " + DateFormat.Table(_time.Date.Month, true) + " " + _time.Year + " - " + _time.Hour + ":" + _time.Minute);

            default:
                return(_time.TimeOfDay.ToString());
            }
        }
示例#14
0
        public static void ShowWindow(EMode mode)
        {
            m_mode = mode;

            switch (m_mode)
            {
            case EMode.eMO_Import:
                WindowTitle = Properties.ImportExportResources.WindowTitleImport;
                break;

            case EMode.eMO_Export:
                WindowTitle = Properties.ImportExportResources.WindowTitleExport;
                break;

            case EMode.eMO_Move:
                WindowTitle = Properties.ImportExportResources.WindowTitleMove;
                break;

            default:
                throw new Exception("Invalid value for EMode");
            }

            ImExFiles window = new ImExFiles();

            window.SetupAffectionComboBox();
            window.ShowDialog();
        }
示例#15
0
        private void FixedUpdate()
        {
            Vector3 dir, pos, delta;

            switch (mode)
            {
            case EMode.attack:
                dir   = (p1 - p0).normalized;
                pos   = transform.position;
                delta = dir * (attackSpeed * Time.fixedDeltaTime);
                if (delta.magnitude > (p1 - pos).magnitude)
                {
                    // We're close enough to switch directions
                    transform.position = p1;
                    mode = EMode.retract;
                    break;
                }
                transform.position = pos + delta;
                break;

            case EMode.retract:
                dir   = (p1 - p0).normalized;
                pos   = transform.position;
                delta = dir * (retractSpeed * Time.fixedDeltaTime);
                if (delta.magnitude > (p0 - pos).magnitude)
                {
                    // We're close enough to switch directions
                    transform.position = p0;
                    mode = EMode.search;
                    break;
                }
                transform.position = pos - delta;
                break;
            }
        }
示例#16
0
    void _switchMode(EMode mode)
    {
        _mode = mode;
        switch (_mode)
        {
        case EMode.Entering:
            _scale = 0.0f;
            GetComponent <Renderer>().enabled = true;

            break;

        case EMode.Entered:
            if (OnEntered != null)
            {
                OnEntered(this);
            }
            break;

        case EMode.Exiting:
            break;

        case EMode.Exitted:
            transform.localScale = Vector3.zero;
            GetComponent <Renderer>().enabled = false;
            if (OnExitted != null)
            {
                OnExitted(this);
            }
            break;
        }
    }
示例#17
0
        private static void ParseArgs(IEnumerable <string> args)
        {
            if (args == null)
            {
                Logging.LogNullError(nameof(args));
                return;
            }

            foreach (string arg in args)
            {
                switch (arg)
                {
                case "":
                    break;

                case "--client":
                    Mode = EMode.Client;
                    break;

                case "--server":
                    Mode = EMode.Server;
                    WCF.StartServer();
                    break;

                default:
                    if (arg.StartsWith("--", StringComparison.Ordinal))
                    {
                        if (arg.StartsWith("--cryptkey=", StringComparison.Ordinal) && (arg.Length > 11))
                        {
                            CryptoHelper.SetEncryptionKey(arg.Substring(11));
                        }
                        else
                        {
                            Logging.LogGenericWarning("Unrecognized parameter: " + arg);
                        }

                        break;
                    }

                    if (Mode != EMode.Client)
                    {
                        Logging.LogGenericWarning("Ignoring command because --client wasn't specified: " + arg);
                        break;
                    }

                    Logging.LogGenericInfo("Command sent: " + arg);

                    // We intentionally execute this async block synchronously
                    Logging.LogGenericInfo("Response received: " + WCF.SendCommand(arg));

                    /*
                     * Task.Run(async () => {
                     *      Logging.LogGenericNotice("WCF", "Response received: " + await WCF.SendCommand(arg).ConfigureAwait(false));
                     * }).Wait();
                     */
                    break;
                }
            }
        }
示例#18
0
        public EMode SetMode(EMode newMode)
        {
            EMode prevMode = mode;

            mode = newMode;

            return(prevMode);
        }
示例#19
0
        /// <summary>
        /// 2차원 포인트 정보로 1차원 인덱스 정보를 얻습니다.
        /// </summary>
        /// <param name="eMode">모드정보</param>
        /// <param name="point">구할 인덱스 포인트 정보</param>
        /// <returns></returns>
        public int GetStep(EMode eMode, Point point)
        {
            //생성할떄 모든 타입 딕셔너리 다만들어놓고 모드로만받아서 계산후 리턴으로 바꿔야함
            int mindex = (int)eMode;
            var myKey  = listDIcClass[mindex].GetDic().FirstOrDefault(x => x.Value == point).Key;

            return((int)myKey);
        }
示例#20
0
        /// <summary>
        /// Constructor
        /// </summary>
        public RSync()
        {
            // Default variables
            FilterFile   = "*";
            FilterFolder = "*";

            Mode = EMode.Download;
        }
 public void ChoseModeOnline()
 {
     state = EState.WAIT_PLAYERS;
     mode  = EMode.ONLINE;
     choseModePanel.SetActive(false);
     waitingPanel.SetActive(true);
     customNetworkManager.gameObject.SetActive(true);
 }
示例#22
0
 public string GetTimeString(
     EElement pStart       = EElement.eHours,
     EElement pEnd         = EElement.eResidual,
     EMode pTimeMode       = EMode.eDefaultMode,
     EProtocol pTimeFormat = EProtocol.eDefaultProtocol)
 {
     return(GetTimeStringNoOptionalArgs(pStart, pEnd, pTimeMode, pTimeFormat));
 }
示例#23
0
        public LabeledTextBox(String label = null, EMode mode = DEFAULT_MODE, TextBox.EInputType inputType = TextBox.DEFAULT_INPUT_TYPE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base(label, mode, shortCutMode)
        {
            TextBox = new TextBox(inputType);
            AddLabeledWidget(TextBox);

            GetLabelWidget().Clicked += new ClickEventHandler(LabeledTextBox_Clicked);
        }
示例#24
0
        public Card(EMode type)
        {
            Properties = new Dictionary <string, CardField>();

            this.Type = type;

            InitProperties();
        }
示例#25
0
        public UPWWindow(EMode mode)
        {
            InitializeComponent();

            _controler = new UPWControler(this, mode);

            _controler.ApplySetting();
        }
示例#26
0
        public static void TransformArray(int[,] arr, EMode mode)
        {
            int originRow    = arr.GetUpperBound(0) + 1;
            int originColumn = arr.GetUpperBound(1) + 1;
            int tmp;

            if (mode == EMode.HorizontalMirror)
            {
                int count = originColumn / 2;


                for (int processRow = 0; processRow < originRow; processRow++)
                {
                    for (int processColumn = 0; processColumn < count; processColumn++)
                    {
                        tmp = arr[processRow, processColumn];
                        arr[processRow, processColumn] = arr[processRow, originColumn - 1 - processColumn];
                        arr[processRow, originColumn - 1 - processColumn] = tmp;
                    }
                }
            }
            else if (mode == EMode.VerticalMirror)
            {
                int count = originRow / 2;

                for (int processColumn = 0; processColumn < originColumn; processColumn++)
                {
                    for (int processRow = 0; processRow < count; processRow++)
                    {
                        tmp = arr[processRow, processColumn];
                        arr[processRow, processColumn] = arr[originRow - 1 - processRow, processColumn];
                        arr[originRow - 1 - processRow, processColumn] = tmp;
                    }
                }
            }
            else if (mode == EMode.DiagonalShift)
            {
                for (int processRow = 0; processRow < originRow - 1; processRow++)
                {
                    for (int processColumn = 0; processColumn < originColumn; processColumn++)
                    {
                        tmp = arr[originRow - 1, processColumn];
                        arr[originRow - 1, processColumn] = arr[processRow, processColumn];
                        arr[processRow, processColumn]    = tmp;
                    }
                }

                for (int processRow = 0; processRow < originRow; processRow++)
                {
                    for (int processColumn = 0; processColumn < originColumn - 1; processColumn++)
                    {
                        tmp = arr[processRow, originColumn - 1 - processColumn];
                        arr[processRow, originColumn - 1 - processColumn] = arr[processRow, (originColumn * 2 - 2 - processColumn) % originColumn];
                        arr[processRow, (originColumn * 2 - 2 - processColumn) % originColumn] = tmp;
                    }
                }
            }
        }
    public void FadeOut(float time = 2.0f)
    {
        //if (Mathf.Abs(m_CurAlpha) < 0.0001f)
        //    return;

        m_Mode     = EMode.FadeOut;
        m_FadeTime = time;
        m_CurTime  = Mathf.InverseLerp(1.0f, 0.0f, m_CurAlpha) * m_FadeTime;
    }
示例#28
0
        public void ChangeMode(EMode mode, float size)
        {
            Mode = mode;
            BackgroundDimension = new Vector2f(size, size);

            TextureLocalRectMode = false;

            EndDrag();
        }
示例#29
0
        /// <summary>
        /// 1차원index로 Point정보를 얻습니다.
        /// </summary>
        /// <param name="eMode">모드정보</param>
        /// <param name="nIndex">인덱스정보</param>
        /// <returns></returns>
        public Point GetPoint(EMode eMode, int nIndex)
        {
            Point retPoint = new Point();
            int   mindex   = (int)eMode;

            listDIcClass[mindex].GetDic().TryGetValue(nIndex, out retPoint);

            return(retPoint);
        }
示例#30
0
 public void SetRepairInventory(RepairInventoryController p_repairInventory)
 {
     m_currentMode       = EMode.REPAIR;
     m_repairInventory   = p_repairInventory;
     m_identifyInventory = null;
     m_currentInventory  = m_repairInventory;
     UpdateItems();
     SelectItemSlot(null);
 }
示例#31
0
 public void SetIdentifyInventory(IdentifyInventoryController p_identifyInventory)
 {
     m_currentMode       = EMode.IDENTIFY;
     m_identifyInventory = p_identifyInventory;
     m_repairInventory   = null;
     m_currentInventory  = m_identifyInventory;
     UpdateItems();
     SelectItemSlot(null);
 }
示例#32
0
        private void OnCollisionEnter(Collision coll)
        {
            if (mode == EMode.dead)
            {
                return;
            }
            if (invincible)
            {
                return;             // Выйти, если Дрей пока неуязвим
            }
            var dEf = coll.gameObject.GetComponent <DamageEffect>();

            if (dEf == null)
            {
                return;           // Если компонент DamageEffect отсуствует - выйти
            }
            Health -= dEf.damage; // Вычесть вылечену ущерба из уровня здоровья
            _aud.PlayOneShot(damageSn);
            if (Health <= 0)
            {
                _aud.PlayOneShot(dieSn);
                deathScreen.SetActive(true);
                mode = EMode.dead;
                return;
            }
            invincible      = true; // Сделать Дрея неуязвимым
            _invincibleDone = Time.time + invincibleDuration;

            if (!dEf.knockback)
            {
                return;
            }
            // Определить направление отбрасывания
            var delta = transform.position - coll.transform.position;

            if (Mathf.Abs(delta.x) >= Mathf.Abs(delta.y))
            {
                // Отбрасывание по горизонтали
                delta.x = (delta.x > 0) ? 1 : -1;
                delta.y = 0;
            }
            else
            {
                // Отбрасывание по вертикали
                delta.x = 0;
                delta.y = (delta.y > 0) ? 1 : -1;
            }

            // Применить скорость отскока к компоненту Rigidbody
            _knockbackVel   = delta * knockbackSpeed;
            _rigid.velocity = _knockbackVel;

            // Установить режим knockback и время прекращения отбрасывания
            mode           = EMode.knockback;
            _knockbackDone = Time.time + knockbackDuration;
        }
示例#33
0
 public static AudioClip[] GetScaleAudio(EKey _key, EMode _mode, EInstrument _instrument)
 {
     AudioClip[] scaleTones = new AudioClip[7];
     scaleTones[0] = GetAudioClipInstrument(_key, _mode, _instrument, 1);
     for (int i = 1; i < 7; i++)
     {
         scaleTones[i] = GetAudioClipInstrument(_key, _mode, _instrument, i + 1);
     }
     return(scaleTones);
 }
示例#34
0
 // TRY TO CHANGE MODE BUT MAY FAIL
 public bool TryChangeMode(EMode e, Object data = null)
 {
     if (curMode == nextMode) // NO RUNNING TRANSITIONS
     {
         nextMode = e;
         arg = data;
         return true;
     }
     return false; // THERE IS ALREADY A RUNNING TRANSITION
 }
示例#35
0
    private static EKey GetNote(EKey _key, EMode _mode, int _step)
    {
        EKey note = _key;

        //1 is root
        for (int i = 2; i < _step; i++)
        {
            note = AddStep(note, GetStepsizeForMode(_step, _mode));
        }
        return(note);
    }
示例#36
0
 internal Trainer(DirectoryInfo imagesDirectory, DirectoryInfo tesseractDirectory, EMode emode, string languageName, string fontName, bool noCopy = false, bool verbose = false, Logger logger = null)
 {
     this.imagesDirectory    = imagesDirectory;
     this.tesseractDirectory = tesseractDirectory;
     this.emode        = emode;
     this.languageName = languageName;
     this.fontName     = fontName;
     this.noCopy       = noCopy;
     this.verbose      = verbose;
     this.logger       = logger;
 }
示例#37
0
        private void OnTriggerEnter(Collider colld)
        {
            var e = colld.GetComponent <Enemy>();

            if (e == null)
            {
                return;
            }

            mode = EMode.gInMiss;
        }
示例#38
0
文件: Pencil.cs 项目: jpx/blazera
        protected Pencil(Texture iconTexture)
            : base(iconTexture)
        {
            IsPainting = false;
            Mode = EMode.Normal;

            Cursor = new PictureBox(null);
            AddWidget(Cursor);

            Empty();
            ShowCursor(false);
        }
 public void ActivateModeOneView(int objectId, ETabActivity tabActivity, EMode mode)
 {
     switch (tabActivity)
     {
         case ETabActivity.Category:
             {
                 if (mode == EMode.View)
                 {
                     ICategoryService categoryService = ObjectFactory.GetInstance<ICategoryService>();
                     m_CategoryControl.Category = categoryService.GetById(objectId);
                     m_CategoryControl.InitializeViewMode();
                 }
                 else if(mode == EMode.New)
                 {
                     m_CategoryControl.InitializeEditMode();
                 }
                 break;
             }
         case ETabActivity.Serie:
             {
                 if (mode == EMode.View)
                 {
                     ISerieService serieService = ObjectFactory.GetInstance<ISerieService>();
                     m_SerieControl.Serie = serieService.GetById(objectId);
                     m_SerieControl.InitializeViewMode();
                 }
                 else if (mode == EMode.New)
                 {
                     m_SerieControl.InitializeEditMode();
                 }
                 break;
             }
         case ETabActivity.Figur:
             {
                 if (mode == EMode.View)
                 {
                     IFigurService figurService = ObjectFactory.GetInstance<IFigurService>();
                     m_FigurControl.Figur = figurService.GetById(objectId);
                     m_FigurControl.InitializeViewMode();
                 }
                 else if (mode == EMode.New)
                 {
                     m_FigurControl.InitializeEditMode();
                 }
                 break;
             }
         case ETabActivity.None:
             {
                 break;
             }
     }
 }
示例#40
0
 private ModeManager()
     : base(App.Game)
 {
     curMode = EMode.ATTRACT_MODE;
     nextMode = EMode.ATTRACT_MODE;
     //curMode = EMode.GAME_MODE;
     //nextMode = EMode.GAME_MODE;
     modes = new Dictionary<EMode, AMode>()
     {
         {EMode.ATTRACT_MODE, new AttractMode()},
         {EMode.GAME_MODE, new GameMode()},
         {EMode.BACKGROUND_MODE, new BackgroundMode()}
     };
 }
示例#41
0
        public HostDialog(EMode mode, List<HostInfo> committedHosts)
        {
            if (committedHosts == null) throw new ArgumentNullException("committedHosts");

            InitializeComponent();
            _committedHosts = committedHosts;
            Mode = mode;

            // validators
            _hostValidator = new Validator(theErrorProvider, theGoodProvider);
            _hostValidator.AddControl(textBoxName, validateAlias);
            _hostValidator.AddControl(textBoxHostname, _hostValidator.ValidateHostname);
            _hostValidator.AddControl(textBoxPort, _hostValidator.ValidatePort);
            _hostValidator.AddControl(textBoxLogin, _hostValidator.ValidateUsername);
            _hostValidator.AddControl(tbxPassword, validatePassword);
            _hostValidator.AddControl(lblPrivateKeyFilename, control => control.Text, validatePrivateKeyData);

            _tunnelValidator = new Validator(theErrorProvider, theGoodProvider);
            _tunnelValidator.AddControl(textBoxSourcePort, validateTunnelSourcePort);
            _tunnelValidator.AddControl(textBoxDestHost, validateTunnelDestinationHost);
            _tunnelValidator.AddControl(textBoxDestPort, validateTunnelDestinationPort);
            _tunnelValidator.AddControl(textBoxTunnelName, validateTunnelAlias);
            // style for selected mode
            if (mode == EMode.AddHost)
            {
                flowLayoutPanelAddHost.Visible = true;
                flowLayoutPanelEditHost.Visible = false;
                AcceptButton = buttonAddHost;
                CancelButton = buttonClose;
            }
            else
            {
                flowLayoutPanelAddHost.Visible = false;
                flowLayoutPanelEditHost.Visible = true;
                AcceptButton = buttonOk;
                CancelButton = buttonCancel;
            }
            // modified check
            textBoxName.TextChanged += delegate { Modified = true; };
            textBoxHostname.TextChanged += delegate { Modified = true; };
            textBoxPort.TextChanged += delegate { Modified = true; };
            textBoxLogin.TextChanged += delegate { Modified = true; };
            tbxPassword.TextChanged += delegate { Modified = true; };
            tbxPassphrase.TextChanged += delegate { Modified = true; };
            tbxRemoteCommand.TextChanged += delegate { Modified = true; };
            rbxPassword.CheckedChanged += delegate { Modified = true; };
            btnLoadPrivateKey.Click += delegate { Modified = true; };
            comboBoxDependsOn.SelectedIndexChanged += delegate { Modified = true; };
        }
示例#42
0
        public LabeledWidget(Texture picture = null, EMode mode = DEFAULT_MODE)
            : base()
        {
            if (picture != null)
            {
                Mode = mode;
                Type = EType.Picture;

                Picture = new Button(picture, null);
                Picture.Dimension = new SFML.Window.Vector2f(DEFAULT_PICTURE_SIZE, DEFAULT_PICTURE_SIZE);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(VBox); break;
                }
            }
        }
    void _switchMode(EMode mode)
    {
        _mode = mode;
        switch (_mode) {
        case EMode.Entering:
            transform.localScale=Vector3.zero;
            GetComponent<Renderer>().enabled=true;

            break;
        case EMode.Entered:
            if(OnEntered!=null)
                OnEntered(this);
            break;
        case EMode.Exiting:
            break;
        case EMode.Exitted:
            transform.localScale=Vector3.zero;
            GetComponent<Renderer>().enabled=false;
            if(OnExitted!=null)
                OnExitted(this);
            break;
        }
    }
示例#44
0
        public LabeledWidget(String label = null, EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            if (label != null)
            {
                Mode = mode;
                Type = EType.Label;

                Label = new Button(label, Button.EMode.Label);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null); AddWidget(VBox); break;
                }

                ShortCutMode = shortCutMode;

                if (Label.Text.Length > 0)
                    ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
            }
        }
示例#45
0
 public FtpForm()
 {
     InitializeComponent();
     mode = EMode.UPLOAD;
 }
示例#46
0
 public void setMode(EMode m)
 {
     modes[m]();
 }
示例#47
0
 public void setMode(EMode modeS)
 {
     mode = modeS;
 }
示例#48
0
 private void EnterEdition(EMode mode, string text)
 {
     txtEdit.Text = text;
     cnvEdit.Visibility = Visibility.Visible;
     m_EditMode = mode;
 }
示例#49
0
		private static void Main(string[] args) {
			AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);

			Logging.LogGenericInfo("Main", "Archi's Steam Farm, version " + Version);
			Directory.SetCurrentDirectory(ExecutableDirectory);
			InitServices();

			// Allow loading configs from source tree if it's a debug build
			if (Debugging.IsDebugBuild) {

				// Common structure is bin/(x64/)Debug/ArchiSteamFarm.exe, so we allow up to 4 directories up
				for (var i = 0; i < 4; i++) {
					Directory.SetCurrentDirectory("..");
					if (Directory.Exists(ConfigDirectory)) {
						break;
					}
				}

				// If config directory doesn't exist after our adjustment, abort all of that
				if (!Directory.Exists(ConfigDirectory)) {
					Directory.SetCurrentDirectory(ExecutableDirectory);
				}
			}

			// By default we're operating on normal mode
			Mode = EMode.Normal;
			Logging.LogToFile = true;

			// But that can be overriden by arguments
			ParseArgs(args);

			// If we ran ASF as a client, we're done by now
			if (Mode == EMode.Client) {
				return;
			}

			Task.Run(async () => await CheckForUpdate().ConfigureAwait(false)).Wait();

			if (!Directory.Exists(ConfigDirectory)) {
				Logging.LogGenericError("Main", "Config directory doesn't exist!");
				Thread.Sleep(5000);
				Task.Run(async () => await Exit(1).ConfigureAwait(false)).Wait();
			}

			foreach (var configFile in Directory.EnumerateFiles(ConfigDirectory, "*.xml")) {
				string botName = Path.GetFileNameWithoutExtension(configFile);
				Bot bot = new Bot(botName);
				if (!bot.Enabled) {
					Logging.LogGenericInfo(botName, "Not starting this instance because it's disabled in config file");
				}
			}

			// Check if we got any bots running
			OnBotShutdown();

			// Wait for signal to shutdown
			ShutdownResetEvent.WaitOne();

			// We got a signal to shutdown, consider giving user some time to read the message
			Thread.Sleep(5000);

			// This is over, cleanup only now
			WCF.StopServer();
		}
示例#50
0
    void Update()
    {
        switch (m_eMode)
        {
            case EMode.Gameplay:
                {

                    m_ReplayManager.Record();
                    break;
                }
            case EMode.Replay:
                {
                    if (!bTransition)
                    {
                        int iTransition = pUiTransition.Length;
                        if (!m_ReplayManager.Play())
                        {
                            bTransition = true;

                            for (int i = 0; i < iTransition; i++)
                            {
                                pUiTransition[i].GetComponent<FadeTransition>().Transition();
                            }

                        }
                        int iPlayer = m_tPlayers.Length;
                        for (int i = 0; i < iPlayer; i++)
                        {
                            if (Input.GetButtonDown("Start_P" + (i + 1)))
                            {

                                for (int j = 0; j < iTransition; j++)
                                {
                                    pUiTransition[j].GetComponent<FadeTransition>().Transition();
                                }
                                bTransition = true;
                                break;
                            }

                        }
                    }
                    else
                    {
                        int iTransition = pUiTransition.Length;
                        for (int i = 0; i < iTransition; i++)
                        {
                            if (pUiTransition[i].GetComponent<FadeTransition>().TimeToChange())
                            {
                                print("Return to game");
                                pUiReplay.enabled = false;
                                m_eMode = EMode.Gameplay;
                                pUiReplay.enabled = false;
                                m_ReplayManager.StopReplay();
                                bTransition = false;
                                break;
                            }
                        }
                    }

                    break;
                }
            case EMode.Transition:
                {

                    TimerWhenGoal -= Time.deltaTime;
                    if (TimerWhenGoal <= 0.0f)
                    {
                        int iTransition = pUiTransition.Length;

                        for (int i = 0; i < iTransition; i++)
                        {
                            pUiTransition[i].GetComponent<FadeTransition>().Transition();
                            if(pUiTransition[i].GetComponent<FadeTransition>().TimeToChange())
                            {
                                m_eMode = EMode.Replay;
                                m_ReplayManager.StartReplay(iLastGoalID);
                                pUiReplay.enabled = true;
                                break;
                            }
                        }

                    }
                    else
                    {
                        m_ReplayManager.Record();
                    }

                    break;
                }
            case EMode.Menu:
                {

                    break;
                }
        }
    }
示例#51
0
		private static void ParseArgs(string[] args) {
			foreach (string arg in args) {
				switch (arg) {
					case "--client":
						Mode = EMode.Client;
						break;
					case "--server":
						Mode = EMode.Server;
						WCF.StartServer();
						break;
					default:
						if (arg.StartsWith("--")) {
							Logging.LogGenericWarning("Unrecognized parameter: " + arg);
							continue;
						}

						if (Mode != EMode.Client) {
							Logging.LogGenericWarning("Ignoring command because --client wasn't specified: " + arg);
							continue;
						}

						Logging.LogGenericInfo("Command sent: " + arg);

						// We intentionally execute this async block synchronously
						Logging.LogGenericInfo("Response received: " + WCF.SendCommand(arg));
						/*
						Task.Run(async () => {
							Logging.LogGenericNotice("WCF", "Response received: " + await WCF.SendCommand(arg).ConfigureAwait(false));
						}).Wait();
						*/
						break;
				}
			}
		}
示例#52
0
		private static void ParseArgs(IEnumerable<string> args) {
			if (args == null) {
				Logging.LogNullError(nameof(args));
				return;
			}

			foreach (string arg in args) {
				switch (arg) {
					case "":
						break;
					case "--client":
						Mode = EMode.Client;
						break;
					case "--server":
						Mode = EMode.Server;
						WCF.StartServer();
						break;
					default:
						if (arg.StartsWith("--", StringComparison.Ordinal)) {
							if (arg.StartsWith("--cryptkey=", StringComparison.Ordinal) && (arg.Length > 11)) {
								CryptoHelper.SetEncryptionKey(arg.Substring(11));
							} else {
								Logging.LogGenericWarning("Unrecognized parameter: " + arg);
							}

							break;
						}

						if (Mode != EMode.Client) {
							Logging.LogGenericWarning("Ignoring command because --client wasn't specified: " + arg);
							break;
						}

						Logging.LogGenericInfo("Command sent: " + arg);

						// We intentionally execute this async block synchronously
						Logging.LogGenericInfo("Response received: " + WCF.SendCommand(arg));
						/*
						Task.Run(async () => {
							Logging.LogGenericNotice("WCF", "Response received: " + await WCF.SendCommand(arg).ConfigureAwait(false));
						}).Wait();
						*/
						break;
				}
			}
		}
示例#53
0
        /// <summary>
        /// �X�V
        /// </summary>
        /// <returns>�ʐM���</returns>
        public bool Update()
        {
            spi.WriteRead(write, read);

            if (read[RCV_RES_POS] != RCV_OK)
            {
                error_cnt++;
                mode = EMode.Error;
                return false;
            }

            switch (read[RCV_MODE_POS])
            {
                case RCV_MODE_DIGITAL:
                    mode = EMode.Digital;
                    break;
                case RCV_MODE_ANALOG:
                    mode = EMode.Analog;
                    break;
                default:
                    error_cnt++;
                    mode = EMode.Error;
                    return false;
            }

            digitalUpper = read[RCV_DIGITAL_UPPER_POS];
            digitalLower = read[RCV_DIGITAL_LOWER_POS];

            error_cnt = 0;

            return true;
        }
示例#54
0
 public void TransitionToReplay(int iGoal)
 {
     m_eMode = EMode.Transition;
     TimerWhenGoal = MaxTimerGoal;
     iLastGoalID = iGoal;
 }
示例#55
0
    //EMode Mode
    //{
    //    get { return m_eMode; }
    //    set
    //    {
    //        m_eMode = value;
    //        if (value == EMode.Replay)
    //            m_ReplayManager.StartReplay();
    //    }
    //
    //}
    void Start()
    {
        m_tPlayers = GameObject.FindGameObjectsWithTag("Player");
        m_tBall = GameObject.FindGameObjectWithTag("Ball");
        m_tTerrain = GameObject.Find("Stade");
        m_tGoals = GameObject.FindGameObjectsWithTag("Goal");
        pUiTransition = GameObject.FindGameObjectsWithTag("Transition");
        m_ReplayManager = transform.GetComponentInChildren<ReplayManager>();

        m_eMode = EMode.Gameplay;
        TimerBeforeStart = MaxTimer;
    }
示例#56
0
文件: Pencil.cs 项目: jpx/blazera
        public override Boolean OnEvent(BlzEvent evt)
        {
            if (evt.IsHandled)
            {
                End();

                ShowCursor(false);

                return base.OnEvent(evt);
            }

            switch (evt.Type)
            {
                case EventType.MouseButtonPressed:

                    if (evt.MouseButton.Button == Mouse.Button.Right)
                    {
                        Empty();

                        if (!MapBox.MapContainsMouse())
                            break;

                        return true;
                    }

                    if (evt.MouseButton.Button != Mouse.Button.Left)
                        break;

                    if (!MapBox.MapContainsMouse())
                        break;

                    Init();

                    Vector2f clickPaintPoint = GetLocalMouseCenter();
                    if (!CanPaint(clickPaintPoint))
                        break;

                    return Paint(clickPaintPoint);

                case EventType.MouseButtonReleased:

                    if (evt.MouseButton.Button != Mouse.Button.Left)
                        break;

                    End();

                    if (!MapBox.MapContainsMouse())
                        break;

                    return true;

                case EventType.MouseMoved:

                    if (!MapBox.MapContainsMouse())
                    {
                        ShowCursor(false);
                        break;
                    }

                    Vector2f movePaintPoint = GetLocalMouseCenter();
                    Boolean canPaint = CanPaint(movePaintPoint);

                    ShowCursor();

                    SetCursorEnability(canPaint);

                    if (!IsPainting)
                        break;

                    if (!canPaint)
                        break;

                    return Paint(movePaintPoint);

                case EventType.KeyPressed:

                    switch (evt.Key.Code)
                    {
                        case Keyboard.Key.P:

                            Mode = EMode.Pot;

                            return true;
                    }

                    break;

                case EventType.KeyReleased:

                    switch (evt.Key.Code)
                    {
                        case Keyboard.Key.P:

                            Mode = EMode.Normal;

                            return true;
                    }

                    break;
            }

            return base.OnEvent(evt);
        }
示例#57
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (curMode != nextMode && modes[curMode].FadeOut(gameTime)) // IF A MODE CHANGE IS REQUESTED FADE OUT CURMODE
         curMode = nextMode; // IF FADE OUT FINISHED THEN SET THE NEW MODE
     if (curMode == nextMode) // IF IS FADING OUT
         modes[curMode].Update(gameTime); // DONT UPDATE
 }
示例#58
0
文件: QRMode.cs 项目: vlapchenko/nfx
 private QRMode(EMode mode, int ordinal, int[] versionCharacterCount)
 {
   Mode = mode;
   ModeSignature = ordinal;
   VersionCharacterCount = versionCharacterCount;
 }
示例#59
0
 private void ExitEdition()
 {
     cnvEdit.Visibility = Visibility.Hidden;
     txtEdit.Text = "";
     m_EditMode = EMode.None;
 }
示例#60
0
        public LabeledDownList(String label, Int32 size = ExtendedBox.DEFAULT_SIZE, EMode mode = DEFAULT_MODE)
            : base(label, mode, false)
        {
            DownList = new DownList(size);

            AddLabeledWidget(DownList);
            GetLabelWidget().Clicked += new ClickEventHandler(LabeledDownList_Clicked);
        }