Beispiel #1
0
        /// <summary>
        /// Update the grid of the shared files.
        /// </summary>
        private void UpdateSharedFilesGrid()
        {
            DataGridViewRowCollection rows = this.SharedFilesGrid.Rows;

            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate { rows.Clear(); }));
            }
            else
            {
                rows.Clear();
            }

            for (int i = 0; i < FilesList.Count; i++)
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate { rows.Add(FilesList.List[i].Name, FilesList.List[i].Size, FilesList.List[i].SHA1, FilesList.List[i].Path); }));
                }
                else
                {
                    rows.Add(FilesList.List[i].Name, FilesList.List[i].Size, FilesList.List[i].SHA1, FilesList.List[i].Path);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Update the grid of the downloads.
        /// </summary>
        private void UpdateDownloadGrid()
        {
            DataGridViewRowCollection rows = this.DownloadsGrid.Rows;

            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate { rows.Clear(); }));
            }
            else
            {
                rows.Clear();
            }

            for (int i = 0; i < Downloader.Count; i++)
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate { rows.Add(Downloader.List[i].Name, Downloader.List[i].CurrentSize, Downloader.List[i].Progress, "SPEED", Downloader.List[i].Size, Downloader.List[i].SHA1); }));
                }
                else
                {
                    rows.Add(Downloader.List[i].Name, (Downloader.List[i].Size - (Downloader.List[i].RemainingFilePacks * 16384)), Downloader.List[i].Progress, "SPEED", Downloader.List[i].Size, Downloader.List[i].SHA1);
                }
            }
        }
Beispiel #3
0
        private void showAllGigs()
        {
            VenueGridRows.Clear();

            foreach (XElement gig in doc.Element("Event_Guide").Elements("Gig"))
            {
                searchXMLForBand(gig);
            }
        }
 private void PushElements()
 {
     listref.Clear(); listBox.Columns.Clear();
     listBox.Columns.Add("text", "Data");
     listBox.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     foreach (string i in list)
     {
         listref.Add(i);
     }
 }
        /// <summary>
        ///   Fills left column of columns assignment datagridview
        ///   with entrys of Ogama aoi table database columns,
        ///   or simple rectangle import columns.
        /// </summary>
        private void FillLeftAssignColumn()
        {
            DataGridViewRowCollection rows = this.dGVAssignments.Rows;

            rows.Clear();
            switch (ImportAOI.AoiSettings.ImportMode)
            {
            case AOIImportModes.UseSimpleRectangles:
                rows.Add(new[] { "TrialID", string.Empty });
                rows.Add(new[] { "NameOfShape", string.Empty });
                rows.Add(new[] { "Left top corner X", string.Empty });
                rows.Add(new[] { "Left top corner Y", string.Empty });
                rows.Add(new[] { "Right bottom corner X", string.Empty });
                rows.Add(new[] { "Right bottom corner Y", string.Empty });
                rows.Add(new[] { "ShapeGroup", string.Empty });
                break;

            case AOIImportModes.UseOgamaColumns:
                rows.Add(new[] { "TrialID", string.Empty });
                rows.Add(new[] { "SlideNr", string.Empty });
                rows.Add(new[] { "ShapeName", string.Empty });
                rows.Add(new[] { "ShapeType", string.Empty });
                rows.Add(new[] { "ShapeNumPts", string.Empty });
                rows.Add(new[] { "ShapePts", string.Empty });
                rows.Add(new[] { "ShapeGroup", string.Empty });
                break;
            }
        }
Beispiel #6
0
        ///////////////////////////////////////////////////////////////////////////////
        // Small helping Methods                                                     //
        ///////////////////////////////////////////////////////////////////////////////
        #region HELPER

        /// <summary>
        /// Fills left column of columns assignment datagridview
        /// with entrys of Ogama raw data database columns
        /// </summary>
        private void FillLeftAssignColumn()
        {
            DataGridViewRowCollection rows = this.dGVAssignments.Rows;

            rows.Clear();
            string[] row0  = { "SubjectName", string.Empty };
            string[] row1  = { "TrialSequence", string.Empty };
            string[] row2  = { "TrialID", string.Empty };
            string[] row3  = { "TrialImage", string.Empty };
            string[] row4  = { "TrialCategory", string.Empty };
            string[] row5  = { "Time", string.Empty };
            string[] row6  = { "PupilDiaX", string.Empty };
            string[] row7  = { "PupilDiaY", string.Empty };
            string[] row8  = { "GazePosX", string.Empty };
            string[] row9  = { "GazePosY", string.Empty };
            string[] row10 = { "MousePosX", string.Empty };
            string[] row11 = { "MousePosY", string.Empty };
            rows.Add(row0);
            rows.Add(row1);
            rows.Add(row2);
            rows.Add(row3);
            rows.Add(row4);
            rows.Add(row5);
            rows.Add(row6);
            rows.Add(row7);
            rows.Add(row8);
            rows.Add(row9);
            rows.Add(row10);
            rows.Add(row11);
        }
        private void UpdateTaskList()
        {
            List <model.Task>         tasks = database.GetTasksForUser(user);
            DataGridViewRowCollection col   = uxTaskList.Rows;

            col.Clear();
            foreach (model.Task task in tasks)
            {
                StringBuilder taskCategories = new StringBuilder();
                foreach (TaskCategory tc in task.TaskCategories)
                {
                    taskCategories.Append(tc.Name);
                    taskCategories.Append(", ");
                }
                if (taskCategories.Length >= 2)
                {
                    taskCategories.Length -= 2;
                }
                if ((uxFilterDateRange.Checked && task.DueDate >= uxDateRange.SelectionStart && task.DueDate < uxDateRange.SelectionEnd) ||
                    (uxFilterUserGroup.Checked && task.UserGroup.UserGroupID.Equals(((UserGroup)uxUserGroup.SelectedItem).UserGroupID)) ||
                    (uxFilterOwner.Checked && task.Owner.UserID.Equals(user.UserID)) ||
                    (uxFilterNotCompleted.Checked && task.CompletionDate == null) ||
                    (uxFilterName.Checked && task.Name.ToUpper().Contains(uxTaskName.Text.ToUpper())) ||
                    (!uxFilterDateRange.Checked && !uxFilterUserGroup.Checked && !uxFilterOwner.Checked && !uxFilterNotCompleted.Checked && !uxFilterName.Checked))
                {
                    col.Add(new object[] { task, task.CompletionDate != null ? "Completed" : task.TaskState.Name, taskCategories.ToString(), task.UserGroup.Name, task.Owner.Name, task.DueDate, task.StartDate, task.CompletionDate != null ? task.CompletionDate.ToString() : "Not Completed" });
                }
            }
        }
        public void get_course_table(String c_table)
        {
            string[] course_table = new string[6] {
                "", "", "", "", "", ""
            };
            rows = dataGridView1.Rows;
            rows.Clear();
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(c_table);
            HtmlAgilityPack.HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//table[@id='ctl00_MainContent_TabContainer1_tabCourseSearch_wcCourseSearch_gvWishListTimeTable']//tr");
            //製作課表
            for (int i = 1; i <= 14; i++)
            {
                HtmlAgilityPack.HtmlNode node = nodes[i];

                for (int j = 1; j <= 6; j++)
                {
                    if (node.ChildNodes[j].Attributes["class"].Value != "week" && node.ChildNodes[j].Attributes["class"].Value != "week w")
                    {
                        course_table[j - 1] = node.ChildNodes[j].InnerText;
                    }
                }
                rows.Add(course_table[0], course_table[1], course_table[2], course_table[3], course_table[4], course_table[5]);
                Array.Clear(course_table, 0, course_table.Length);
                rows[i - 1].Resizable = DataGridViewTriState.False;
            }
        }
Beispiel #9
0
        void LoadEntry(CompositeIsotopics comp_iso)
        {
            DataGridViewRowCollection rows = this.IsoDataGrid.Rows;

            rows.Clear();
            string[] summ = new string[9];
            summ[0] = comp_iso.pu_mass.ToString("F3");
            summ[1] = comp_iso.pu238.ToString("F6");
            summ[2] = comp_iso.pu239.ToString("F6");
            summ[3] = comp_iso.pu240.ToString("F6");
            summ[4] = comp_iso.pu241.ToString("F6");
            summ[5] = comp_iso.pu242.ToString("F6");
            summ[6] = comp_iso.pu_date.ToString("yyyy-MM-dd");
            summ[7] = comp_iso.am241.ToString("F6");
            summ[8] = comp_iso.am_date.ToString("yyyy-MM-dd");
            rows.Add(summ);

            foreach (CompositeIsotopic ci in comp_iso.isotopicComponents)
            {
                string[] sub = new string[9];
                sub[0] = ci.pu_mass.ToString("F3");
                sub[1] = ci.pu238.ToString("F6");
                sub[2] = ci.pu239.ToString("F6");
                sub[3] = ci.pu240.ToString("F6");
                sub[4] = ci.pu241.ToString("F6");
                sub[5] = ci.pu242.ToString("F6");
                sub[6] = ci.pu_date.ToString("yyyy-MM-dd");
                sub[7] = ci.am241.ToString("F6");
                sub[8] = ci.am_date.ToString("yyyy-MM-dd");
                rows.Add(sub);
            }
        }
Beispiel #10
0
        internal void AnalisaEntradas()
        {
            DataGridViewRowCollection RowsEntradas = frmFront.GetRows("dataGridEntradas");

            RowsEntradas.Clear();
            //TODO: continuar daqui
        }
Beispiel #11
0
        void LoadSchemas()
        {
            if (this.cache == null)
            {
                if (this.Site != null)
                {
                    this.cache = (SchemaCache)this.Site.GetService(typeof(SchemaCache));
                }
            }
            items.Clear();
            DataGridViewRowCollection col = this.dataGridView1.Rows;

            col.Clear();
            if (this.cache != null)
            {
                foreach (CacheEntry e in this.cache.GetSchemas())
                {
                    Uri        uri      = e.Location;
                    string     filename = uri.IsFile ? uri.LocalPath : uri.AbsoluteUri;
                    SchemaItem item     = new SchemaItem(e.Disabled, e.TargetNamespace, filename);
                    items.Add(item);
                    int i = col.Add(item.Values);
                    col[i].Tag = item;
                }
            }
        }
        private void UpdateUserGroupList()
        {
            if (userGroup != null)
            {
                List <Role> roles             = database.GetRoles();
                DataGridViewRowCollection col = uxGroupTable.Rows;
                col.Clear();

                foreach (KeyValuePair <User, Role> kvp in database.GetUsersInUserGroup(userGroup))
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(uxGroupTable);
                    row.Cells[0].Value = kvp.Key;
                    row.Cells[1].Value = kvp.Key.Email;
                    row.Cells[2].Value = kvp.Value;
                    col.Add(row);
                }

                uxGroupName.Text   = userGroup.Name;
                uxOwner.Text       = userGroup.Owner.Name;
                uxDescription.Text = userGroup.Description;
            }
            else
            {
                uxOwner.Text = user.Name;
            }
        }
Beispiel #13
0
        private void ResourceGroupCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Grab the fields we'll want to pull
            MSProject.PjField colorFieldId =
                Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceColorField, MSProject.PjFieldType.pjResource);
            MSProject.PjField borderColorFieldId =
                Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceBorderColorField, MSProject.PjFieldType.pjResource);
            // Initialize the grid with the existing data
            String group = this.ResourceGroupCombo.SelectedItem.ToString();
            DataGridViewRowCollection rows = this.ResourceColorGrid.Rows;

            rows.Clear();
            int row = 0;

            foreach (MSProject.Resource res in Globals.ThisAddIn.Application.ActiveProject.Resources)
            {
                if (res.Group != group)
                {
                    continue;
                }
                rows.Add(res.Name);
                rows[row].Cells[ColorColumn.Index].Style.BackColor =
                    Globals.ThisAddIn.stringToColor(res.GetField(colorFieldId), Color.White);
                rows[row].Cells[ColorColumn.Index].Style.SelectionBackColor =
                    Globals.ThisAddIn.stringToColor(res.GetField(colorFieldId), Color.White);
                rows[row].Cells[BorderColorColumn.Index].Style.BackColor =
                    Globals.ThisAddIn.stringToColor(res.GetField(borderColorFieldId), Color.Black);
                rows[row].Cells[BorderColorColumn.Index].Style.SelectionBackColor =
                    Globals.ThisAddIn.stringToColor(res.GetField(borderColorFieldId), Color.Black);
                row++;
            }
        }
Beispiel #14
0
        /// <summary>
        /// Update the panel.
        /// </summary>
        public new void Update()
        {
            Thread t = new Thread(new ParameterizedThreadStart(
                                      delegate
            {
                DataGridViewRowCollection rows = FilesFoundGrid.Rows;

                // clear the dataGrid
                this.Invoke(new MethodInvoker(delegate { rows.Clear(); }));

                if (this.m_lastSearchedFile != null)
                {
                    List <Lists.FilesFoundList.File> list = Lists.FilesFoundList.SearchFileByText(m_lastSearchedFile);

                    for (int i = 0; i < list.Count; i++)
                    {
                        this.Invoke(new MethodInvoker(delegate { rows.Add(list[i].Name, Utilities.Converterer.AutoConvertSizeFromByte(list[i].Size), list[i].SHA1); }));
                    }
                }
            }
                                      ));

            t.Name         = "UpdateFileSearchPanel";
            t.IsBackground = true;
            t.Start();
        }
        /// <summary>
        ///   Fills left column of columns assignment data grid view
        ///   with entries of Ogama aoi table database columns
        /// </summary>
        private void FillLeftAssignColumn()
        {
            DataGridViewRowCollection rows = this.dGVAssignments.Rows;

            rows.Clear();
            string[] row0 = { "SubjectName", string.Empty };
            string[] row1 = { "TrialSequence", string.Empty };
            string[] row2 = { "TrialID", string.Empty };
            string[] row3 = { "TrialImage", string.Empty };
            string[] row4 = { "CountInTrial", string.Empty };
            string[] row5 = { "StartTime", string.Empty };
            string[] row6 = { "EndTime", string.Empty };
            string[] row7 = { "Length", string.Empty };
            string[] row8 = { "PosX", string.Empty };
            string[] row9 = { "PosY", string.Empty };
            rows.Add(row0);
            rows.Add(row1);
            rows.Add(row2);
            rows.Add(row3);
            rows.Add(row4);
            rows.Add(row5);
            rows.Add(row6);
            rows.Add(row7);
            rows.Add(row8);
            rows.Add(row9);
        }
Beispiel #16
0
 private void button1_Click(object sender, EventArgs e)
 {
     BandGridRows.Clear();
     foreach (XElement gig in doc.Element("Event_Guide").Elements("Gig"))
     {
         searchXMLForBandMember(gig);
     }
 }
        /// <summary>
        /// Populates a DataGridView's rows with details of all users, with 1 user per row.
        /// </summary>
        /// <param name="rows"></param>
        public static void PopulateDataGridView(DataGridViewRowCollection rows)
        {
            rows.Clear();

            foreach (User user in _userDatabase.UserList)
            {
                rows.Add(user.ID, user.FullName, user.Role, user.UserName, user.Password);
            }
        }
        PopulateSourceColumnsDataGridView()
        {
            AssertValid();

            DataGridViewRowCollection oDataGridRows = dgvSourceColumns.Rows;

            oDataGridRows.Clear();

            // Attempt to get the non-empty range of the active worksheet of the
            // selected source workbook.

            Range oNonEmptyRange;

            if (!TryGetSourceWorkbookNonEmptyRange(out oNonEmptyRange))
            {
                return;
            }

            Boolean bSourceColumnsHaveHeaders =
                cbxSourceColumnsHaveHeaders.Checked;

            // Get the first row and column of the non-empty range.

            Range oFirstRow = oNonEmptyRange.get_Resize(1, Missing.Value);
            Range oColumn   = oNonEmptyRange.get_Resize(Missing.Value, 1);

            Object [,] oFirstRowValues = ExcelUtil.GetRangeValues(oFirstRow);
            Int32 iNonEmptyColumns = oNonEmptyRange.Columns.Count;
            Int32 iColumnOneBased  = oColumn.Column;

            for (Int32 i = 1; i <= iNonEmptyColumns; i++, iColumnOneBased++)
            {
                String sColumnLetter = ExcelUtil.GetColumnLetter(
                    ExcelUtil.GetRangeAddress((Range)oColumn.Cells[1, 1]));

                // Get the value of the column's first cell, if there is one.

                String sFirstCellValue;

                if (!ExcelUtil.TryGetNonEmptyStringFromCell(oFirstRowValues, 1,
                                                            i, out sFirstCellValue))
                {
                    sFirstCellValue = null;
                }

                String sItemText = GetSourceColumnItemText(sFirstCellValue,
                                                           sColumnLetter, bSourceColumnsHaveHeaders);

                oDataGridRows.Add(new ObjectWithText(iColumnOneBased, sItemText),
                                  false, false, false);

                // Move to the next column.

                oColumn = oColumn.get_Offset(0, 1);
            }
        }
        // this event handler will clear out the results from
        // the FileSystemWatcher
        private void onClear(object sender, EventArgs e)
        {
            var choice = MessageBox.Show("Do you really want to clear the table?", "Drive Watcher", MessageBoxButtons.YesNo);

            if (choice == DialogResult.Yes)
            {
                DataGridViewRowCollection coll = this.dataGrid.Rows;
                coll.Clear();
            }
        }
Beispiel #20
0
        private string cartSplash(Profile profile, DataGridViewCell cell, DataGridViewRowCollection rows)
        {
            cell.Value = "Waiting for HMAC...(check settings page)";
            C_Proxy   proxy   = null;
            C_Session session = null;

            if (!proxy_running && profile.splashmode == 1)
            {
                Task.Run(() => runProxyList(profile, rows));

                while (proxylist.FirstOrDefault(s => proxy.passed) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                cell.Value = "GOT HMAC!";

                proxy = proxylist.FirstOrDefault(s => proxy.passed && s.hmac_cookie.expiry > DateTime.Now);
            }
            else if (!sessions_running && profile.splashmode == 2)
            {
                for (int i = 0; i < Properties.Settings.Default.sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = false
                    });
                }
                for (int i = 0; i < Properties.Settings.Default.r_sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = true
                    });
                }

                rows.Clear();

                foreach (C_Session s in sessionlist)
                {
                    rows.Add(new string[] { "session", s.refresh.ToString(), "False", null, null, null, null, null, null });
                }

                Task.Run(() => runSessionList(profile, rows));

                while (sessionlist.FirstOrDefault(x => x.passed == true) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                cell.Value = "GOT HMAC!";

                session = sessionlist.FirstOrDefault(s => s.passed && s.hmac_cookie.expiry > DateTime.Now);
            }

            return(cartNoSplash(profile, cell, proxy, session));
        }
        public void Populate(string[][] data)
        {
            DataGridViewRowCollection rows = this.dataGrid.Rows;

            rows.Clear();

            foreach (string [] d in data)
            {
                rows.Add(d[0], d[1]);
                int idx = rows.GetLastRow(DataGridViewElementStates.None);
                rows[idx].Cells[2].Tag = d[2];
            }
        }
Beispiel #22
0
        private void refreshDataGridView()
        {
            rows.Clear();
            int       rowIndex       = 0;
            ArrayList hostCollection = monitorSystem.currentHosts();

            foreach (Host host in hostCollection)
            {
                rows.Add(new Object[] { host.name(), host.ip(), host.status() });
                Color statusColor = host.status() == "Up" ? Color.Green : Color.Red;
                dataGridView1.Rows[rowIndex].Cells[2].Style.BackColor = statusColor;
                rowIndex++;
            }
        }
 public void LoadControlExample()
 {
     rows.Clear();
     AddRow(1, 100, 80, 50, 60);
     AddRow(2, 90, 70, 60, 50);
     AddRow(3, 80, 50, 40, 40);
     AddRow(4, 100, 60, 70, 30);
     AddRow(5, 70, 80, 80, 70);
     AddRow(6, 70, 60, 80, 50);
     AddRow(7, 90, 40, 70, 60);
     AddRow(8, 80, 50, 60, 40);
     AddRow(9, 80, 70, 30, 70);
     AddRow(10, 60, 80, 40, 50);
 }
Beispiel #24
0
        public void guestMode_Cart(Profile profile, DataGridViewRowCollection rows)
        {
            C_Proxy   proxy   = null;
            C_Session session = null;

            if (!proxy_running && profile.splashmode == 1)
            {
                Task.Run(() => runProxyList(profile, rows));

                while (proxylist.FirstOrDefault(s => proxy.passed) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                proxy = proxylist.FirstOrDefault(s => proxy.passed && s.hmac_cookie.expiry > DateTime.Now);
                MessageBox.Show("proxy_" + proxy.index.ToString() + " : on product page! Right click on the session and show the window in order to purchase the shoe!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (!sessions_running && profile.splashmode == 2)
            {
                for (int i = 0; i < Properties.Settings.Default.sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = false
                    });
                }
                for (int i = 0; i < Properties.Settings.Default.r_sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = true
                    });
                }

                rows.Clear();

                foreach (C_Session s in sessionlist)
                {
                    rows.Add(new string[] { "session_" + s.index.ToString(), s.refresh.ToString(), "False", null, null, null, null, null, null });
                }

                Task.Run(() => runSessionList(profile, rows));

                while (sessionlist.FirstOrDefault(x => x.passed == true) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                session = sessionlist.FirstOrDefault(s => s.passed == true);
                MessageBox.Show("session_" + session.index.ToString() + " : on product page! Right click on the session and show the window in order to purchase the shoe!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        //Methods
        private void displayBandInfo()
        {
            //CLear data grid view rows
            dgvRows.Clear();

            // Get the root element
            XElement evGuide = bandDoc.Element("Event_Guide");

            foreach (XElement gig in evGuide.Elements("Gig"))
            {
                string bandName = gig.Element("Band").Element("Name").Value;
                string genre    = gig.Element("Band").Element("Genre").Value;
                string venue    = gig.Element("Venue").Value;
                string date     = gig.Element("Date").Attribute("day").Value + "/"
                                  + gig.Element("Date").Attribute("month").Value + "/"
                                  + gig.Element("Date").Attribute("year").Value;
                string time = gig.Element("Time").Value;

                String[] newRowValue = { bandName, genre, venue, date, time };

                // Add the string array to the row
                dgvRows.Add(newRowValue);
            }
        }
Beispiel #26
0
        private void btnScanAP_Click(object sender, EventArgs e)
        {
            //fix:  It should works even if wlaninterface doesn't connect to AP
            var client = new WlanClient();

            WlanClient.WlanInterface[] apCount = client.Interfaces;
            DataGridViewRowCollection  rows    = this.dataGridView1.Rows; //define DataGridViewRowCollection rows for adding new APs

            rows.Clear();                                                 //fix:  Clear() previous records of AP after press down button second time.


            //fix: 2 string concatenate to form a new one to perform DataGridViewCollection.add().
            foreach (WlanClient.WlanInterface APC in apCount)                            //loop all element returned by client.Interfaces with type WlanClient.WlanInterface
            {
                Wlan.WlanBssEntry[]         bssNetworks       = APC.GetNetworkBssList(); //exception occurs when WlanInterface doesn't connect to AP
                Wlan.WlanAvailableNetwork[] availableNetworks = APC.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);

                foreach (Wlan.WlanBssEntry network in bssNetworks)
                {
                    int    rssi    = network.rssi;
                    byte[] macAddr = network.dot11Bssid;

                    string tMac = "";
                    for (int i = 0; i < macAddr.Length; i++)
                    {
                        tMac += macAddr[i].ToString("x2").PadLeft(2, '0').ToUpper();
                    }

                    /*
                     * for (int i = 0; i < availableNetworks.Length; i++)
                     * {
                     *  string AuthMech = availableNetworks[i].dot11DefaultAuthAlgorithm.ToString();
                     *  string EncrypMech = availableNetworks[i].dot11DefaultCipherAlgorithm.ToString();
                     *  string[] MechString = { "", "", "", "", AuthMech, EncrypMech };
                     *  rows.Add(MechString);
                     *
                     * }
                     */
                    //string[] row1 = { "hpinc", "3168", "-50", "36", "2F" }; for test only
                    string[] APstring = { System.Text.ASCIIEncoding.ASCII.GetString(network.dot11Ssid.SSID).ToString(), network.rssi.ToString(), APC.Channel.ToString(), tMac, };
                    //DataGridViewRowCollection rows = this.dataGridView1.Rows;
                    rows.Add(APstring);


                    //APC.Scan();
                }
            }
        }
        private void loadSettings()
        {
            DataGridViewRowCollection rows = settingsTable.Rows;

            rows.Clear();
            SettingsPropertyValueCollection settings = Properties.Settings.Default.PropertyValues;

            foreach (SettingsPropertyValue setting in settings)
            {
                string   name     = setting.Name;
                object   value    = setting.PropertyValue;
                string   typeName = value.GetType().Name;
                object[] row      = new object[] { name, typeName, value };
                settingsTable.Rows.Add(row);
            }
        }
Beispiel #28
0
        private void 輸出當月員工時數表ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult Dr = MessageBox.Show("是否要輸出上個月員工時數表 ?", "詢問", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (Dr.Equals(DialogResult.OK))
            {
                SaveFileDialog saveDia = new SaveFileDialog();
                saveDia.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                saveDia.FileName         = (DateTime.Now.Month - 1).ToString() + "月員工薪資與上班報表";
                saveDia.Filter           = "*.xlsx|*.xlsx";
                if (saveDia.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                excel.Application xls = null;
                try
                {
                    xls = new excel.Application();
                    excel.Workbook            book  = xls.Workbooks.Add();
                    excel.Worksheet           sheet = (excel.Worksheet)book.Worksheets.Item[1];
                    DataGridViewRowCollection DGVC  = dataGridView_check.Rows;
                    DGVC.Clear();
                    search_single_staff(sheet);//搜尋人
                    book.SaveAs(saveDia.FileName);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    dataGridView_check.Enabled = false;
                    comboBox_Employee.Text     = "選擇員工";
                    xls.Quit();
                }



                //這邊近來Input_Employee_2combo 不用清掉 因為就是要上面Form inital的值

                //搜尋當年當月的所以上班時數
                //計算小時
                //存入EXCEL
                //
            }
        }
Beispiel #29
0
        public void setDefaultProject()
        {
            int row;
            // Setup the dialog
            ShotgunProjectsForm       form = new ShotgunProjectsForm();
            DataGridViewRowCollection rows = form.projectsGrid.Rows;

            rows.Clear();
            dynamic   projects    = _pythonModule.GetVariable("projects")();
            int       selectedRow = -1;
            Hashtable rowToId     = new Hashtable();
            Hashtable rowToInst   = new Hashtable();
            Hashtable rowToName   = new Hashtable();

            foreach (dynamic project in projects)
            {
                if (project["name"] == "Template Project")
                {
                    continue;
                }
                row = rows.Add(project["name"]);
                if (project["id"] == Properties.Settings.Default.ShotgunProject)
                {
                    selectedRow = row;
                }
                rowToId[row]   = project["id"];
                rowToInst[row] = project["inst"]["name"];
                rowToName[row] = project["name"];
            }
            if (selectedRow != -1)
            {
                form.projectsGrid.CurrentCell = rows[selectedRow].Cells[0];
            }
            // Show the dialog
            System.Windows.Forms.DialogResult result = form.ShowDialog();
            if (result == DialogResult.Cancel)
            {
                return;
            }
            row = form.projectsGrid.SelectedRows[0].Index;
            Properties.Settings.Default.ShotgunProject     = (int)rowToId[row];
            Properties.Settings.Default.ShotgunInstance    = (String)rowToInst[row];
            Properties.Settings.Default.ShotgunProjectName = (String)rowToName[row];
            Properties.Settings.Default.Save();
            MessageBox.Show("Project set to \"" + (String)rowToName[row] + "\".");
        }
        private void PopulateTable()
        {
            dataGridView.CellValueChanged -= CellValueChangedHandler;

            DataGridViewRowCollection rows = dataGridView.Rows;

            rows.Clear();
            for (int i = 0; i < enemies.Count; i++)
            {
                UpdateRow(rows.Add());
            }

            UpdateRowHeaders();
            dataGridView.AutoResizeColumns();

            dataGridView.CellValueChanged += CellValueChangedHandler;
        }