示例#1
0
		public iAlarm()
		{
			InitializeComponent();
			
			if (!DesignMode)
			{
				_almList = AlarmManager.Instance.Alarms.FindAll(delegate(IAlarm alarm) { return alarm.TimeStampAck == null && Convert.ToDateTime(alarm.TimeStamp) >  DateTime.Now.Subtract(new TimeSpan(24, 0, 0));});

				_bs=new BindingSource();
				_bs.DataSource = _almList;
				
				dgvAlarms.DataSource = _bs;
				dgvAlarms.Columns["DataType"].Visible = false;
				
				_refreshTmr = new System.Windows.Forms.Timer();
				_refreshTmr.Interval = 1000;
				_refreshTmr.Tick += delegate
				{
					dataThread = new Thread(new ThreadStart(this.ThreadProcSafe));
					dataThread.Start();
					
					_bs.ResetBindings(false);
				};
				_refreshTmr.Start();
			}
		}
示例#2
0
        public Form1()
        {
            InitializeComponent();

            source = new BindingSource();

            using (var ctx = new Model1Container())
            {
                var ads = from carAds in ctx.BargainAdsSet
                          select new { carAds.Id, carAds.Brand, carAds.Model, carAds.Engine,
                                carAds.Year, carAds.Price, carAds.City, carAds.FromDate, carAds.ToDate };

                source.ResetBindings(true);
                source.DataSource = ads.ToList();

                try
                {
                    dataGridView1.DataSource = source;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.InnerException);
                }
            }
        }
示例#3
0
        public void   SetConfig(IDMEEditor pDMEEditor, IDMLogger plogger, IUtil putil, string[] args, PassedArgs obj, IErrorsInfo per)
        {
            Passedarg = obj;

            Logger           = plogger;
            this.Width       = 430;
            ErrorObject      = per;
            DMEEditor        = pDMEEditor;
            Visutil          = (IVisUtil)obj.Objects.Where(c => c.Name == "VISUTIL").FirstOrDefault().obj;
            SourceConnection = Passedarg.DataSource;
            if (SourceConnection.Category == DatasourceCategory.RDBMS)
            {
                rdb = (RDBSource)SourceConnection;
                string schemaname = rdb.GetSchemaName();
            }
            switch (obj.ObjectType)
            {
            case "RDBMSTABLE":
                EntityName = obj.CurrentEntity;


                t = (DataTable)rdb.GetEntity(EntityName, null);
                break;

            case "CRUDENTITY":
                EntityName = obj.CurrentEntity;


                t = (DataTable)rdb.GetEntity(EntityName, null);

                break;

            default:
                break;
            }



            bindingSource1.DataSource = t;
            bindingSource1.ResetBindings(true);
            Visutil.controlEditor.GenerateTableViewOnControl(EntityName, ref panel1, t, ref bindingSource1, 200, SourceConnection.DatasourceName);
            this.Controls.Add(panel1);
            panel1.Dock       = DockStyle.Fill;
            panel1.AutoScroll = true;
            //Form a = (Form)Parent;
            //a.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            EntityNameLabel.Text            = EntityName;
            bindingNavigator1.BindingSource = bindingSource1;
            bindingNavigator1.SendToBack();
            // Savebutton.SendToBack();



            this.SavetoolStripButton.Click += Savebutton_Click;
        }
示例#4
0
 private void reOrderAnnotations()
 {
     anns.Sort((x, y) => x.sortOrder().CompareTo(y.sortOrder()));
     // renumber the list...
     for (int idx = 0; idx < anns.Count; ++idx)
     {
         anns[idx].Number = (idx + 1);
     }
     bs.ResetBindings(false);
     ChartControl.ChartPanel.Invalidate(false);
 }
        /// <summary>
        /// Rebinds the binding source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="data">The data.</param>
        /// <param name="metadataChanged">if set to <c>true</c> then metadata (ovject/list type) was changed.</param>
        public static void RebindBindingSource(BindingSource source, object data, bool metadataChanged)
        {
            if (data != null)
            {
                source.DataSource = data;
            }

            // set Raise list changed to True
            source.RaiseListChangedEvents = true;
            // tell currency manager to resume binding 
            source.ResumeBinding();
            // Notify UI controls that the dataobject/list was reset - and if metadata was changed 
            source.ResetBindings(metadataChanged);
        }
示例#6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public DynamicTeComponentControl(DynamicTeComponent component)
            :base(component)
        {
            InitializeComponent();

            _component = component;

			_bindingSource = new BindingSource();
			_bindingSource.DataSource = _component;

			_probabilityMapVisible.DataBindings.Clear();
        	_probabilityMapVisible.DataBindings.Add("Enabled", _bindingSource, "ProbabilityMapEnabled", true,
        	                                        DataSourceUpdateMode.OnPropertyChanged);
			_probabilityMapVisible.DataBindings.Add("Checked", _bindingSource, "ProbabilityMapVisible", true,
													DataSourceUpdateMode.OnPropertyChanged);


			_opacityControl.TrackBarIncrements = 100;
			_thresholdControl.TrackBarIncrements = 500;

			_opacityControl.DataBindings.Clear();
			_opacityControl.DataBindings.Add("Enabled", _bindingSource, "OpacityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			_opacityControl.DataBindings.Add("Minimum", _bindingSource, "OpacityMinimum", true, DataSourceUpdateMode.OnPropertyChanged);
			_opacityControl.DataBindings.Add("Maximum", _bindingSource, "OpacityMaximum", true, DataSourceUpdateMode.OnPropertyChanged);
			_opacityControl.DataBindings.Add("Value", _bindingSource, "Opacity", true, DataSourceUpdateMode.OnPropertyChanged);

			_thresholdControl.DataBindings.Clear();
			_thresholdControl.DataBindings.Add("Enabled", _bindingSource, "ThresholdEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			_thresholdControl.DataBindings.Add("Minimum", _bindingSource, "ThresholdMinimum", true, DataSourceUpdateMode.OnPropertyChanged);
			_thresholdControl.DataBindings.Add("Maximum", _bindingSource, "ThresholdMaximum", true, DataSourceUpdateMode.OnPropertyChanged);
			_thresholdControl.DataBindings.Add("Value", _bindingSource, "Threshold", true, DataSourceUpdateMode.OnPropertyChanged);

			_createDynamicTeButton.DataBindings.Clear();
        	_createDynamicTeButton.DataBindings.Add("Enabled", _bindingSource, "CreateDynamicTeSeriesEnabled", true,
        	                                        DataSourceUpdateMode.OnPropertyChanged);
			_createDynamicTeButton.Click += delegate(object sender, EventArgs e)
										{
											_component.CreateDynamicTeSeries();
										};

			_component.AllPropertiesChanged += delegate(object sender, EventArgs e)
			                             	{
			                             		_bindingSource.ResetBindings(false);
			                             	};
		}
        private void AgregarProducto_Click(object sender, EventArgs e)
        {
            var idSeleccionado = productosGrid.SelectedRows[0].Cells["Id"].Value.ToString();
            bool existe = false;
            for (int i = 0; i < _lproductosPedido.Count && !existe; i++)
            {
                if (_lproductosPedido[i].Id.Equals(idSeleccionado))
                {
                    _lproductosPedido[i].Cantidad += 1;
                    existe = true;
                }
            }

            if (!existe)
            {
                var productoSeleccionado = _lproductos.First(p => p.Id == idSeleccionado);
                _lproductosPedido.Add(new PedidoGV()
                {
                    Id = productoSeleccionado.Id,
                    Nombre = productoSeleccionado.Nombre,
                    Cantidad = 1
                });
            }

            BindingSource source = new BindingSource();
            source.DataSource = _lproductosPedido;
            pedidoGrid.DataSource = source;

            source.ResetBindings(false);

            if (_lproductosPedido.Count > 0)
            {
                eliminarButton.Enabled = true;
                crearButton.Enabled = true;
            }
        }
        private void EliminarLinea_Click(object sender, EventArgs e)
        {
            var idSeleccionado = pedidoGrid.SelectedRows[0].Cells["Id"].Value.ToString();
            System.Diagnostics.Debug.WriteLine(idSeleccionado);
            for (int i = 0; i < _lproductosPedido.Count; i++)
            {
                if (_lproductosPedido[i].Id.Equals(idSeleccionado))
                {
                    _lproductosPedido.RemoveAt(i);
                    if (_lproductosPedido.Count == 0)
                    {
                        eliminarButton.Enabled = false;
                        crearButton.Enabled = false;
                    }
                }
            }

            BindingSource source = new BindingSource();
            source.DataSource = _lproductosPedido;
            pedidoGrid.DataSource = source;

            source.ResetBindings(false);
        }
示例#9
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (!ValidateInput()) return;

            btnSendTimeFinder.Enabled = false;

            uint VCountMin = uint.Parse(textBoxVCountMin.Text, NumberStyles.HexNumber);
            uint VCountMax = uint.Parse(textBoxVCountMax.Text, NumberStyles.HexNumber);
            uint Timer0Min = uint.Parse(textBoxTimer0Min.Text, NumberStyles.HexNumber);
            uint Timer0Max = uint.Parse(textBoxTimer0Max.Text, NumberStyles.HexNumber);
            uint GxStatMin = uint.Parse(textBoxGxStatMin.Text, NumberStyles.HexNumber);
            uint GxStatMax = uint.Parse(textBoxGxStatMax.Text, NumberStyles.HexNumber);
            uint VFrameMin = uint.Parse(textBoxVFrameMin.Text, NumberStyles.HexNumber);
            uint VFrameMax = uint.Parse(textBoxVFrameMax.Text, NumberStyles.HexNumber);
            int secondsMin = int.Parse(maskedTextBoxSecondsMin.Text);
            int secondsMax = int.Parse(maskedTextBoxSecondsMax.Text);
            if (secondsMax < secondsMin)
            {
                secondsMax = secondsMax + 60;
            }
            bool minMaxGxStat = cbGxStat.Checked;

            dsParameters = new List<DSParameterCapture>();
            var listBinding = new BindingSource {DataSource = dsParameters};
            dataGridView1.DataSource = listBinding;

            cpus = Settings.Default.CPUs;
            if (cpus < 1)
            {
                cpus = 1;
            }

            var jobs = new Thread[cpus];

            var progress = new Progress {Text = "DS Parameter Progress"};
            progressTotal = (ulong) ((VCountMax - VCountMin + 1)
                                     *(Timer0Max - Timer0Min + 1)
                                     // if only min max gx stat search is 2 (or 1 if they're the same) else it's max-min
                                     *(minMaxGxStat ? (GxStatMax > GxStatMin ? 2u : 1) : (GxStatMax - GxStatMin + 1))
                                     *(VFrameMax - VFrameMin + 1)
                                     *(secondsMax - secondsMin + 1));

            progressSearched = 0;
            progressFound = 0;
            var testTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                int.Parse(maskedTextBoxHour.Text),
                int.Parse(maskedTextBoxMinute.Text),
                secondsMin);

            var minIVs = new int[6];
            var maxIVs = new int[6];

            MAC_address = ulong.Parse(textBoxMACAddress.Text, NumberStyles.HexNumber);

            if (textBoxMACAddress.Text.Length < 12)
            {
                MessageBox.Show("Your MAC address is missing some digits.  Double-check your MAC address.");
            }

            if (textBoxDirectSeed.Text != "")
            {
                directSeed = ulong.Parse(textBoxDirectSeed.Text, NumberStyles.HexNumber);
                findDirectSeed = true;
            }
            else
            {
                findDirectSeed = false;

                minIVs[0] = int.Parse(maskedTextBoxHPMin.Text);
                minIVs[1] = int.Parse(maskedTextBoxAtkMin.Text);
                minIVs[2] = int.Parse(maskedTextBoxDefMin.Text);
                minIVs[3] = int.Parse(maskedTextBoxSpAtkMin.Text);
                minIVs[4] = int.Parse(maskedTextBoxSpDefMin.Text);
                minIVs[5] = int.Parse(maskedTextBoxSpeedMin.Text);

                maxIVs[0] = int.Parse(maskedTextBoxHPMax.Text);
                maxIVs[1] = int.Parse(maskedTextBoxAtkMax.Text);
                maxIVs[2] = int.Parse(maskedTextBoxDefMax.Text);
                maxIVs[3] = int.Parse(maskedTextBoxSpAtkMax.Text);
                maxIVs[4] = int.Parse(maskedTextBoxSpDefMax.Text);
                maxIVs[5] = int.Parse(maskedTextBoxSpeedMax.Text);

                int combinations = (maxIVs[0] - minIVs[0] + 1) +
                                   (maxIVs[1] - minIVs[1] + 1) +
                                   (maxIVs[2] - minIVs[2] + 1) +
                                   (maxIVs[3] - minIVs[3] + 1) +
                                   (maxIVs[4] - minIVs[4] + 1) +
                                   (maxIVs[5] - minIVs[5] + 1);

                if (combinations > 200)
                {
                    MessageBox.Show(
                        "There were too many combinations of IV possibilities to accurately find your intitial seed (" +
                        combinations + ") please try with a higher level Pokemon,", "Too many IV Combinations");
                    return;
                }
            }

            var version = (Version) comboBoxVersion.SelectedIndex;
            var language = (Language) comboBoxLanguage.SelectedIndex;
            var dstype = (DSType) comboBoxDSType.SelectedIndex;

            var interval = (uint) ((VCountMax - VCountMin)/(float) jobs.Length);
            uint VCountMinLower = VCountMin;
            uint VCountMinUpper = VCountMin + interval;

            var button = new int[3];
            button[0] = comboBoxButton1.SelectedIndex;
            button[1] = comboBoxButton2.SelectedIndex;
            button[2] = comboBoxButton3.SelectedIndex;

            try
            {
                progress.SetupAndShow(this, 0, 0, false, true);
                for (int i = 0; i < jobs.Length; i++)
                {
                    if (i < (jobs.Length - 1))
                    {
                        uint lower = VCountMinLower;
                        uint upper = VCountMinUpper;
                        jobs[i] =
                            new Thread(
                                () => GenerateSearchJob(testTime, minIVs, maxIVs, lower, upper,
                                                        Timer0Min, Timer0Max, GxStatMin, GxStatMax, VFrameMin,
                                                        VFrameMax, secondsMin, secondsMax, version, language, dstype,
                                                        button,
                                                        checkBoxSoftReset.Checked, checkBoxRoamer.Checked, minMaxGxStat));
                    }
                    else
                    {
                        uint lower = VCountMinLower;
                        jobs[i] =
                            new Thread(
                                () => GenerateSearchJob(testTime, minIVs, maxIVs, lower, VCountMax, Timer0Min,
                                                        Timer0Max, GxStatMin, GxStatMax, VFrameMin, VFrameMax,
                                                        secondsMin, secondsMax, version, language, dstype, button,
                                                        checkBoxSoftReset.Checked, checkBoxRoamer.Checked, minMaxGxStat));
                    }

                    jobs[i].Start();
                    Thread.Sleep(100);
                    VCountMinLower = VCountMinLower + interval + 1;
                    VCountMinUpper = VCountMinUpper + interval + 1;
                }
                bool alive = true;
                while (alive)
                {
                    progress.ShowProgress(progressSearched/(float) progressTotal, progressSearched, progressFound);
                    if (refreshQueue)
                    {
                        listBinding.ResetBindings(false);
                        refreshQueue = false;
                    }
                    foreach (Thread job in jobs)
                    {
                        if (job != null && job.IsAlive)
                        {
                            alive = true;
                            break;
                        }
                        alive = false;
                    }
                }
            }
            catch (Exception exception)
            {
                if (exception.Message != "Operation Cancelled")
                {
                    throw;
                }
            }
            finally
            {
                progress.Finish();
                if (dsParameters.Count > 0)
                {
                    btnSendTimeFinder.Enabled = true;
                }
                for (int i = 0; i < jobs.Length; i++)
                {
                    if (jobs[i] != null)
                    {
                        jobs[i].Abort();
                    }
                }
            }
        }
示例#10
0
        private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType)
        {
            switch (frameType)
            {
                case FrameType.Method5Standard:
                case FrameType.Method5Natures:
                case FrameType.Wondercard5thGen:
                case FrameType.Wondercard5thGenFixed:
                    var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"};
                    ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer);
                    CapDateTime.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                    break;
                case FrameType.BWBred:
                case FrameType.BWBredInternational:
                    iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"};
                    ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer);
                    ColumnEggDate.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                    break;
            }

            dataGrid.DataSource = bindingSource;
            bindingSource.ResetBindings(false);
        }
        //, ref BindingSource bsPositions, ref BindingSource bsBadges
        public void Populate(ref DataGridView DataGridView, ref BindingSource bs)
        {
            noOfRec = 0;
            //dssx.Dispose();
            lbl_NoRec.Text = " songs.";
            bs.DataSource = null;
            dssx.Dispose();
            //MessageBox.Show("zero " + noOfRec.ToString() + SearchCmd);
            //DB_Path = "../../../../tmp\\Files.accdb;";
            using (OleDbConnection cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + DB_Path))
            {
                OleDbDataAdapter da = new OleDbDataAdapter(SearchCmd, cn);
                //MessageBox.Show("pop" + noOfRec.ToString() + SearchCmd);
                dssx.Clear();
                try
                {
                    da.Fill(dssx, "Main");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show("-DB Open in Design Mode or Download Connectivity patch @ https://www.microsoft.com/en-us/download/confirmation.aspx?id=23734");
                    ErrorWindow frm1 = new ErrorWindow("DB Open in Design Mode or Download Connectivity patch @ ", "https://www.microsoft.com/en-us/download/confirmation.aspx?id=23734");
                    return;
                }
                da.Dispose();
                cn.Dispose();
                noOfRec = dssx.Tables[0].Rows.Count;
                lbl_NoRec.Text = noOfRec.ToString() + " records.";
                //MessageBox.Show("pop" + noOfRec.ToString() + SearchCmd);
                //da = new OleDbDataAdapter("SELECT Identifier,ContactPosition FROM PositionType;", cn);
                //da.Fill(ds, "PositionType");
                //da = new OleDbDataAdapter("SELECT Identifier, Badge FROM Badge", cn);
                //da.Fill(ds, "Badge");
            }
            //MessageBox.Show("test");
            DataGridViewTextBoxColumn ID = new DataGridViewTextBoxColumn { DataPropertyName = "ID", HeaderText = "ID " };
            DataGridViewTextBoxColumn Song_Title = new DataGridViewTextBoxColumn { DataPropertyName = "Song_Title", HeaderText = "Song_Title " };
            DataGridViewTextBoxColumn Song_Title_Sort = new DataGridViewTextBoxColumn { DataPropertyName = "Song_Title_Sort", HeaderText = "Song_Title_Sort " };
            DataGridViewTextBoxColumn Album = new DataGridViewTextBoxColumn { DataPropertyName = "Album", HeaderText = "Album " };
            DataGridViewTextBoxColumn Artist = new DataGridViewTextBoxColumn { DataPropertyName = "Artist", HeaderText = "Artist " };
            DataGridViewTextBoxColumn Artist_Sort = new DataGridViewTextBoxColumn { DataPropertyName = "Artist_Sort", HeaderText = "Artist_Sort " };
            DataGridViewTextBoxColumn Album_Year = new DataGridViewTextBoxColumn { DataPropertyName = "Album_Year", HeaderText = "Album_Year " };
            DataGridViewTextBoxColumn AverageTempo = new DataGridViewTextBoxColumn { DataPropertyName = "AverageTempo", HeaderText = "AverageTempo " };
            DataGridViewTextBoxColumn Volume = new DataGridViewTextBoxColumn { DataPropertyName = "Volume", HeaderText = "Volume " };
            DataGridViewTextBoxColumn Preview_Volume = new DataGridViewTextBoxColumn { DataPropertyName = "Preview_Volume", HeaderText = "Preview_Volume " };
            DataGridViewTextBoxColumn AlbumArtPath = new DataGridViewTextBoxColumn { DataPropertyName = "AlbumArtPath", HeaderText = "AlbumArtPath " };
            DataGridViewTextBoxColumn AudioPath = new DataGridViewTextBoxColumn { DataPropertyName = "AudioPath", HeaderText = "AudioPath " };
            DataGridViewTextBoxColumn audioPreviewPath = new DataGridViewTextBoxColumn { DataPropertyName = "audioPreviewPath", HeaderText = "audioPreviewPath " };
            DataGridViewTextBoxColumn Track_No = new DataGridViewTextBoxColumn { DataPropertyName = "Track_No", HeaderText = "Track_No " };
            DataGridViewTextBoxColumn Author = new DataGridViewTextBoxColumn { DataPropertyName = "Author", HeaderText = "Author " };
            DataGridViewTextBoxColumn Version = new DataGridViewTextBoxColumn { DataPropertyName = "Version", HeaderText = "Version " };
            DataGridViewTextBoxColumn DLC_Name = new DataGridViewTextBoxColumn { DataPropertyName = "DLC_Name", HeaderText = "DLC_Name " };
            DataGridViewTextBoxColumn DLC_AppID = new DataGridViewTextBoxColumn { DataPropertyName = "DLC_AppID", HeaderText = "DLC_AppID " };
            DataGridViewTextBoxColumn Current_FileName = new DataGridViewTextBoxColumn { DataPropertyName = "Current_FileName", HeaderText = "Current_FileName " };
            DataGridViewTextBoxColumn Original_FileName = new DataGridViewTextBoxColumn { DataPropertyName = "Original_FileName", HeaderText = "Original_FileName " };
            DataGridViewTextBoxColumn Import_Path = new DataGridViewTextBoxColumn { DataPropertyName = "Import_Path", HeaderText = "Import_Path " };
            DataGridViewTextBoxColumn Import_Date = new DataGridViewTextBoxColumn { DataPropertyName = "Import_Date", HeaderText = "Import_Date " };
            DataGridViewTextBoxColumn Folder_Name = new DataGridViewTextBoxColumn { DataPropertyName = "Folder_Name", HeaderText = "Folder_Name " };
            DataGridViewTextBoxColumn File_Size = new DataGridViewTextBoxColumn { DataPropertyName = "File_Size", HeaderText = "File_Size " };
            DataGridViewTextBoxColumn File_Hash = new DataGridViewTextBoxColumn { DataPropertyName = "File_Hash", HeaderText = "File_Hash " };
            DataGridViewTextBoxColumn Original_File_Hash = new DataGridViewTextBoxColumn { DataPropertyName = "Original_File_Hash", HeaderText = "Original_File_Hash " };
            DataGridViewTextBoxColumn Is_Original = new DataGridViewTextBoxColumn { DataPropertyName = "Is_Original", HeaderText = "Is_Original " };
            DataGridViewTextBoxColumn Is_OLD = new DataGridViewTextBoxColumn { DataPropertyName = "Is_OLD", HeaderText = "Is_OLD " };
            DataGridViewTextBoxColumn Is_Beta = new DataGridViewTextBoxColumn { DataPropertyName = "Is_Beta", HeaderText = "Is_Beta " };
            DataGridViewTextBoxColumn Is_Alternate = new DataGridViewTextBoxColumn { DataPropertyName = "Is_Alternate", HeaderText = "Is_Alternate " };
            DataGridViewTextBoxColumn Is_Multitrack = new DataGridViewTextBoxColumn { DataPropertyName = "Is_Multitrack", HeaderText = "Is_Multitrack " };
            DataGridViewTextBoxColumn Is_Broken = new DataGridViewTextBoxColumn { DataPropertyName = "Is_Broken", HeaderText = "Is_Broken " };
            DataGridViewTextBoxColumn MultiTrack_Version = new DataGridViewTextBoxColumn { DataPropertyName = "MultiTrack_Version", HeaderText = "MultiTrack_Version " };
            DataGridViewTextBoxColumn Alternate_Version_No = new DataGridViewTextBoxColumn { DataPropertyName = "Alternate_Version_No", HeaderText = "Alternate_Version_No " };
            DataGridViewTextBoxColumn DLC = new DataGridViewTextBoxColumn { DataPropertyName = "DLC", HeaderText = "DLC " };
            DataGridViewTextBoxColumn Has_Bass = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Bass", HeaderText = "Has_Bass " };
            DataGridViewTextBoxColumn Has_Guitar = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Guitar", HeaderText = "Has_Guitar " };
            DataGridViewTextBoxColumn Has_Lead = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Lead", HeaderText = "Has_Lead " };
            DataGridViewTextBoxColumn Has_Rhythm = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Rhythm", HeaderText = "Has_Rhythm " };
            DataGridViewTextBoxColumn Has_Combo = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Combo", HeaderText = "Has_Combo " };
            DataGridViewTextBoxColumn Has_Vocals = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Vocals", HeaderText = "Has_Vocals " };
            DataGridViewTextBoxColumn Has_Sections = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Sections", HeaderText = "Has_Sections " };
            DataGridViewTextBoxColumn Has_Cover = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Cover", HeaderText = "Has_Cover " };
            DataGridViewTextBoxColumn Has_Preview = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Preview", HeaderText = "Has_Preview " };
            DataGridViewTextBoxColumn Has_Custom_Tone = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Custom_Tone", HeaderText = "Has_Custom_Tone " };
            DataGridViewTextBoxColumn Has_DD = new DataGridViewTextBoxColumn { DataPropertyName = "Has_DD", HeaderText = "Has_DD " };
            DataGridViewTextBoxColumn Has_Version = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Version", HeaderText = "Has_Version " };
            DataGridViewTextBoxColumn Tunning = new DataGridViewTextBoxColumn { DataPropertyName = "Tunning", HeaderText = "Tunning " };
            DataGridViewTextBoxColumn Bass_Picking = new DataGridViewTextBoxColumn { DataPropertyName = "Bass_Picking", HeaderText = "Bass_Picking " };
            DataGridViewTextBoxColumn Tones = new DataGridViewTextBoxColumn { DataPropertyName = "Tones", HeaderText = "Tones " };
            DataGridViewTextBoxColumn Groups = new DataGridViewTextBoxColumn { DataPropertyName = "Groups", HeaderText = "Groups " };
            DataGridViewTextBoxColumn Rating = new DataGridViewTextBoxColumn { DataPropertyName = "Rating", HeaderText = "Rating " };
            DataGridViewTextBoxColumn Description = new DataGridViewTextBoxColumn { DataPropertyName = "Description", HeaderText = "Description " };
            DataGridViewTextBoxColumn Comments = new DataGridViewTextBoxColumn { DataPropertyName = "Comments", HeaderText = "Comments " };
            DataGridViewTextBoxColumn Has_Track_No = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Track_No", HeaderText = "Has_Track_No " };
            DataGridViewTextBoxColumn Platform = new DataGridViewTextBoxColumn { DataPropertyName = "Platform", HeaderText = "Platform " };
            DataGridViewTextBoxColumn PreviewTime = new DataGridViewTextBoxColumn { DataPropertyName = "PreviewTime", HeaderText = "PreviewTime " };
            DataGridViewTextBoxColumn PreviewLenght = new DataGridViewTextBoxColumn { DataPropertyName = "PreviewLenght", HeaderText = "PreviewLenght " };
            DataGridViewTextBoxColumn Temp = new DataGridViewTextBoxColumn { DataPropertyName = "Temp", HeaderText = "Temp " };
            DataGridViewTextBoxColumn CustomForge_Followers = new DataGridViewTextBoxColumn { DataPropertyName = "CustomForge_Followers", HeaderText = "CustomForge_Followers " };
            DataGridViewTextBoxColumn CustomForge_Version = new DataGridViewTextBoxColumn { DataPropertyName = "CustomForge_Version", HeaderText = "CustomForge_Version " };
            DataGridViewTextBoxColumn Show_Available_Instruments = new DataGridViewTextBoxColumn { DataPropertyName = "Show_Available_Instruments", HeaderText = "Show_Available_Instruments " };
            DataGridViewTextBoxColumn Show_Alternate_Version = new DataGridViewTextBoxColumn { DataPropertyName = "Show_Alternate_Version", HeaderText = "Show_Alternate_Version " };
            DataGridViewTextBoxColumn Show_MultiTrack_Details = new DataGridViewTextBoxColumn { DataPropertyName = "Show_MultiTrack_Details", HeaderText = "Show_MultiTrack_Details " };
            DataGridViewTextBoxColumn Show_Group = new DataGridViewTextBoxColumn { DataPropertyName = "Show_Group", HeaderText = "Show_Group " };
            DataGridViewTextBoxColumn Show_Beta = new DataGridViewTextBoxColumn { DataPropertyName = "Show_Beta", HeaderText = "Show_Beta " };
            DataGridViewTextBoxColumn Show_Broken = new DataGridViewTextBoxColumn { DataPropertyName = "Show_Broken", HeaderText = "Show_Broken " };
            DataGridViewTextBoxColumn Show_DD = new DataGridViewTextBoxColumn { DataPropertyName = "Show_DD", HeaderText = "Show_DD " };
            DataGridViewTextBoxColumn Original = new DataGridViewTextBoxColumn { DataPropertyName = "Original", HeaderText = "Original " };
            DataGridViewTextBoxColumn Selected = new DataGridViewTextBoxColumn { DataPropertyName = "Selected", HeaderText = "Selected " };
            DataGridViewTextBoxColumn YouTube_Link = new DataGridViewTextBoxColumn { DataPropertyName = "YouTube_Link", HeaderText = "YouTube_Link " };
            DataGridViewTextBoxColumn CustomsForge_Link = new DataGridViewTextBoxColumn { DataPropertyName = "CustomsForge_Link", HeaderText = "CustomsForge_Link " };
            DataGridViewTextBoxColumn CustomsForge_Like = new DataGridViewTextBoxColumn { DataPropertyName = "CustomsForge_Like", HeaderText = "CustomsForge_Like " };
            DataGridViewTextBoxColumn CustomsForge_ReleaseNotes = new DataGridViewTextBoxColumn { DataPropertyName = "CustomsForge_ReleaseNotes", HeaderText = "CustomsForge_ReleaseNotes " };
            DataGridViewTextBoxColumn SignatureType = new DataGridViewTextBoxColumn { DataPropertyName = "SignatureType", HeaderText = "SignatureType " };
            DataGridViewTextBoxColumn ToolkitVersion = new DataGridViewTextBoxColumn { DataPropertyName = "ToolkitVersion", HeaderText = "ToolkitVersion " };
            DataGridViewTextBoxColumn Has_Author = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Author", HeaderText = "Has_Author " };
            DataGridViewTextBoxColumn OggPath = new DataGridViewTextBoxColumn { DataPropertyName = "OggPath", HeaderText = "OggPath " };
            DataGridViewTextBoxColumn oggPreviewPath = new DataGridViewTextBoxColumn { DataPropertyName = "oggPreviewPath", HeaderText = "oggPreviewPath " };
            DataGridViewTextBoxColumn UniqueDLCName = new DataGridViewTextBoxColumn { DataPropertyName = "UniqueDLCName", HeaderText = "UniqueDLCName " };
            DataGridViewTextBoxColumn AlbumArt_Hash = new DataGridViewTextBoxColumn { DataPropertyName = "AlbumArt_Hash", HeaderText = "AlbumArt_Hash " };
            DataGridViewTextBoxColumn Audio_Hash = new DataGridViewTextBoxColumn { DataPropertyName = "Audio_Hash", HeaderText = "Audio_Hash " };
            DataGridViewTextBoxColumn audioPreview_Hash = new DataGridViewTextBoxColumn { DataPropertyName = "audioPreview_Hash", HeaderText = "audioPreview_Hash " };
            DataGridViewTextBoxColumn Bass_Has_DD = new DataGridViewTextBoxColumn { DataPropertyName = "Bass_Has_DD", HeaderText = "Bass_Has_DD " };
            DataGridViewTextBoxColumn Has_Bonus_Arrangement = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Bonus_Arrangement", HeaderText = "Has_Bonus_Arrangement " };
            DataGridViewTextBoxColumn Artist_ShortName = new DataGridViewTextBoxColumn { DataPropertyName = "Artist_ShortName", HeaderText = "Artist_ShortName " };
            DataGridViewTextBoxColumn Album_ShortName = new DataGridViewTextBoxColumn { DataPropertyName = "Album_ShortName", HeaderText = "Album_ShortName " };
            DataGridViewTextBoxColumn Available_Old = new DataGridViewTextBoxColumn { DataPropertyName = "Available_Old", HeaderText = "Available_Old " };
            DataGridViewTextBoxColumn Available_Duplicate = new DataGridViewTextBoxColumn { DataPropertyName = "Available_Duplicate", HeaderText = "Available_Duplicate " };
            DataGridViewTextBoxColumn Has_Been_Corrected = new DataGridViewTextBoxColumn { DataPropertyName = "Has_Been_Corrected", HeaderText = "Has_Been_Corrected " };

            //bsPositions.DataSource = ds.Tables["Main"];
            //bsBadges.DataSource = ds.Tables["Badge"];

            //DataGridViewComboBoxColumn ContactPositionColumn = new DataGridViewComboBoxColumn
            //    {
            //        DataPropertyName = "ContactPosition",
            //        DataSource = bsPositions,
            //        DisplayMember = "ContactPosition",
            //        DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
            //        Name = "ContactsColumn",
            //        HeaderText = "Position",
            //        SortMode = DataGridViewColumnSortMode.Automatic,
            //        ValueMember = "ContactPosition"
            //    };

            //DataGridViewComboBoxColumn BadgeColumn = new DataGridViewComboBoxColumn
            //    {
            //        DataPropertyName = "Badge",
            //        DataSource = bsBadges,
            //        DisplayMember = "Badge",
            //        DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
            //        Name = "BadgeColumn",
            //        HeaderText = "Badge",
            //        SortMode = DataGridViewColumnSortMode.Automatic,
            //        ValueMember = "Badge"
            //    };

            DataGridView.AutoGenerateColumns = false;

            DataGridView.Columns.AddRange(new DataGridViewColumn[]
            {
                ID,
                Song_Title,
                Song_Title_Sort,
                Album,
                Artist,
                Artist_Sort,
                Album_Year,
                AverageTempo,
                Volume,
                Preview_Volume,
                AlbumArtPath,
                AudioPath,
                audioPreviewPath,
                Track_No,
                Author,
                Version,
                DLC_Name,
                DLC_AppID,
                Current_FileName,
                Original_FileName,
                Import_Path,
                Import_Date,
                Folder_Name,
                File_Size,
                File_Hash,
                Original_File_Hash,
                Is_Original,
                Is_OLD,
                Is_Beta,
                Is_Alternate,
                Is_Multitrack,
                Is_Broken,
                MultiTrack_Version,
                Alternate_Version_No,
                DLC,
                Has_Bass,
                Has_Guitar,
                Has_Lead,
                Has_Rhythm,
                Has_Combo,
                Has_Vocals,
                Has_Sections,
                Has_Cover,
                Has_Preview,
                Has_Custom_Tone,
                Has_DD,
                Has_Version,
                Tunning,
                Bass_Picking,
                Tones,
                Groups,
                Rating,
                Description,
                Comments,
                Has_Track_No,
                Platform,
                PreviewTime,
                PreviewLenght,
                Temp,
                CustomForge_Followers,
                CustomForge_Version,
                Show_Available_Instruments,
                Show_Alternate_Version,
                Show_MultiTrack_Details,
                Show_Group,
                Show_Beta,
                Show_Broken,
                Show_DD,
                Original,
                Selected,
                YouTube_Link,
                CustomsForge_Link,
                CustomsForge_Like,
                CustomsForge_ReleaseNotes,
                SignatureType,
                ToolkitVersion,
                Has_Author,
                OggPath,
                oggPreviewPath,
                UniqueDLCName,
                AlbumArt_Hash,
                Audio_Hash,
                audioPreview_Hash,
                Bass_Has_DD,
                Has_Bonus_Arrangement,
                Artist_ShortName,
                Album_ShortName,
                Available_Old,
                Available_Duplicate,
                Has_Been_Corrected
            }
            );
            bs.ResetBindings(false);
            dssx.Tables["Main"].AcceptChanges();
            bs.DataSource = dssx.Tables["Main"];
            DataGridView.AutoGenerateColumns = false;
            DataGridView.DataSource = null;
            DataGridView.DataSource = bs;
            DataGridView.AutoGenerateColumns = false;
            DataGridView.Refresh();
            //bs.Dispose();
            dssx.Dispose();
            //MessageBox.Show("-");
            //DataGridView.ExpandColumns();
        }
示例#12
0
        public static void refreshgrid(DataGridView _dg, BindingSource _bs, bool endstate)
        {

            if (_dg.InvokeRequired)
            {
                try
                {
                    _dg.Invoke(new booldel(refreshgrid), new object[] { _dg,_bs,endstate });
                }
                catch (ObjectDisposedException) { }
            }
            else
            {
                // save screen position and selections
                List<int> sel = new List<int>();
                int first = -1;
                try
                {
                    lock (_dg)
                    {
                        first = _dg.FirstDisplayedScrollingRowIndex;
                        foreach (DataGridViewRow dr in _dg.SelectedRows)
                            sel.Add(dr.Index);
                    }



                    // update screen
                    _bs.RaiseListChangedEvents = true;
                    _bs.ResetBindings(false);
                    // diable updates again
                    _bs.RaiseListChangedEvents = endstate;

                }
                catch (Exception ex)
                {

                }

                // restore screen position and selections
                lock (_dg)
                {
                    try
                    {
                        if (first != -1)
                            _dg.FirstDisplayedScrollingRowIndex = first;
                        foreach (int r in sel)
                            _dg.Rows[r].Selected = true;
                    }
                    catch
                    {
                        // in case this row was deleted in the middle of an update
                    }
                }
            }
        }
示例#13
0
 /// <summary>
 /// binds the DER Group and DER Members to the group passed
 /// </summary>
 /// <param name="group"></param>
 private void bindDevices(DERMSInterface.CIMData.DERGroup group)
 {
     if (group == null)
     {
         dERGroupBindingSource.DataSource = null;
         DERView.DataSource = null;
         dERGroupBindingSource.Clear();
     }
     else
     {
         if (group.Devices == null)
             group.Devices = new List<DERMSInterface.CIMData.device>();
         dERGroupBindingSource = new BindingSource();
         dERGroupBindingSource.DataSource = group.Devices;
         DERView.DataSource = dERGroupBindingSource;
         dERGroupBindingSource.ResetBindings(false);
     }
 }
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            uint VCountMin = uint.Parse(textBoxVCountMin.Text, NumberStyles.HexNumber);
            uint VCountMax = uint.Parse(textBoxVCountMax.Text, NumberStyles.HexNumber);
            uint Timer0Min = uint.Parse(textBoxTimer0Min.Text, NumberStyles.HexNumber);
            uint Timer0Max = uint.Parse(textBoxTimer0Max.Text, NumberStyles.HexNumber);
            uint GxStatMin = uint.Parse(textBoxGxStatMin.Text, NumberStyles.HexNumber);
            uint GxStatMax = uint.Parse(textBoxGxStatMax.Text, NumberStyles.HexNumber);
            uint VFrameMin = uint.Parse(textBoxVFrameMin.Text, NumberStyles.HexNumber);
            uint VFrameMax = uint.Parse(textBoxVFrameMax.Text, NumberStyles.HexNumber);
            int secondsMin = int.Parse(maskedTextBoxSecondsMin.Text);
            int secondsMax = int.Parse(maskedTextBoxSecondsMax.Text);
            if (secondsMax < secondsMin)
            {
                secondsMax = secondsMax + 60;
            }

            bool minMaxGxStat = cbGxStat.Checked;

            dsParameters = new List<DSParameterCapture>();
            var listBinding = new BindingSource {DataSource = dsParameters};
            dgvResults.DataSource = listBinding;

            cpus = Settings.Default.CPUs;
            if (cpus < 1)
            {
                cpus = 1;
            }

            var jobs = new Thread[cpus];

            var progress = new Progress {Text = "DS Parameter Progress"};
            // this is wrong
            progressTotal = (ulong) ((VCountMax - VCountMin + 1)
                                     *(Timer0Max - Timer0Min + 1)
                                     // if only min max gx stat search is 2 (or 1 if they're the same) else it's max-min
                                     *(minMaxGxStat ? (GxStatMax > GxStatMin ? 2u : 1) : (GxStatMax - GxStatMin + 1))
                                     *(VFrameMax - VFrameMin + 1)
                                     *(secondsMax - secondsMin + 1));

            progressSearched = 0;
            progressFound = 0;
            var testTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                int.Parse(maskedTextBoxHour.Text),
                int.Parse(maskedTextBoxMinute.Text),
                secondsMin);

            MAC_address = ulong.Parse(textBoxMACAddress.Text, NumberStyles.HexNumber);
            if (textBoxMACAddress.Text.Length < 12)
            {
                MessageBox.Show("Your MAC address is missing some digits.  Double-check your MAC address.");
            }

            var version = (Version) (comboBoxVersion.SelectedIndex + 2);
            var language = (Language) comboBoxLanguage.SelectedIndex;
            var dstype = (DSType) comboBoxDSType.SelectedIndex;

            var interval = (uint) ((VCountMax - VCountMin)/(float) jobs.Length);
            uint VCountMinLower = VCountMin;
            uint VCountMinUpper = VCountMin + interval;

            var buttons = new int[3];
            buttons[0] = comboBoxButton1.SelectedIndex;
            buttons[1] = comboBoxButton2.SelectedIndex;
            buttons[2] = comboBoxButton3.SelectedIndex;
            uint button = Functions.buttonMashed(buttons);

            String[] arrows = txtSpins.Text.Split(' ');
            var pattern = new uint[arrows.Length];
            for (int i = 0; i < arrows.Length; ++i)
            {
                switch (arrows[i])
                {
                    case "↑":
                        pattern[i] = 0;
                        break;
                    case "↗":
                        pattern[i] = 1;
                        break;
                    case "→":
                        pattern[i] = 2;
                        break;
                    case "↘":
                        pattern[i] = 3;
                        break;
                    case "↓":
                        pattern[i] = 4;
                        break;
                    case "↙":
                        pattern[i] = 5;
                        break;
                    case "←":
                        pattern[i] = 6;
                        break;
                    case "↖":
                        pattern[i] = 7;
                        break;
                }
            }

            try
            {
                progress.SetupAndShow(this, 0, 0, false, true);
                for (int i = 0; i < jobs.Length; i++)
                {
                    uint lower = VCountMinLower;
                    uint upper = (i < (jobs.Length - 1)) ? VCountMinUpper : VCountMax;
                    jobs[i] =
                        new Thread(
                            () => Search(testTime, lower, upper, Timer0Min, Timer0Max, VFrameMin,
                                         VFrameMax, GxStatMin, GxStatMax, minMaxGxStat, secondsMin, secondsMax,
                                         checkBoxSoftReset.Checked, version, language, dstype, cbMemoryLink.Checked,
                                         MAC_address,
                                         button, pattern));

                    jobs[i].Start();
                    Thread.Sleep(100);
                    VCountMinLower = VCountMinLower + interval + 1;
                    VCountMinUpper = VCountMinUpper + interval + 1;
                }
                bool alive = true;
                while (alive)
                {
                    progress.ShowProgress(progressSearched/(float) progressTotal, progressSearched, progressFound);
                    if (refreshQueue)
                    {
                        listBinding.ResetBindings(false);
                        refreshQueue = false;
                    }
                    foreach (Thread job in jobs)
                    {
                        if (job != null && job.IsAlive)
                        {
                            alive = true;
                            break;
                        }
                        alive = false;
                    }
                }
            }
            catch (Exception exception)
            {
                if (exception.Message != "Operation Cancelled")
                {
                    throw;
                }
            }
            finally
            {
                progress.Finish();
                if (dsParameters.Count > 0)
                {
                    //btnSendProfile.Enabled = true;
                }
                for (int i = 0; i < jobs.Length; i++)
                {
                    if (jobs[i] != null)
                    {
                        jobs[i].Abort();
                    }
                }
            }
        }
示例#15
0
        /// <summary>
        /// initializes the form, loads the on screen widgets with data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormLoad(object sender, System.EventArgs e)
        {
            DERMSInterface.CIMData.header header = _cim.CreateDERHeader;

            // header info
            this.endPointText.Text = header.EndPoint;
            this.messageTypeText.Text = "Create DER";
            this.replyAddressText.Text = header.ReplyAddress;
            this.userIDText.Text = header.UserID;
            this.organizationText.Text = header.UserOrganization;
            this.contextText.Text = header.Context;
            this.verbText.Text = header.Verb;
            this.ackRequiredCheck.Checked = header.AckRequired;
            this.commentText.Text = header.Comment;

            // group widgets
            DERMSInterface.CIMData.DERGroup group = _group;
            DERGroupNameText.Text = group.GroupName;
            DERGroupMRIDText.Text = group.Mrid;
            DERGroupRevisionText.Text = group.Revision;
            DERGroupSubText.Text = group.Substation;
            DERGroupFeederText.Text = group.Feeder;
            DERGroupSegmentText.Text = group.Segment;
            // TODO : we do not set count, reactive and total power values, they are derived

            int deviceCount = 0;
            double realPower = 0.0;
            double reactivePower = 0.0;

            // bind datasource to the currently selected DER group row
            bs = new BindingSource();
            bs.DataSource = group.Devices;
            DERView.DataSource = bs;
            bs.ResetBindings(false);

            // we allow editing/adding to DER members
            DERView.CellValueChanged += new DataGridViewCellEventHandler(DERCellValue_Updated);
            DERView.CellValidating += new DataGridViewCellValidatingEventHandler(DERCell_Validating);

            // first time, set the read-only sum/count vars for DERGRoup based
            // on the DER members
            group.Devices.ForEach(x =>
            {
                deviceCount++;
                realPower += x.WattCapacity;
                reactivePower += x.VarCapacity;
            });

            // editing for DER members, no edit on derived DER Group fields
            DERView.ReadOnly = false;
            DERGroupDeviceCountText.Enabled = false;
            DERGroupRealText.Enabled = false;
            DERGroupReactiveText.Enabled = false;

            // intialize readonly vars
            DERGroupDeviceCountText.Text = group.Devices.Count.ToString();
            DERGroupReactiveText.Text = group.getVarCapacity().ToString();
            DERGroupRealText.Text = group.getWattCapacity().ToString();

            // if (_editDER == true)
            //     DERView.CellValueChanged += new DataGridViewCellEventHandler(CellValue_Changed);
        }
 protected override void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid,
                                    FrameType frameType)
 {
     dataGrid.DataSource = bindingSource;
     bindingSource.ResetBindings(false);
 }
示例#17
0
 private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType)
 {
     switch (frameType)
     {
         case FrameType.EBredPID:
             var iframeComparer = new IFrameEEggPIDComparer {CompareType = "Frame"};
             ((List<IFrameEEggPID>) bindingSource.DataSource).Sort(iframeComparer);
             EPIDFrame.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
             break;
     }
     dataGrid.DataSource = bindingSource;
     bindingSource.ResetBindings(false);
 }
示例#18
0
        private void SeedToTime_Load(object sender, EventArgs e)
        {
            dataGridViewValues.AutoGenerateColumns = false;
            dataGridViewAdjacents.AutoGenerateColumns = false;

            AdjacentSeed.DefaultCellStyle.Format = "X8";
            ColumnCGearAdjust.DefaultCellStyle.Format = "X8";

            textBoxSeed.Text = Seed.ToString("x");
            maskedTextBoxYear.Text = Year.ToString();

            //  Grab our items from the registry
            RegistryKey registrySoftware = Registry.CurrentUser.OpenSubKey("Software", true);
            if (registrySoftware != null)
            {
                RegistryKey registryRngReporter = registrySoftware.CreateSubKey("RNGReporter");

                if (Settings.Default.LastVersion < MainForm.VersionNumber && registryRngReporter != null)
                {
                    maskedTextBoxSeconds.Text = (string) registryRngReporter.GetValue("stt_seconds", "0");

                    checkBoxLockSeconds.Checked = false;

                    if ((string) registryRngReporter.GetValue("stt_secondslocked", "0") == "1")
                    {
                        checkBoxLockSeconds.Checked = true;
                    }

                    maskedTextBoxMDelay.Text = (string) registryRngReporter.GetValue("stt_mdelay", "10");
                    maskedTextBoxPDelay.Text = (string) registryRngReporter.GetValue("stt_pdelay", "10");
                    maskedTextBoxMSecond.Text = (string) registryRngReporter.GetValue("stt_msecond", "1");
                    maskedTextBoxPSecond.Text = (string) registryRngReporter.GetValue("stt_psecond", "1");
                }
                else
                {
                    maskedTextBoxSeconds.Text = Settings.Default.sttSeconds;

                    checkBoxLockSeconds.Checked = Settings.Default.sttSecondsLocked;

                    maskedTextBoxMDelay.Text = Settings.Default.sttMDelay;
                    maskedTextBoxPDelay.Text = Settings.Default.sttPDelay;
                    maskedTextBoxMSecond.Text = Settings.Default.sttMSecond;
                    maskedTextBoxPSecond.Text = Settings.Default.sttPSecond;
                }
            }

            //check and error otherwise
            if (Profiles.List != null || Profiles.List.Count > 0)
            {
                profilesSource = new BindingSource {DataSource = Profiles.List};
                comboBoxProfiles.DataSource = profilesSource;
                profilesSource.ResetBindings(false);
            }

            SetHgSsItems();

            if (AutoGenerate)
            {
                Generate();
            }

            if (ShowMap)
            {
                HgSsRoamerSW.Window.Show();
            }
        }
示例#19
0
        private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType)
        {
            switch (frameType)
            {
                case FrameType.MethodJ:
                case FrameType.MethodK:
                    var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "Seed"};
                    ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer);
                    CapSeed.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                    break;
            }

            dataGrid.DataSource = bindingSource;
            bindingSource.ResetBindings(false);
        }
示例#20
0
 // Methods we'll use when we roll up the above functions
 private void UpdateGrid(BindingSource bindingSource)
 {
     bindingSource.ResetBindings(false);
 }
示例#21
-13
 protected override void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid,
                                    FrameType frameType)
 {
     // note: there should be a safer way to do this
     switch (frameType)
     {
         case FrameType.Method1:
         case FrameType.Method2:
         case FrameType.Method4:
             dataGrid.Columns["Offset"].Visible = false;
             dataGrid.Columns["EncounterSlot"].Visible = false;
             break;
         case FrameType.MethodH1:
         case FrameType.MethodH2:
         case FrameType.MethodH4:
             dataGrid.Columns["Offset"].Visible = true;
             dataGrid.Columns["EncounterSlot"].Visible = true;
             break;
     }
     dataGrid.DataSource = bindingSource;
     bindingSource.ResetBindings(false);
 }