Esempio n. 1
0
        public static void Main(string[] args)
        {
            NameSelector.DoExample();

            //IdSelector.Main();

            //NoSuchElement.DoExample();

            Console.ReadKey();
        }
Esempio n. 2
0
 private void RenameClass_btn_Click(object sender, RoutedEventArgs e)
 {
     if (ProjectSelector.Validate() && ClassSelector.Validate() && NameSelector.Validate())
     {
         if (GlobalFunction.ProjectBackupPrompt(ProjectSelector.Directory, ProjectSelector.FileName))
         {
             RenameClassAndReferences();
             MessageBox.Show("Your class has been renamed\nFollow steps on next page to open your project for the first time");
             Tutorial Temp = new Tutorial();
             Temp.Show();
             Close();
         }
     }
 }
        public ICollection <StylesheetTreeNode> FindNodes(RadElement element)
        {
            //TODO too coupled to RadElement and its properties
            LinkedList <StylesheetTreeNode> result = new LinkedList <StylesheetTreeNode>();

            if (nodes == null)
            {
                return(result);
            }

            RadItem            item = element as RadItem;
            StylesheetTreeNode foundNode;

            if (item != null && item.StateManager != null /*&& !string.IsNullOrEmpty(item.VisualState)*/)
            {
                //Opptimization for Old themes
                if (this.hasVisualStateSelectors)
                {
                    foreach (string itemState in item.StateManager.GetStateFallbackList(item))
                    {
                        if (this.nodes.TryGetValue(VisualStateSelector.GetSelectorKey(itemState), out foundNode))
                        {
                            result.AddLast(foundNode);
                            break;
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(element.Class))
            {
                if (this.nodes.TryGetValue(ClassSelector.GetSelectorKey(element.Class), out foundNode))
                {
                    result.AddLast(foundNode);
                }
            }

            if (!string.IsNullOrEmpty(element.Name) && this.nodes.TryGetValue(NameSelector.GetSelectorKey(element.Name), out foundNode))
            {
                result.AddLast(foundNode);
            }

            if (this.nodes.TryGetValue(element.GetThemeEffectiveType().GetHashCode(), out foundNode))
            {
                result.AddLast(foundNode);
            }

            return(result);
        }
Esempio n. 4
0
    private void Start()
    {
        map         = FindObjectOfType <MapColumn>();
        myRigidBody = GetComponent <Rigidbody2D>();
        NameSelector nameSelector = FindObjectOfType <NameSelector>();

        entity.SetName(nameSelector.GetRandom("BOSS"));

        gravity = 9.81f;

        Vector3 pos = transform.position;

        pos.x = map.transform.position.x;
        transform.position = pos;
        JumpTo(map.GetNbrColumn() - 1);
        currentTime = intervalSpawn;
    }
Esempio n. 5
0
    private void Start()
    {
        myTransform      = transform;
        myRigidBody      = gameObject.GetComponent <Rigidbody2D>();
        myAnimator       = GetComponent <Animator>();
        mySpriteRenderer = GetComponent <SpriteRenderer>();
        gravity          = defaulGravity;
        myAnimator.SetTrigger("Idle");

        NameSelector nameSelector = FindObjectOfType <NameSelector>();

        GetComponent <ObjectEntity>().SetName(nameSelector.GetRandom("GOBLIN"));

        console = FindObjectOfType <ConsoleWriter>();
        console.AddOnSendCommand(SetAlive);

        attackCollider.tag = "Attack";

        int result = Random.Range(0, 3);

        switch (result)
        {
        case 0:
            GetComponent <ObjectEntity>().SetValue("WEAPON", "FIST");
            weapon.GetComponent <Animator>().SetTrigger("SwitchToFist");
            GetComponentInChildren <PlayerWeapon>().SetWeapon(0);
            break;

        case 1:
            GetComponent <ObjectEntity>().SetValue("WEAPON", "SWORD");
            weapon.GetComponent <Animator>().SetTrigger("SwitchToSword");
            GetComponentInChildren <PlayerWeapon>().SetWeapon(1);
            break;

        case 2:
            GetComponent <ObjectEntity>().SetValue("WEAPON", "MACE");
            weapon.GetComponent <Animator>().SetTrigger("SwitchToMace");
            GetComponentInChildren <PlayerWeapon>().SetWeapon(2);
            break;
        }
    }
Esempio n. 6
0
 public DatabaseExpItemVM(AccountExpItemVM parentAccount, DatabaseModel model, MainVM main) : base(main)
 {
     _model = model;
     this.Children.Add(new DummyExpItemVM(main));
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Refresh",
         Command = new LambdaCommand(async(o) =>
         {
             await refresh();
         })
     });
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Create collection",
         Command = new LambdaCommand(async(o) =>
         {
             var dlg = new NameSelector("New collection name");
             if (dlg.ShowDialog() == true && dlg.Value.IsNotEmpty())
             {
                 var created = await _model.CreateCollection(dlg.Value);
                 this.Children.Insert(0, new CollectionExpItemVM(this, created, main));
             }
         })
     });
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Delete database",
         Command = new LambdaCommand(async(o) =>
         {
             MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 await this._model.DeleteDabaseFormAccount();
                 parentAccount.Children.Remove(this);
             }
         })
     });
 }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        // To prevent duplicate unitManagers
        if (unitManagerRef == null)
        {
            unitManagerRef = this;
            DontDestroyOnLoad(gameObject);

            nameSelector = GetComponent<NameSelector>();
            tileManager = GetComponent<TileManager>();
            tileInfo = GameObject.Find("Tile Info");

            initGameData();   // Create or load data depending on option clicked
        }
        // Destroy duplicated gameObject created when changing scenes
        else
            DestroyImmediate(gameObject);
    }
Esempio n. 8
0
 void Awake()
 {
     bs = this.GetComponent <BackgroundSelector>();
     ns = this.GetComponent <NameSelector>();
     ms = this.GetComponent <ModelSelector>();
 }
 public AccountExpItemVM(AccountModel model, MainVM main) : base(main)
 {
     IsBroken = false;
     _model   = model;
     this.Children.Add(new DummyExpItemVM(main));
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Refresh",
         Command = new LambdaCommand(async(o) =>
         {
             await this.LoadDatabases();
         })
     });
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Create database",
         Command = new LambdaCommand(async(o) =>
         {
             if (IsBroken)
             {
                 MessageBox.Show("Can't create database on a broken connect, check error message, try to reenter credentials.");
                 return;
             }
             var dlg = new NameSelector("New database name");
             if (dlg.ShowDialog() == true && dlg.Value.IsNotEmpty())
             {
                 var created = await _model.CreateDatabase(dlg.Value);
                 this.Children.Insert(0, new DatabaseExpItemVM(this, created, this.Main));
             }
         })
     });
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Change access data",
         Command = new LambdaCommand((o) =>
         {
             var oldEndpoint = _model.Endpoint;
             DocDbAccountCredentialsDlg.ShowDialog(_model.Credentials, async(creds) =>
             {
                 await performWithIsBrokenTest(async() =>
                 {
                     this.Children.Clear();
                     await _model.RefreshCredentials();
                     foreach (var db in this._model.Databases)
                     {
                         this.Children.Add(new DatabaseExpItemVM(this, db, this.Main));
                     }
                     Config.Instance.ChangeAccountCredentials(oldEndpoint, _model.Credentials);
                 });
             });
         })
     });
     this.ContextMenuItems.Add(new MenuItemVM()
     {
         Caption = "Remove",
         Command = new LambdaCommand((o) =>
         {
             MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Removal Confirmation", System.Windows.MessageBoxButton.YesNo);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 main.Explorer.RootItems.Remove(this);
                 Config.Instance.RemoveAccount(_model.Endpoint);
             }
         })
     });
 }