Exemplo n.º 1
0
 private void Move2(Control.ControlCollection source, Control.ControlCollection target, bool enabled)
 {
     while (source.Count != 0)
     {
         Control ctr = source[0];
         if (ctr is Panel)
         {
             if (!ctr.Enabled)
             {
                 source.RemoveAt(0);
                 continue;
             }
         }
         target.Add(ctr);
         ctr.Visible = true;
         ctr.Enabled = enabled;
     }
 }
Exemplo n.º 2
0
        private TabControl MainTabControlDrawing(Control.ControlCollection Controls)
        {
            TabControl MainTabControl = new TabControl();

            // 配置位置を設定
            MainTabControl.Location = new System.Drawing.Point(10, 10);
            // Nameプロパティを設定
            MainTabControl.Name = "tabControl";
            // 選択されているタブページのインデックス取得
            MainTabControl.SelectedIndex = 0;
            // サイズを設定
            MainTabControl.Size = new System.Drawing.Size(340, 585);
            // TabIndexを設定
            MainTabControl.TabIndex = 0;
            //MainTab表示
            Controls.Add(MainTabControl);

            return(MainTabControl);
        }
Exemplo n.º 3
0
        private void GeneratePlatform(PlatformType platformType, int platformCount, Color color)
        {
            List <Platform> platform = new List <Platform>(platformCount);

            Logging.Log(LogType.LOG, "Initialsing " + platformCount + " platforms");
            for (int i = 0; i < platformCount; ++i)
            {
                Platform platformObject = null;

                // Instantiate specific platform object based on what platform type will be generated
                switch (platformType)
                {
                case PlatformType.STATIC_PLATFORM:
                    platformObject = new StaticPlatform();
                    break;

                case PlatformType.MOVING_PLATFORM:
                    platformObject = new MovingPlatform();
                    break;
                }

                // Initialise platform settings
                platformObject.platformSize     = new PlatformSize(50, 20);
                platformObject.platformColor    = new PlatformColor(color.R, color.G, color.B);
                platformObject.platformPosition = new PlatformPosition(m_Random.Next(0, width - 50),
                                                                       m_Random.Next(height, m_LevelDistance));

                // Push all initialised values to picturebox control
                platformObject.Set();


                // Add to moving platform list
                platform.Add(platformObject);

                // Add this picturebox control to the from control list
                // for it to be rendered
                m_Controls.Add(platformObject.Get());
            }

            // Add platform type list to the platforms dictionary
            m_Platforms.Add(platformType, platform);
        }
Exemplo n.º 4
0
        public void Draw(int[,] matrix)
        {
            Clear();

            matrix = (matrix == null)
                ? DEFAULT_MATRIX
                : matrix;

            var dx = holder.X + 80;
            var dy = holder.Y;

            for (int i = 0; i < matrix.GetLength(0); i++)
            {
                dx = holder.X + 10;

                for (int j = 0; j < matrix.GetLength(1); j++)
                {
                    var textBox = new MatrixInputElement();
                    dx             = dx + 25 + 5;
                    textBox.Width  = 25;
                    textBox.Height = 25;

                    textBox.Text         = matrix[i, j].ToString();
                    textBox.Location     = new Point(dx, dy + 30);
                    textBox.i            = i;
                    textBox.j            = j;
                    textBox.TextChanged += (object sender, EventArgs e) =>
                    {
                        var el    = (sender as MatrixInputElement);
                        var value = 0;
                        if (Int32.TryParse(el.Text, out value))
                        {
                            this.submit(el.i, el.j, value);
                        }
                    };

                    controls.Add(textBox);
                }

                dy = dy + 30;
            }
        }
Exemplo n.º 5
0
        private void DoShowProgress()
        {
            ProgressFrame ef = FindFrame();

            foreach (Control ctrl in Collection)
            {
                if (ctrl is ToolStrip)
                {
                    continue;
                }
                bool?vis = null;
                if (m_forceVisibility != null)
                {
                    vis = m_forceVisibility(ctrl);
                }
                ctrl.Visible = vis ?? false;
            }

            if (ef == null)
            {
                ProgressFrame frm = new ProgressFrame();
                Collection.Add(frm);
                try
                {
                    frm.BringToFront();
                }
                catch (Exception err)
                {
                    Logging.Warning("DAE-00076 " + err.Message);
                    //throw new InternalError("[E :00076] " + err.Message, err);
                }
                frm.Dock = DockStyle.Fill;
                //frm.labErrorDetail.Text = Texts.Get(message ?? "");
            }
            else
            {
                ef.Visible = true;
                //ef.labErrorDetail.Text = Texts.Get(message ?? "");
            }

            ProgressVisible = true;
        }
Exemplo n.º 6
0
            public OutputButton(Control.ControlCollection Con, Point p, Image[] img, int bcount, int bx, int by)
            {
                int x, y;
                int count = 0;
                int len   = (bcount < (bx * by) ? bcount : bx * by);

                Count = len;
                blist = new Button[Count];
                if (img != null)
                {
                    Imgs[0] = new Bitmap(img[0]);
                    Imgs[1] = new Bitmap(img[1]);
                }
                for (y = 0; y < bx; y++)
                {
                    for (x = 0; x < by; x++)
                    {
                        Button b = new Button();
                        b.FlatAppearance.BorderSize = 0;
                        b.Image    = Imgs[0];
                        b.Location = new System.Drawing.Point(p.X + 46 * x, p.Y + 46 * y);
                        b.Name     = "O" + (count + 1);
                        b.Size     = new System.Drawing.Size(40, 32);
                        b.TabIndex = 1;
                        b.Text     = "O" + (count + 1) + "\r\nOFF";
                        b.UseVisualStyleBackColor = true;
                        b.Click       += B_Click;
                        blist[count++] = b;
                        Con.Add(b);
                        if (count >= Count)
                        {
                            y = bx;
                            x = by;
                        }
                    }
                }
                for (int i = count; i < Count; i++)
                {
                    blist[i].Visible = false;
                }
            }
Exemplo n.º 7
0
        public static void NewMapDoc(Control.ControlCollection controls, ESRI.ArcGIS.Controls.AxMapControl mainMapControl)
        {
            try
            {
                //实例化AxMapControl控件,并加入Form的Controls
                ESRI.ArcGIS.Controls.AxMapControl axMapControl = new ESRI.ArcGIS.Controls.AxMapControl();
                ((System.ComponentModel.ISupportInitialize)(axMapControl)).BeginInit();
                controls.Add(axMapControl);
                ((System.ComponentModel.ISupportInitialize)(axMapControl)).EndInit();

                //实例化SaveFileDialog控件
                SaveFileDialog pSaveFileDialog = new SaveFileDialog();
                pSaveFileDialog.Title            = "输入需要新建地图文档的名称";
                pSaveFileDialog.Filter           = "地图文件(*.mxd)|*.mxd";
                pSaveFileDialog.OverwritePrompt  = true;
                pSaveFileDialog.RestoreDirectory = true;

                if (pSaveFileDialog.ShowDialog() == DialogResult.OK)
                {//保存地图文档
                    string       filename     = pSaveFileDialog.FileName;
                    IMapDocument pMapDocument = new MapDocumentClass();
                    pMapDocument.New(filename);
                    axMapControl.Map = pMapDocument.get_Map(0);
                    axMapControl.DocumentFilename = pMapDocument.DocumentFilename;
                    pMapDocument.Close();
                    mainMapControl.LoadMxFile(filename);
                    mainMapControl.Refresh();
                    MessageBox.Show("新建地图文档成功!", "信息提示", MessageBoxButtons.OK);
                    return;
                }
                else
                {
                    return;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("新建地图文档失败!" + exc.Message, "信息提示", MessageBoxButtons.OK);
                return;
            }
        }
Exemplo n.º 8
0
        public override void RenderShape(Control.ControlCollection controls)
        {
            int renderCount = 0;

            for (int i = 0; i < Shape.Length; i++)
            {
                Shape[i]     = new Block(BackgroundColor);
                Shape[i].Top = -2 * TetrisConfig.BlockSize;
                if (i >= 2)
                {
                    Shape[i].Top = -TetrisConfig.BlockSize;
                }
                renderCount++;
                if (i == 2)
                {
                    renderCount -= 3;
                }
                Shape[i].Left = TetrisConfig.BlockSize * TetrisConfig.BlockCountWidth / 2 + renderCount * TetrisConfig.BlockSize - TetrisConfig.BlockSize;
                controls.Add(Shape[i]);
            }
        }
Exemplo n.º 9
0
        public ChangeListItemBhikkuPlanel(string text, Control.ControlCollection contralls, BikkuInfo bInfo, int width)
        {
            this.bInfo = bInfo;


            this.Text     = "       " + text;
            this.Size     = new System.Drawing.Size(width, 25);
            this.Location = new System.Drawing.Point(5, (contralls.Count * this.Height) + (contralls.Count * 2) + 8);
            this.Font     = new System.Drawing.Font(this.Font.FontFamily, 11);
            //this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            contralls.Add(this);

            this.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter);
            this.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave);
            this.MouseDown  += new MouseEventHandler(label_MouseDown);

            this.ContextMenu = CreateContextMenuItems();

            SetOriginalColor();
            InitializeComponent();
        }
Exemplo n.º 10
0
        private ListBox AddInfoTracks(ref int inc, Track items, TextBox picture, Control.ControlCollection Controls)
        {
            inc += 100;
            ListBox Info = new ListBox();

            Info.Visible  = true;
            Info.Location = new Point(picture.Location.X + 100, picture.Location.Y + inc);
            Info.Size     = new Size(200, 60);
            Controls.Add(Info);
            Info.Items.Add("Artist: " + items.artist);
            Info.Items.Add("Local: " + items.is_local);
            Info.Items.Add("Disc Number: " + items.disc_number);
            Info.Items.Add("ID: " + items.id);
            Info.Items.Add("Type:" + items.type);
            Info.Items.Add("Track Number:" + items.track_number);
            Info.Items.Add("Name:" + items.name);
            Info.Items.Add("Explicit:" + items.@explicit);
            Info.Items.Add("Duration:" + items.duration_ms);
            Info.Items.Add("Available Markets:" + items.available_markets);
            return(Info);
        }
Exemplo n.º 11
0
        public void MakeEnemies(int count, Control.ControlCollection Controls)
        {
            Enemies = new PictureBox[count];
            var left = 0;

            for (var i = 0; i < Enemies.Length; i++)
            {
                Enemies[i] = new PictureBox
                {
                    Size      = new Size(60, 50),
                    Image     = Properties.Resources.invader,
                    BackColor = Color.Transparent,
                    Top       = 5,
                    Tag       = "enemies",
                    Left      = left,
                    SizeMode  = PictureBoxSizeMode.StretchImage
                };
                Controls.Add(Enemies[i]);
                left -= 80;
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Replaces the controls in the form that was generated by the gui designer
        /// </summary>
        /// <param name="controls">The controls container which contains the controls that are to be replaced</param>
        /// <param name="originalControl">The control to replace</param>
        /// <param name="replacement">The replacement</param>
        protected static void ReplaceControl(Control.ControlCollection controls, Control originalControl, Control replacement)
        {
            if (originalControl == null)
            {
                return;
            }

            var location     = originalControl.Location;
            var originalSize = originalControl.Size;
            var tabIndex     = originalControl.TabIndex;

            controls.Remove(originalControl);

            if (replacement != null)
            {
                controls.Add(replacement);
                replacement.Location = location;
                replacement.Size     = originalSize;
                replacement.TabIndex = tabIndex;
            }
        }
Exemplo n.º 13
0
        public static void Insert(this Control.ControlCollection controlCollection, int index, Control item)
        {
            bool isCListBox = _controlsListBoxType.IsAssignableFrom(controlCollection.Owner.GetType());

            if (isCListBox)
            {
                ((ControlsListBox)controlCollection.Owner).LockUpdateFor(item);
            }

            if (controlCollection.Count < index)
            {
                throw new IndexOutOfRangeException();
            }
            controlCollection.Add(item);
            controlCollection.SetChildIndex(item, index);

            if (isCListBox)
            {
                ((ControlsListBox)controlCollection.Owner).UnlockUpdateFor(item);
            }
        }
Exemplo n.º 14
0
        public override void CreateControls(Control.ControlCollection collection)
        {
            Panel p = new Panel();

            p.Width  = 240;
            p.Height = 110;

            saveButton         = new Button();
            saveButton.Width   = 190;
            saveButton.Text    = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVE);
            saveButton.Enabled = false;
            saveButton.Click  += new EventHandler(saveButton_Click);
            p.Controls.Add(saveButton);

            resoreButton          = new Button();
            resoreButton.Location = new System.Drawing.Point(saveButton.Left, saveButton.Bottom + 5);
            resoreButton.Width    = saveButton.Width;
            resoreButton.Text     = Utils.LanguageSupport.Instance.GetTranslation(STR_RESTORE);
            resoreButton.Enabled  = false;
            resoreButton.Click   += new EventHandler(resoreButton_Click);
            p.Controls.Add(resoreButton);

            createButton          = new Button();
            createButton.Location = new System.Drawing.Point(resoreButton.Left, resoreButton.Bottom + 5);
            createButton.Width    = saveButton.Width;
            createButton.Text     = Utils.LanguageSupport.Instance.GetTranslation(STR_CREATE);
            createButton.Enabled  = false;
            createButton.Click   += new EventHandler(createButton_Click);
            p.Controls.Add(createButton);

            deleteButton          = new Button();
            deleteButton.Location = new System.Drawing.Point(createButton.Left, createButton.Bottom + 5);
            deleteButton.Width    = saveButton.Width;
            deleteButton.Text     = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE);
            deleteButton.Enabled  = false;
            deleteButton.Click   += new EventHandler(deleteButton_Click);
            p.Controls.Add(deleteButton);

            collection.Add(p);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Check if the encrypted mail password is already in windows registry
        /// </summary>
        /// <param name="credentials"></param>
        /// <returns></returns>
        public async Task PasswordInRegistry(Credentials credentials)
        {
            Configuration k = new Configuration();

            if (k.CheckPasswordExists())                                                //Prüfen ob verschlüsseltes Passwort in der Registry steht
            {
                return;
            }
            MessageBox.Show(Lang.GetText("message_authentification_nomailpassword"));
            InsertMailPassword m = new InsertMailPassword(credentials)
            {
                Visible = true,
                Enabled = true,
                Dock    = DockStyle.Bottom
            };                                                                          //Form zur Eingabe des Passworts laden

            _e.Add(m);
            m.BringToFront();
            await Signal.WaitAsync();                                                   //Auf abschluss der Eingabe warten

            m.Dispose();
        }
        private PictureBox DrawNewCharacterToGame(Control.ControlCollection Controls, Bitmap picture, int size)
        {
            PictureBox ghost = new PictureBox();

            ((ISupportInitialize)(ghost)).BeginInit();
            ghost.BackColor = Color.Transparent;
            ghost.Image     = picture;
            ghost.Size      = new Size(size, size);
            ghost.SizeMode  = PictureBoxSizeMode.Zoom;

            /*
             * ghost.Location = new Point(180, 73);
             * ghost.Name = "redGhost";
             * ghost.TabIndex = 1;
             * ghost.TabStop = false;
             * ghost.Tag = "ghost";
             */

            Controls.Add(ghost);
            ((ISupportInitialize)(ghost)).EndInit();
            return(ghost);
        }
Exemplo n.º 17
0
        public virtual void DisplayIn(Control.ControlCollection controls)
        {
            ClearContainer(controls);
            controls.Add(this);
            Explorer.ApplyTheme(this);
            bool prev = inSetVisible;

            inSetVisible = true;
            try
            {
                Visible = true;
            }
            catch (Exception x)
            {
                Visible = false;
                throw new Exception(x.Message, x.GetBaseException());
            }
            finally
            {
                inSetVisible = prev;
            }
        }
Exemplo n.º 18
0
        public void MakePeas(string peasTag, PictureBox plant, Control.ControlCollection Controls)
        {
            var peas = new PictureBox
            {
                Image     = Properties.Resources.bullet3,
                Size      = new Size(50, 50),
                Tag       = peasTag,
                Left      = plant.Left + plant.Width / 2,
                BackColor = Color.Transparent
            };

            if ((string)peas.Tag == "peas")
            {
                peas.Top = plant.Top - 20;
            }
            else if ((string)peas.Tag == "enemyPeas")
            {
                peas.Top = -100;
            }
            Controls.Add(peas);
            peas.BringToFront();
        }
Exemplo n.º 19
0
 public void FillPanelControls(Control.ControlCollection panelControls, int barCount)
 {
     try
     {
         int controlsCount = panelControls.Count;
         if (barCount > controlsCount)
         {
             for (int i = controlsCount; i < barCount; i++)
             {
                 var displayBar = new QueueInfoDisplayBarV1d0();
                 displayBar.Location = new Point(5, 5 + 102 * i);
                 displayBar.tableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
                 displayBar.tableLayoutPanel2.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
                 displayBar.DisplayIndex = i;
                 panelControls.Add(displayBar);
             }
         }
         else if (barCount < controlsCount)
         {
             List <Control> deleteList = new List <Control>();
             foreach (Control item in panelControls)
             {
                 if ((item is QueueInfoDisplayBarV1d0) && ((item as QueueInfoDisplayBarV1d0).DisplayIndex >= barCount))
                 {
                     deleteList.Add(item);
                 }
             }
             foreach (var item in deleteList)
             {
                 panelControls.Remove(item);
             }
         }
     }
     catch (Exception ex)
     {
         SimpleLoger.Instance.Error(ex);
     }
 }
Exemplo n.º 20
0
        public static void InsertAfter(this Control.ControlCollection controls, Control after, Control newCtrl)
        {
            var newIndex = controls.Count;

            controls.Add(newCtrl);

            if (after != null)
            {
                var index = 0;
                foreach (var ctrl in controls)
                {
                    if (ctrl == after)
                    {
                        break;
                    }
                    index++;
                }
                if (index < newIndex)
                {
                    controls.SetChildIndex(newCtrl, index + 1);
                }
            }
        }
Exemplo n.º 21
0
        public static void prepare(Control.ControlCollection control, Action <object, MouseEventArgs> callback)
        {
            Point loc = new Point(0, -40);

            for (int columb = 0; columb < 20; columb++)
            {
                loc.X  = -40;
                loc.Y += 40;
                for (int row = 0; row < 20; row++)
                {
                    Label label = new Label();
                    label.AutoSize      = false;
                    label.MouseDown    += new MouseEventHandler(callback);
                    label.Size          = new Size(40, 40);
                    label.BackColor     = Color.LightGray;
                    loc.X              += 40;
                    label.Location      = loc;
                    labels[columb, row] = label;
                    //MessageBox.Show($"columb: {columb}\nrow: {row}");
                    control.Add(label);
                }
            }
        }
Exemplo n.º 22
0
 public virtual void DisplayIn(Control.ControlCollection controls)
 {
     try
     {
         ClearContainer(controls);
         TopLevel        = false;
         FormBorderStyle = FormBorderStyle.None;
         Size            = new Size(1, 1);
         controls.Add(this);
         //MainForm.Form.UpdateVisualStyle(); // propagate visual style from the main ribbon form to all child controls
         Dock    = DockStyle.Fill;
         Visible = true;
         if (!isShow)
         {
             Visible = false;
         }
     }
     catch (Exception x)
     {
         Visible = false;
         throw new Exception(x.Message, x.GetBaseException());
     }
 }
Exemplo n.º 23
0
        public static void smethod_0(this Control control_0, bool bool_0, Image image_0)
        {
            if (control_0.Parent == null && !(control_0 is RadForm))
            {
                return;
            }
            if (!GClass123.dictionary_0.ContainsKey(control_0))
            {
                GClass123.dictionary_0.Add(control_0, (Control)null);
            }
            Control control = GClass123.dictionary_0[control_0];

            Control.ControlCollection controlCollection = control_0 is RadForm ? control_0.Controls : control_0.Parent.Controls;
            controlCollection.IndexOf(control_0);
            if (bool_0 && control == null)
            {
                PictureBox pictureBox1 = new PictureBox();
                pictureBox1.Image    = image_0;
                pictureBox1.Size     = control_0.Size;
                pictureBox1.Location = control_0.Location;
                pictureBox1.Anchor   = control_0.Anchor;
                pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
                PictureBox pictureBox2 = pictureBox1;
                controlCollection.Add((Control)pictureBox2);
                GClass123.dictionary_0[control_0] = (Control)pictureBox2;
                pictureBox2.BringToFront();
            }
            else
            {
                if (control == null)
                {
                    return;
                }
                controlCollection.Remove(control);
                GClass123.dictionary_0[control_0] = (Control)null;
            }
        }
Exemplo n.º 24
0
        }//end of assigning space property

        public void Create_Process(Control.ControlCollection c)
        {
            process_Image = new PictureBox();
            process_Image.Load("book.png");
            process_Image.SizeMode = PictureBoxSizeMode.StretchImage;
            if (size <= 5)
            {
                block_Per           = (size / memory.bestfit_block[8, 0]) * 100;
                orig_Process_Height = (memory.bestfit_block[8, 2] / 100) * block_Per;
            }
            else if (size > 500)
            {
                orig_Process_Height = 100;
            }
            else
            {
                for (int i = 0; i < 9; i++)
                {
                    if (size >= memory.bestfit_block[i + 1, 0] && size <= memory.bestfit_block[i, 0])
                    {
                        block_Per           = (size / memory.bestfit_block[i, 0]) * 100;
                        orig_Process_Height = (memory.bestfit_block[i, 2] / 100) * block_Per;
                        break;
                    }
                }
            }
            Image img = process_Image.Image;

            img.RotateFlip(RotateFlipType.Rotate90FlipNone);
            process_Image.Image     = img;
            process_Image.Size      = new Size(Convert.ToInt16(orig_Process_Height), 100);
            process_Image.BackColor = Color.Transparent;
            process_Image.Location  = new Point(12, 350);
            c.Add(process_Image);
            process_Image.BringToFront();
        }//end of creating process Image method
Exemplo n.º 25
0
        public void Vykresli(Control.ControlCollection Controls, int lvl)
        {
            var path = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Mapa.txt");

            switch (lvl)
            {
            case 0:
                lines = File.ReadAllLines(Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Mapa.txt")).ToList();
                break;

            case 1:
                lines = File.ReadAllLines(Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Mapa2.txt")).ToList();
                break;

            case 2:
                lines = File.ReadAllLines(Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Mapa3.txt")).ToList();
                break;
            }

            int j      = -1;
            int poradi = 0;

            foreach (string line in lines)
            {
                j++;
                for (int i = 0; i < line.Length; i++)
                {
                    switch (line[i])
                    {
                    case '#':
                        Point      LokaceObj  = new Point(i * 50, j * 50);
                        Point      SizeObj    = new Point(49, 49);
                        PictureBox PictureObj = new PictureBox();
                        PictureObj.Location      = LokaceObj;
                        PictureObj.Size          = (Size)SizeObj;
                        PictureObj.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\GroundTexture.jpg");
                        PictureObj.Tag           = "obj";
                        Controls.Add(PictureObj);
                        break;

                    case 'x':
                        if (poradi < 10)
                        {
                            poradi++;
                            Point      LokaceNpc  = new Point(i * 50, j * 50);
                            Point      SizeNpc    = new Point(49, 49);
                            PictureBox PictureNpc = new PictureBox();
                            PictureNpc.Location      = LokaceNpc;
                            PictureNpc.Size          = (Size)SizeNpc;
                            PictureNpc.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Enemy2.png");
                            PictureNpc.Tag           = "npc";
                            PictureNpc.Name          = $"npc{poradi}";
                            Controls.Add(PictureNpc);
                            break;
                        }
                        else
                        {
                            break;
                        }

                    case '/':
                        Point      LokaceLock  = new Point((i - 1) * 50, j * 50);
                        Point      SizeLock    = new Point(99, 49);
                        PictureBox PictureLock = new PictureBox();
                        PictureLock.Location      = LokaceLock;
                        PictureLock.Size          = (Size)SizeLock;
                        PictureLock.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Door2.png");
                        PictureLock.Tag           = "obj";
                        PictureLock.Name          = "lock";
                        Controls.Add(PictureLock);
                        break;

                    case '+':
                        Point      LokaceKey  = new Point(i * 50 + 10, j * 50 + 10);
                        Point      SizeKey    = new Point(30, 30);
                        PictureBox PictureKey = new PictureBox();
                        PictureKey.Location      = LokaceKey;
                        PictureKey.Size          = (Size)SizeKey;
                        PictureKey.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Key2.png");
                        PictureKey.Tag           = "key";
                        PictureKey.Name          = "key";
                        Controls.Add(PictureKey);
                        break;

                    case 'M':
                        Point      LokaceMana  = new Point(i * 50 + 10, j * 50 + 10);
                        Point      SizeMana    = new Point(30, 30);
                        PictureBox PictureMana = new PictureBox();
                        PictureMana.Location      = LokaceMana;
                        PictureMana.Size          = (Size)SizeMana;
                        PictureMana.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\ManaPotion2.png");
                        PictureMana.Tag           = "mana";
                        PictureMana.Name          = "mana";
                        Controls.Add(PictureMana);
                        break;

                    case 'H':
                        Point      LokaceHealth  = new Point(i * 50 + 10, j * 50 + 10);
                        Point      SizeHealth    = new Point(30, 30);
                        PictureBox PictureHealth = new PictureBox();
                        PictureHealth.Location      = LokaceHealth;
                        PictureHealth.Size          = (Size)SizeHealth;
                        PictureHealth.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\HealthPotion2.png");
                        PictureHealth.Tag           = "health";
                        PictureHealth.Name          = "health";
                        Controls.Add(PictureHealth);
                        break;

                    case '*':
                        Point      LokaceNew  = new Point(i * 50, j * 50);
                        Point      SizeNew    = new Point(49, 49);
                        PictureBox PictureNew = new PictureBox();
                        PictureNew.Location      = LokaceNew;
                        PictureNew.Size          = (Size)SizeNew;
                        PictureNew.ImageLocation = Path.GetFullPath(Directory.GetCurrentDirectory() + @"\Portal2.jpg");
                        PictureNew.Tag           = "new";
                        PictureNew.Name          = "new";
                        Controls.Add(PictureNew);
                        break;

                    case 'P':
                        foreach (PictureBox item in Controls)
                        {
                            if ((string)item.Name == "Player")
                            {
                                Point LokacePlayer = new Point(i * 50, j * 50);
                                item.Location = LokacePlayer;
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 26
0
            private void InitializeComponent()
            {
                _addRootButton  = new Button();
                _addChildButton = new Button();
                _deleteButton   = new Button();
                _dialogBlock    = new NuGenCollectionEditorDialogBlock();
                _mainBlock      = new NuGenCollectionEditorMainBlock();
                _moveDownButton = _mainBlock.GetMoveDownButton();
                _moveUpButton   = _mainBlock.GetMoveUpButton();
                _propertyBlock  = new NuGenCollectionEditorPropertyBlock();
                _splitContainer = new SplitContainer();
                _treeView       = new NodesEditorTreeView();

                this.SuspendLayout();

                /* DialogBlock */

                _dialogBlock.Dock     = DockStyle.Bottom;
                _dialogBlock.Parent   = this;
                _dialogBlock.TabIndex = 10;

                Button okButton     = _dialogBlock.GetOkButton();
                Button cancelButton = _dialogBlock.GetCancelButton();

                okButton.Click     += _okButton_Click;
                cancelButton.Click += _cancelButton_Click;

                /* SplitContainer */

                _splitContainer.Dock          = DockStyle.Fill;
                _splitContainer.Panel1MinSize = 250;
                _splitContainer.Panel2MinSize = 100;
                _splitContainer.Parent        = this;
                _splitContainer.BringToFront();

                /* MainBlock */

                _mainBlock.Dock     = DockStyle.Fill;
                _mainBlock.Parent   = _splitContainer.Panel1;
                _mainBlock.TabIndex = 20;
                _mainBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_mainTitle);

                /* Action buttons */

                _moveDownButton.Click += _moveDownButton_Click;
                _moveUpButton.Click   += _moveUpButton_Click;

                _deleteButton.Dock   = DockStyle.Top;
                _deleteButton.Image  = Resources.Delete;
                _deleteButton.Click += _deleteButton_Click;

                Control.ControlCollection actionControls = _mainBlock.GetActionControls();
                actionControls.Add(_deleteButton);
                _deleteButton.BringToFront();

                /* Populate buttons */

                _addRootButton.Dock     = DockStyle.Left;
                _addRootButton.TabIndex = 10;
                _addRootButton.Text     = Resources.Text_TreeNodeCollectionEditor_addRootButton;
                _addRootButton.Click   += _addRootButton_Click;

                _addChildButton.Dock     = DockStyle.Left;
                _addChildButton.TabIndex = 20;
                _addChildButton.Text     = Resources.Text_TreeNodeCollectionEditor_addChildButton;
                _addChildButton.Click   += _addChildButton_Click;

                Control.ControlCollection populateControls = _mainBlock.GetPopulateControls();
                populateControls.Add(_addChildButton);
                populateControls.Add(_addRootButton);

                /* PropertyBlock */

                _propertyBlock.Dock     = DockStyle.Fill;
                _propertyBlock.Parent   = _splitContainer.Panel2;
                _propertyBlock.TabIndex = 30;
                _propertyBlock.SetTitle(Resources.Text_TreeNodeCollectionEditor_propertyTitleNone);
                _propertyBlock.SelectedObjectsChanged += _propertyBlock_SelectedObjectsChanged;

                /* TreeView */

                _treeView.Dock   = DockStyle.Fill;
                _treeView.Parent = _mainBlock;
                _treeView.BringToFront();
                _treeView.AfterSelect += _treeView_AfterSelect;

                /* Form */

                NuGenCollectionEditorInitializer.InitializeEditorForm(this);
                this.AcceptButton = okButton;
                this.CancelButton = cancelButton;
                this.Size         = new Size(580, 480);
                this.MinimumSize  = this.Size;
                this.Text         = Resources.Text_TreeNodeCollectionEditor_EditorForm;
                base.ResumeLayout(false);
            }
Exemplo n.º 27
0
 public void Implement(Control.ControlCollection motherControlCollection)
 {
     motherControlCollection.Add(_errorHeader);
     motherControlCollection.Add(_errorList);
     motherControlCollection.Add(_fixButton);
 }
Exemplo n.º 28
0
        public bool OnLoad(LogFile logfile, Control chartSpectrum, Label labelWaterfall, Control.ControlCollection collection, MainForm mainForm)
        {
            Control waterfall     = null;
            bool    foundWriteLog = false;

            // registry goop to look unconditionally in 32bit registry for WriteLog, whether we are x86 or x64
            Microsoft.Win32.RegistryKey rk32 = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32);
            {
                if (null != rk32)
                {
                    Microsoft.Win32.RegistryKey wlrk32 = rk32.OpenSubKey(@"Software\\W5XD\\WriteLog\\Install");
                    if (null != wlrk32)
                    {
                        object wlDir = wlrk32.GetValue("Directory");

                        /* SetCurrentDirectory
                         * Why?
                         * The WriteLog waterfall depends on the d3dcsx.dll (Microsoft's DirectX2D). That dll must be installed
                         * on a per-application basis. Win32's dll lookup for the case of loading for a .net assembly in the GAC
                         * needs to find d3dcxs. WL installs a copy, so we "cd" this exe there so it will be found.
                         */
                        if (null != wlDir)
                        {
                            try
                            {
                                System.IO.Directory.SetCurrentDirectory(wlDir.ToString() +
#if BUILD_X86
                                                                        "Programs"
#elif BUILD_X64
                                                                        "DigiRite X64 Waterfall"
#endif
                                                                        );
                                foundWriteLog = true;
                            }
                            catch (System.Exception) { } // ignore failure
                        }
                        wlrk32.Close();
                    }
                    rk32.Close();
                }
            }

            if (!foundWriteLog)
            {   // second chance look for waterfall install
                Microsoft.Win32.RegistryKey rkMachineDefault = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Default);
                if (null != rkMachineDefault)
                {
                    Microsoft.Win32.RegistryKey wf = rkMachineDefault.OpenSubKey(@"Software\\DigiRite\\Waterfall");
                    if (null != wf)
                    {
                        object wfDir = wf.GetValue("Directory");
                        if (null != wfDir)
                        {
                            try {
                                System.IO.Directory.SetCurrentDirectory(wfDir.ToString());
                            }  catch (System.Exception) { } // ignore failure
                        }
                        wf.Close();
                    }
                    rkMachineDefault.Close();
                }
            }

            try
            {
                // if WriteLog's DigiRiteWaterfall assembly loads, use it.
                System.Reflection.Assembly waterfallAssembly = System.Reflection.Assembly.Load(
                    "WriteLogWaterfallDigiRite, Version=12.0.52.5, Culture=neutral, PublicKeyToken=e34bde9f0678e8b6");
                System.Type t = waterfallAssembly.GetType("WriteLog.WaterfallFactory");
                if (t == null)
                {
                    throw new System.Exception("WaterfallFactory type not found");
                }

                wfFactory       = (WriteLog.IWaterfallFactory)System.Activator.CreateInstance(t);
                waterfall       = (Control)wfFactory.GetWaterfall();
                waterfallEditor = wfFactory.GetEditor() as Form;
                iwaterfall      = (WriteLog.IWaterfallV3)waterfall;
            }
            catch (System.Exception ex)
            {                                                                   // if WriteLog is not installed, this is "normal successful completion"
                logfile.SendToLog("Load waterfall exception " + ex.ToString()); // not normal
            }

            if (null != waterfall)
            {   // waterfall loaded. it goes where chartSpectrum was.
                ((System.ComponentModel.ISupportInitialize)waterfall).BeginInit();
                waterfall.Location      = chartSpectrum.Location;
                waterfall.Dock          = chartSpectrum.Dock;
                waterfall.Size          = chartSpectrum.Size;
                waterfall.TabIndex      = chartSpectrum.TabIndex;
                waterfall.Name          = "waterfall";
                waterfall.Font          = labelWaterfall.Font; // labelWaterfall is placeholder for properties
                waterfall.BackColor     = labelWaterfall.BackColor;
                waterfall.ForeColor     = labelWaterfall.ForeColor;
                waterfall.Visible       = true;
                iwaterfall.TxFreqHz     = mainForm.TxFrequency;
                iwaterfall.RxFreqHz     = mainForm.RxFrequency;
                iwaterfall.onTxFreqMove = new WriteLog.OnFreqMove((int hz) => { mainForm.TxFrequency = hz; });
                iwaterfall.onRxFreqMove = new WriteLog.OnFreqMove((int hz) => { mainForm.RxFrequency = hz; });
                ((System.ComponentModel.ISupportInitialize)waterfall).EndInit();

                collection.Remove(chartSpectrum);
                collection.Add(waterfall);
                collection.SetChildIndex(waterfall, 0);

                peak        = iwaterfall as WriteLog.IPeakRx;
                annotations = iwaterfall as WriteLog.IAnnotations;
            }

            return(iwaterfall != null);
        }
 public static void Insert(this Control.ControlCollection collection, Control control, int pos)
 {
     collection.Add(control);
     collection.SetChildIndex(control, pos);
 }
Exemplo n.º 30
0
        public void Import(ref int gooseItems, Control.ControlCollection cc, PacketDevice netDev)
        {
            using (OpenFileDialog importOpenFileDialog = new OpenFileDialog())
            {
                importOpenFileDialog.Title  = "Select XML File";
                importOpenFileDialog.Filter = "Xml File(*.xml)|*.xml";

                if (DialogResult.OK == importOpenFileDialog.ShowDialog())
                {
                    XDocument xmlDoc = XDocument.Load(importOpenFileDialog.FileName);
                    XElement  gooses = xmlDoc.Element("Gooses");

                    if (gooses != null && xmlDoc.Elements("Gooses").Count() == 1)
                    {
                        if (gooses.Elements().Count() > 0)
                        {
                            foreach (XElement goose in gooses.Elements())
                            {
                                GooseControl gc = new GooseControl("Goose " + gooseItems++.ToString() + ":", "00:00:00:00:00:00", netDev);

                                XElement parameters = goose.Element("Parameters");
                                if (parameters != null && goose.Elements("Parameters").Count() == 1)
                                {
                                    if (parameters.Elements().Count() == 17)
                                    {
                                        foreach (XElement parameter in parameters.Elements())
                                        {
                                            if (parameter.Attribute("Value") != null)
                                            {
                                                gc.gooseParameters[parameter.Name.ToString()] = parameter.Attribute("Value").Value.ToString();
                                            }
                                            else
                                            {
                                                MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                                return;
                                            }
                                        }

                                        gc.updateComponents();
                                    }
                                    else
                                    {
                                        MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        return;
                                    }

                                    XElement dataset = goose.Element("DataSet");

                                    if (dataset != null && goose.Elements("DataSet").Count() == 1)
                                    {
                                        if (dataset.Elements("Data").Count() > 0)
                                        {
                                            foreach (XElement data in dataset.Elements("Data"))
                                            {
                                                recursiveCreateDataList(gc.dataList, data);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        return;
                                    }

                                    XElement seqdata = goose.Element("SeqData");

                                    if (seqdata != null && goose.Elements("SeqData").Count() == 1)
                                    {
                                        if (seqdata.Elements("Data").Count() > 0)
                                        {
                                            NodeGVL gvl = new NodeGVL("Data");

                                            GooseDataEdit gde = new GooseDataEdit();

                                            int i = 0;

                                            foreach (GOOSE_ASN1_Model.Data dataListCn in gc.dataList)
                                            {
                                                i = gde.recursiveReadData(null, dataListCn, gvl, i, DateTime.Now);
                                            }

                                            gc.seqData.Clear();

                                            foreach (XElement seqd in seqdata.Elements("Data"))
                                            {
                                                if (seqd.Attribute("Name") != null)
                                                {
                                                    if (gvl.GetChildNodes().Length > 0)
                                                    {
                                                        foreach (NodeGData ngdcn in gvl.GetChildNodes())
                                                        {
                                                            NodeGData fngd;
                                                            if ((fngd = recursiveFindNodeGData(ngdcn, seqd.Attribute("Name").Value)) != null)
                                                            {
                                                                if (seqd.Attribute("Duration") != null && seqd.Attribute("Value") != null)
                                                                {
                                                                    gc.seqData.Add(new SeqData(fngd, seqd.Attribute("Value").Value, Convert.ToInt32(seqd.Attribute("Duration").Value)));
                                                                }
                                                                else
                                                                {
                                                                    MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                                                    return;
                                                                }

                                                                break;
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                                    return;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }

                                gc.Dock = DockStyle.Top;
                                cc.Add(gc);
                                cc.SetChildIndex(gc, 0);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid XML file !", "Import from Xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }