public Unit nativeFinishType(Runtime.Struct typeValue, TypeBuilder typeBuilder)
        {
            foreach (var field in typeValue.Fields)
            {
                typeBuilder.DefineField(field.Name, TypeBox.Unbox(field.Type), FieldAttributes.Public | FieldAttributes.InitOnly);
            }

            // Constructor
            var constuctor = typeBuilder.DefineConstructor(
                MethodAttributes.Public, CallingConventions.Standard,
                typeValue.Fields.Select(field => TypeBox.Unbox(field.Type)).ToArray()
                );

            ILGenerator ilgen = constuctor.GetILGenerator();

            for (int i = 0; i < typeValue.Fields.Count(); i++)
            {
                ilgen.Emit(OpCodes.Ldarg_0);
                ilgen.Emit(OpCodes.Ldarg, i + 1);
                ilgen.Emit(OpCodes.Stfld, typeBuilder.GetField(typeValue.Fields[i].Name));
            }
            ilgen.Emit(OpCodes.Ret);

            // TODO: ToString
            // TODO: structural equality
            // TODO: structural comparison
            // TODO: structural hashcode

            return(Unit.Instance);
        }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="node">node to edit</param>
        public ItemForm(XmlNode node)
        {
            InitializeComponent();


            // TileSetNameBox
            TileSetNameBox.BeginUpdate();
            foreach (string name in ResourceManager.GetAssets <TileSet>())
            {
                TileSetNameBox.Items.Add(name);
            }
            TileSetNameBox.EndUpdate();


            TypeBox.BeginUpdate();
            TypeBox.Items.Clear();
            foreach (string name in Enum.GetNames(typeof(ItemType)))
            {
                TypeBox.Items.Add(name);
            }
            TypeBox.EndUpdate();


            Item = new Item();
            Item.Load(node);
        }
        public async Task <CommandResult <ListMessageResult> > Messages(
            [FromServices] ListMessageCommand listMessageCommand, TypeBox typeBox, string id)
        {
            var            queryString = Request.Query.ToDictionary(q => q.Key, q => q.Value);
            MessagesFilter messagesFilter;

            if (queryString.ContainsKey("f"))
            {
                var f = queryString["f"];
                messagesFilter = JsonConvert.DeserializeObject <MessagesFilter>(f);
            }
            else
            {
                messagesFilter = new MessagesFilter();
            }

            var sendMessageInput =
                new ListMessageInput {
                BoxId = new BoxId {
                    Id = id, Type = typeBox
                }, Filter = messagesFilter
            };
            var userInput = new UserInput <ListMessageInput>
            {
                UserId = User.Identity.IsAuthenticated ? User.GetUserId() : string.Empty,
                Data   = sendMessageInput
            };

            var result =
                await Business
                .InvokeAsync <ListMessageCommand, UserInput <ListMessageInput>, CommandResult <ListMessageResult> >(
                    listMessageCommand, userInput);

            return(result);
        }
Exemple #4
0
        private void New(object sender, RoutedEventArgs e)
        {
            SetBooleans(true);

            DataGrid.UnselectAll();
            TypeBox.Focus();
        }
Exemple #5
0
 private static void Table_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (FormContainer.mainForm.Table.Name == "Creator")
     {
         int cellHeigh = FormContainer.mainForm.Table.RowTemplate.Height;
         int cellWidth = FormContainer.mainForm.Table.Columns[0].Width;
         int WidthLB   = FormContainer.mainForm.Table.Columns[1].Width;
         editCell = e.RowIndex;
         TypeBox.CreateTypeBox();
         if (e.ColumnIndex == FormContainer.mainForm.Table.Columns["Type"].Index)
         {
             Point p = FormContainer.mainForm.Table.Location;
             p.X += cellWidth + FormContainer.mainForm.Table.RowHeadersWidth;
             p.Y += FormContainer.mainForm.Table.ColumnHeadersHeight + cellHeigh + (cellHeigh * editCell);
             TypeBox.typeBox.Width    = WidthLB;
             TypeBox.typeBox.Location = p;
             FormContainer.mainForm.Controls.Add(TypeBox.typeBox);
             TypeBox.typeBox.BringToFront();
         }
         if (e.ColumnIndex == FormContainer.mainForm.Table.Columns["Name"].Index || e.ColumnIndex == FormContainer.mainForm.Table.Columns["Nullable"].Index)
         {
             FormContainer.mainForm.Controls.Remove(TypeBox.typeBox);
         }
     }
 }
Exemple #6
0
 public Type AsClrType()
 {
     if (this.ImmediateValue != null)
     {
         return(TypeBox.TryUnbox(this.ImmediateValue).GetOrDefault(typeof(object)));
     }
     return(typeof(object));
 }
Exemple #7
0
        // Method:      StartServer_Click()
        // Description: This method takes the port from the interface, validates it
        //              and once validated, it fire ups the server and send user to
        //              chat screen.
        private void StartServer_Click(object sender, EventArgs e)
        {
            // application is running server, update the variable to let other methods know
            ServerItIs = true;

            // get port from interface and clear the textbox
            string portString = ServerPort.Text;

            ServerPort.Clear();
            bool valid = false;


            // validate port
            int temp = 0;

            int.TryParse(portString, out temp);

            if (temp > 0)
            {
                valid = true;
            }

            // start server if port is valid
            if (valid)
            {
                Int32     port = Int32.Parse(portString);
                IPAddress ip   = IPAddress.Parse("127.0.0.1");

                try
                {
                    server = new TcpListener(ip, port);

                    // start server
                    server.Start();

                    // bring chat panel to front
                    ChatPanel.BringToFront();
                    TypeBox.Focus();

                    // update textbox at the top with IP address and port
                    ConnectionInfo.Text = "IP: " + GetLocalIPAddress() + "   Port: " + port;

                    // start thread to handle the client
                    ThreadPool.QueueUserWorkItem(HandleClient);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
            else
            {
                MessageBox.Show("Port cannot be alphabet, special character or negative number." +
                                "Please try again");
            }
        }
        private void HandleThreadClick(object sender, MouseButtonEventArgs e)
        {
            var ctrl = sender as ThreadControl;

            if (sender is ThreadControl)
            {
                _currentThread = ctrl.ThreadId;
                ProcessThreadId(ctrl.ThreadId, true);
                TypeBox.IsReadOnly = false;
                TypeBox.Focus();
            }
        }
        private void ManagerNewProducts_Load(object sender, EventArgs e)
        {
            foreach (var item in Enum.GetValues(typeof(ProductType)))
            {
                if (item.ToString() != ProductType.მენიუ.ToString())
                {
                    TypeBox.AddItem(item.ToString());
                }
            }

            TypeBox.selectedIndex   = 0;
            MenuGridView.DataSource = Menu.MenuItems;
        }
Exemple #10
0
        public ModuleEntryEditor(Dictionary <String, String> mod)
        {
            InitializeComponent();
            EditedModule = mod;

            RulesetCBox.Items.AddRange(Rulesets);

            OpenModuleDialog.Filter          = "FG Module File (.mod)|*.mod";
            OpenModuleDialog.Title           = "Select a Fantasy Grounds Module File";
            OpenModuleDialog.CheckFileExists = true;
            OpenModuleDialog.CheckPathExists = true;
            if (Directory.Exists(CharConverter.Fg2RegistryAppDataPath + "\\modules"))
            {
                OpenModuleDialog.InitialDirectory = CharConverter.Fg2RegistryAppDataPath + "\\modules";
            }

            PathBox.Text = mod["path"];
            NameBox.Text = mod["name"];
            String modruleset = mod["ruleset"];

            for (int i = 0; i < Rulesets.Length; i++)
            {
                String ruleset = Rulesets[i];
                if (modruleset.Contains(ruleset))
                {
                    RulesetCBox.SelectedIndex = i;
                }
            }
            if (RulesetCBox.SelectedIndex < 0)
            {
                RulesetCBox.SelectedIndex = 0;
            }
            String DisplayRuleset = Rulesets[RulesetCBox.SelectedIndex];

            TypeBox.Items.Clear();
            TypeBox.Items.AddRange(ModuleManager.Types[DisplayRuleset]);

            String modtype = mod["type"];

            for (int i = 0; i < TypeBox.Items.Count; i++)
            {
                var type = (String)TypeBox.Items[i];
                if (modtype.Contains(type))
                {
                    TypeBox.SetItemChecked(i, true);
                }
            }
        }
Exemple #11
0
 public AddCard(PatientModel patient)
 {
     InitializeComponent();
     _patient       = patient;
     TopLabel.Text += " " + _patient.Name;
     _docs          = DbConnector.GetInstance().GetStaffList();
     _types         = DbConnector.GetInstance().GetDiseaseTypes();
     DoctorBox.BeginUpdate();
     _docs.ForEach(x => DoctorBox.Items.Add(x.Name));
     DoctorBox.EndUpdate();
     DoctorBox.Text = _docs[0].Name;
     TypeBox.BeginUpdate();
     _types.ForEach(x => TypeBox.Items.Add(x.Name));
     TypeBox.EndUpdate();
     TypeBox.Text = _types[0].Name;
 }
Exemple #12
0
 private void WaiterWindow_Load(object sender, EventArgs e)
 {
     ResultBox.resultcombobox = ResultCombobox;
     dataGridView1.DataSource = Menu.MenuItems;
     dataGridView1.Refresh();
     dataGridView3.Refresh();
     foreach (var item in Enum.GetValues(typeof(ProductType)))
     {
         TypeBox.AddItem(item.ToString());
     }
     foreach (var item in Enum.GetValues(typeof(PayTypes)))
     {
         PayTypeComboBox.AddItem(item.ToString());
     }
     PayTypeComboBox.selectedIndex = 0;
     TypeBox.selectedIndex         = 0;
 }
Exemple #13
0
        // Method:      StartClient_Click()
        // Description: This method takes the IP and port from the interface, validates it
        //              and once validated, it tries to connect to server, once connected,
        //              send user to chat screen.
        private void StartClient_Click(object sender, EventArgs e)
        {
            bool      valid = false;
            IPAddress ip;
            int       port = 0;

            // validate ip and port
            if (IPAddress.TryParse(ipbox.Text, out ip) && int.TryParse(clientport.Text, out port))
            {
                if (port > 0)
                {
                    valid = true;
                }
            }

            // initialise client and connect to server if valid
            if (valid)
            {
                RunTheClient = new TcpClient();

                try
                {
                    // connect to server
                    RunTheClient.Connect(ip, port);

                    if (RunTheClient.Connected)
                    {
                        ChatPanel.BringToFront();
                        ConnectionInfo.Text = "Connected to server " + ip.ToString() + " at port " + port;
                        TypeBox.Focus();

                        // start thread to receive messages from server
                        ThreadPool.QueueUserWorkItem(HandleServer);
                    }
                }
                // connection refused
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
            else
            {
                MessageBox.Show("Invalid entry. Please try again.");
            }
        }
        //Setup Game Setting
        private void InitializeGame(int score)
        {
            game             = new Game(score);                      //Game Setup
            Dead.Text        = "";                                   //Health Bar
            TypeBox.Text     = "";                                   //Type Area
            TimeCounter.Text = "";                                   //Reset Timer for Time Left
            words            = new List <TextBlock>(Game.NoOfBlock); //Reset the number of words in game
            for (int i = 0; i < Game.Lives; i++)
            {
                Lives[i]            = LifeGrid.Children[i] as Image; //Health Bar Images
                Lives[i].Visibility = Visibility.Visible;
            }
            Start start = new Start(Start_Game) + new Start(Start_Time) + new Start(Background_Timer); //Chain up all timer into delegate Start()

            start();
            TypeBox.Focus(); //Cursor on Typebox
        }
Exemple #15
0
        // Method:      SendEncrypted_Click()
        // Description: This method takes the message from textbox, and send it over on
        //              the established TCP stream encrypted with Bruce Scheneir's algorithm.
        private void SendEncrypted_Click(object sender, EventArgs e)
        {
            // get message from textbox to be sent
            string msg = TypeBox.Text;

            if (msg == "")
            {
                return;
            }

            TypeBox.Clear();
            StreamWriter sw;
            string       key = "#981#-";

            // encrypt it and add the key to let the other server/client know that it is
            // encrypyed
            string encrypted = key + b.Encrypt_CBC(msg);

            try
            {
                // establish writer to write to stream
                if (ServerItIs)
                {
                    sw = new StreamWriter(client.GetStream());
                }
                else
                {
                    sw = new StreamWriter(RunTheClient.GetStream());
                }

                sw.AutoFlush = true;

                // send encrypted message
                sw.WriteLine(encrypted);

                // add to chat history
                ChatHistory.Items.Add("Me: " + msg);
                TypeBox.Focus();
                ScrollToBottom();
            }
            catch (Exception)
            {
                MessageBox.Show("No clients have connected yet... Try again later!", "Error 643");
            }
        }
    private IEnumerator Movement()
    {
        WaitForSeconds wait = new WaitForSeconds(0.15f);

        while (true)
        {
            Vector3 newPosition = head.transform.position + direction;
            TypeBox boxBusy     = GetMap(newPosition);

            if (boxBusy == TypeBox.Obstacle)
            {
                Dead();
                yield return(new WaitForSeconds(3));

                GameManager.sharedInstance.GameOver();
                //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                yield break;
            }
            else
            {
                GameObject bodyPart;
                if (boxBusy == TypeBox.Item)
                {
                    bodyPart = NewBlock(newPosition.x, newPosition.y);
                    MoveItemPositionRandom();
                    pointsAdd.AddPoints();
                }
                else
                {
                    bodyPart = body.Dequeue();
                    SetMap(bodyPart.transform.position, TypeBox.Empty);
                    bodyPart.transform.position = newPosition;
                    SetMap(newPosition, TypeBox.Obstacle);
                    body.Enqueue(bodyPart);
                }

                head = bodyPart;

                yield return(wait);
            }
        }
    }
Exemple #17
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            ItemsList.RemoveAt(ItemsListBox.SelectedIndex);
            ListBind.DataSource = null;
            ListBind.DataSource = ItemsList;

            NameBox.Clear();
            TypeBox.Clear();
            DescriptionBox.Clear();
            MightBox.Clear();
            DefenceBox.Clear();
            WeightBox.Clear();
            ItemWeightBox.Clear();
            PropertiesBox.Clear();

            foreach (int i in RequirementsCheckedListBox.CheckedIndices)
            {
                RequirementsCheckedListBox.SetItemChecked(i, false);
            }
        }
Exemple #18
0
        // Method:      SendNormal_Click()
        // Description: This method takes the message from textbox, and send it over on
        //              the established TCP stream (unencrypted).
        private void SendNormal_Click(object sender, EventArgs e)
        {
            // get message from interface and make sure it is not empty
            string msg = TypeBox.Text;

            if (msg == "")
            {
                return;
            }

            // clear typebox after reading message
            TypeBox.Clear();
            StreamWriter sw;

            try
            {
                // start the stream based on whether or not it is server
                if (ServerItIs)
                {
                    sw = new StreamWriter(client.GetStream());
                }
                else
                {
                    sw = new StreamWriter(RunTheClient.GetStream());
                }

                sw.AutoFlush = true;

                // write message to stream
                sw.WriteLine(msg);

                // add the chat history
                ChatHistory.Items.Add("Me: " + msg);
                TypeBox.Focus();
                ScrollToBottom();
            }
            catch (Exception)
            {
                MessageBox.Show("No clients have connected yet... Try again later!", "Error 643");
            }
        }
Exemple #19
0
 private void Clear_All_Entries()
 {
     NameBox.Clear();
     USNBox.Clear();
     TypeBox.Clear();
     AmountBox.Clear();
     AmountToBox.Clear();
     YearList.SelectedItems.Clear();
     YearToList.SelectedItems.Clear();
     MonthList.Visible    = false;
     MonthToList.Visible  = false;
     DayList.Visible      = false;
     DayToList.Visible    = false;
     HourList.Visible     = false;
     HourToList.Visible   = false;
     MinuteList.Visible   = false;
     MinuteToList.Visible = false;
     AMPMList.Visible     = false;
     AMPMToList.Visible   = false;
     DataView.DataSource  = null;
 }
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     user1.UserSex              = SexBox.Text;
     user1.UserAge              = Int32.Parse(AgeBox.Text);
     user1.UserWeight           = float.Parse(WeightBox.Text);
     user1.UserHeight           = float.Parse(HeightBox.Text);
     user1.UserType             = TypeBox.Text;
     user1.UserdailyActivity    = AcitvityBox.Text;
     user1.UserTSWeekly         = Int32.Parse(SDays.Text);
     user1.UserTSDaily          = Int32.Parse(SMinutes.Text);
     user1.UserTSIntensivity    = SIntensivity.Text;
     user1.UserTAWeekly         = Int32.Parse(ADays.Text);
     user1.UserTADaily          = Int32.Parse(AMinutes.Text);
     user1.UserTAIntensivity    = AIntensivity.Text;
     user1.UserFoodRestrictions = Diary.IsChecked.ToString() + "," + Gluten.IsChecked.ToString() + "," + Meat.IsChecked.ToString();
     user1.UserMealNumber       = Int32.Parse(MealNumber.Text);
     DataBaseSolution.UpdateUserData(user1);
     SexBox.ClearValue(NameProperty);
     AgeBox.Clear();
     WeightBox.Clear();
     HeightBox.Clear();
     TypeBox.ClearValue(NameProperty);
     AActivityBox.ClearValue(NameProperty);
     AcitvityBox.ClearValue(NameProperty);
     SDays.Clear();
     SMinutes.Clear();
     SIntensivity.ClearValue(NameProperty);
     ADays.Clear();
     AMinutes.Clear();
     AIntensivity.ClearValue(NameProperty);
     Diary.IsChecked  = false;
     Gluten.IsChecked = false;
     Meat.IsChecked   = false;
     MealNumber.ClearValue(NameProperty);
     MessageBox.Show("Dane użytkownika zostały zaktualizowane");
 }
Exemple #21
0
 private void LabelType_Click(object sender, EventArgs e)
 {
     TypeBox.Select();
 }
        public async Task <CommandResult <GetMessageResult> > Message([FromServices] GetMessageCommand getMessageCommand, TypeBox typeBox, string boxId, string chatId)
        {
            var sendMessageInput = new GetMessageInput
            {
                ChatId = chatId,
                BoxId  = new BoxId {
                    Id = boxId, Type = typeBox
                }
            };
            var userInput = new UserInput <GetMessageInput>
            {
                UserId = User.Identity.IsAuthenticated ? User.GetUserId() : string.Empty,
                Data   = sendMessageInput
            };

            var result =
                await Business
                .InvokeAsync <GetMessageCommand, UserInput <GetMessageInput>, CommandResult <GetMessageResult> >(
                    getMessageCommand, userInput);

            return(result);
        }
 public object array(object itemType)
 {
     return(typeof(IImmutableList <>).MakeGenericType(TypeBox.Unbox(itemType)));
 }
Exemple #24
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            string        name, type, description;
            int           weight, might, defence, carryweight;
            List <string> requirements = new List <string>();
            List <string> properties;
            List <Tuple <string, int> > bonus = new List <Tuple <string, int> >();

            if (NameBox.Text == "")
            {
                MessageBox.Show("Puste pole na imię!");
                return;
            }
            else
            {
                name = NameBox.Text;
            }

            if (TypeBox.Text == "")
            {
                MessageBox.Show("Puste pole określające typ przedmiotu!");
                return;
            }
            else
            {
                type = TypeBox.Text;
            }

            if (DescriptionBox.Text == "")
            {
                MessageBox.Show("Puste pole opisu!");
                return;
            }
            else
            {
                description = DescriptionBox.Text;
            }

            int.TryParse(ItemWeightBox.Text, out weight);
            if (weight == 0)
            {
                MessageBox.Show("Błąd w polu określającym wagę przedmiotu!");
                return;
            }

            bool might_result       = int.TryParse(MightBox.Text, out might);
            bool defence_result     = int.TryParse(DefenceBox.Text, out defence);
            bool carryweight_result = int.TryParse(WeightBox.Text, out carryweight);

            if (!might_result || !defence_result || !carryweight_result)
            {
                MessageBox.Show("Błąd w polach określających bonusy!");
                return;
            }
            else
            {
                Tuple <string, int> MightTuple       = new Tuple <string, int>("Might", might);
                Tuple <string, int> DefenceTuple     = new Tuple <string, int>("Defence", defence);
                Tuple <string, int> CarryWeightTuple = new Tuple <string, int>("CarryWeight", carryweight);
                bonus.Add(MightTuple);
                bonus.Add(DefenceTuple);
                bonus.Add(CarryWeightTuple);
            }

            if (RequirementsCheckedListBox.CheckedItems.Count == 0)
            {
                requirements.Add("Any");
            }
            else
            {
                foreach (object item in RequirementsCheckedListBox.CheckedItems)
                {
                    requirements.Add(item.ToString());
                }
            }

            properties = new List <string>(PropertiesBox.Lines);

            Item New_Item = new Item(name, type, description, requirements, bonus, properties, weight);

            ItemsList.Add(New_Item);
            ListBind.DataSource = null;
            ListBind.DataSource = ItemsList;

            NameBox.Clear();
            TypeBox.Clear();
            DescriptionBox.Clear();
            MightBox.Clear();
            DefenceBox.Clear();
            WeightBox.Clear();
            ItemWeightBox.Clear();
            PropertiesBox.Clear();

            foreach (int i in RequirementsCheckedListBox.CheckedIndices)
            {
                RequirementsCheckedListBox.SetItemChecked(i, false);
            }
        }
    }   // RoundToInt() => Convierte a entero

    void SetMap(Vector3 position, TypeBox value)
    {
        map[Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y)] = value;
    }
 public ProductBoxViewModel(Variante item)
 {
     _TypeBox      = TypeBox.VARIANTE;
     this.variante = item;
 }
 public ProductBoxViewModel(Article product)
 {
     _TypeBox     = TypeBox.ARTICLE;
     this.product = product;
 }
Exemple #28
0
        private void Update(object sender, RoutedEventArgs e)
        {
            SetBooleans(true);

            TypeBox.Focus();
        }