private void initialiseDataGridView()
        {
            try {
                log.Info("Opening timezone mapping window.");

                log.Fine("Building default system timezone dropdowns.");
                System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> sysTZ = TimeZoneInfo.GetSystemTimeZones();
                Dictionary <String, String> cbTz = new Dictionary <String, String>();
                sysTZ.ToList().ForEach(tzi => cbTz.Add(tzi.Id, tzi.DisplayName));

                //Replace existing TZ column with custom dropdown
                DataGridViewComboBoxColumn col = tzGridView.Columns[1] as DataGridViewComboBoxColumn;
                col.DataSource    = new BindingSource(cbTz, null); //bs;
                col.DisplayMember = "Value";
                col.ValueMember   = "Key";
                col.DisplayStyle  = DataGridViewComboBoxDisplayStyle.ComboBox;

                tzGridView.Columns.RemoveAt(1);
                tzGridView.Columns.Add(col);

                loadConfig();
            } catch (System.Exception ex) {
                OGCSexception.Analyse(ex);
            }
        }
Example #2
0
        public static ServerModeOrderDescriptor[] GetSortExpression(
            System.Collections.ObjectModel.ReadOnlyCollection <GridViewColumnState> columns,
            System.Collections.ObjectModel.ReadOnlyCollection <GridViewColumnState> defaultSort)
        {
            ServerModeOrderDescriptor[] orderDescriptors = null;

            if (columns.Any() && defaultSort.Any())
            {
                var joind = columns.ToList();
                joind.AddRange(defaultSort);
                orderDescriptors =
                    joind.Select(
                        c =>
                        new ServerModeOrderDescriptor(new OperandProperty(c.FieldName),
                                                      c.SortOrder == ColumnSortOrder.Descending)).ToArray();
            }
            else if (columns.Any())
            {
                orderDescriptors =
                    columns.Select(
                        c =>
                        new ServerModeOrderDescriptor(new OperandProperty(c.FieldName),
                                                      c.SortOrder == ColumnSortOrder.Descending)).ToArray();
            }
            else if (defaultSort.Any())
            {
                orderDescriptors =
                    defaultSort.Select(
                        c =>
                        new ServerModeOrderDescriptor(new OperandProperty(c.FieldName),
                                                      c.SortOrder == ColumnSortOrder.Descending)).ToArray();
            }
            return(orderDescriptors);
        }
        static void Main(string[] args)
        {
            string project = "http://xxx.xxx.xxx.xxx:8080/tfs";
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(project));
            var tps = tpc.GetService <VersionControlServer>();
            var ttt = tps.GetTeamProject("ProjectName");
            ISecurityService securityService = tpc.GetService <ISecurityService>();

            System.Collections.ObjectModel.ReadOnlyCollection <SecurityNamespace> securityNamespaces = securityService.GetSecurityNamespaces();
            IGroupSecurityService gss             = tpc.GetService <IGroupSecurityService>();
            Identity                 SIDS         = gss.ReadIdentity(SearchFactor.AccountName, "GroupName", QueryMembership.Expanded);//GourName format: [ProjectName]\\GourpName
            IdentityDescriptor       id           = new IdentityDescriptor("Microsoft.TeamFoundation.Identity", SIDS.Sid);
            List <SecurityNamespace> securityList = securityNamespaces.ToList <SecurityNamespace>();
            string securityToken;

            foreach (SecurityNamespace sn in securityList)
            {
                if (sn.Description.DisplayName == "Project")
                {
                    securityToken = "$PROJECT:" + ttt.ArtifactUri.AbsoluteUri;
                    sn.SetPermissions(securityToken, id, 115, 0, true);
                }
            }
        }
Example #4
0
        private void Toolbox_Load(object sender, EventArgs e)
        {
            //gathering working directory...
            if (Environment.CurrentDirectory.Contains(@"\Debug"))
            {//if in debug mode
                path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location).TrimEnd(@"\bin\Debug".ToCharArray()) + @"\Resources\Additions";
            }
            else
            {
                path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\Resources\Additions";
            }

            //loading images and icons...
            this.Icon = new Icon(path + @"\..\SOLICO.ico");
            clearTextBtn.BackgroundImage = Image.FromFile(path + @"\..\clear.ico");
            ReloadIBtn.BackgroundImage   = Image.FromFile(path + @"\..\refresh.ico");
            ReloadDBtn.BackgroundImage   = Image.FromFile(path + @"\..\refresh.ico");
            clearDwnBtn.BackgroundImage  = Image.FromFile(path + @"\..\clear.ico");

            //setting start opacity...
            if (int.TryParse((Opacity * 100).ToString(), out int s))
            {
                sldBrOpacity.Value = s;//set opacity on load
            }

            //searching the Resources>Additions folder for installed additions...
            updateInstalledAddLstBx();

            //checking if any additions failed to install & cleanup...
            string[] names = new string[0];
            ushort   zn    = 0;
            ushort   dn    = 0;

            System.Collections.ObjectModel.ReadOnlyCollection <string> adds  = Microsoft.VisualBasic.FileIO.FileSystem.GetDirectories(path);
            System.Collections.ObjectModel.ReadOnlyCollection <string> files = Microsoft.VisualBasic.FileIO.FileSystem.GetFiles(path);
            System.Collections.Generic.List <string> all = new System.Collections.Generic.List <string>();
            all = adds.ToList();

            foreach (string file in files)
            {
                all.Add(file);
            }

            foreach (string add in all)
            {
                string[] pathSplit = add.Split(Convert.ToChar(92));
                if (pathSplit[pathSplit.Length - 1] != ".gitplzdontignoreme")
                {
                    if (File.Exists(add))
                    {
                        File.Delete(add);
                        zn++;
                        Array.Resize(ref names, names.Length + 1);
                        names[names.Length - 1] = pathSplit[pathSplit.Length - 1].Remove(pathSplit[pathSplit.Length - 1].Length - 4, 4);
                    }

                    if (pathSplit[pathSplit.Length - 1].Contains("-"))
                    {
                        Directory.Delete(add, true);
                        dn++;

                        if (names.Length != 0)
                        {
                            if (names[names.Length - 1] != pathSplit[pathSplit.Length - 1])
                            {
                                Array.Resize(ref names, names.Length + 1);
                                names[names.Length - 1] = pathSplit[pathSplit.Length - 1].Replace('-', ' ');
                            }
                        }
                        else
                        {
                            Array.Resize(ref names, names.Length + 1);
                            names[names.Length - 1] = pathSplit[pathSplit.Length - 1].Replace('-', ' ');
                        }
                    }
                }
            }

            if (names.Length == 1)
            {
                MessageBox.Show("One addition; " + names[0] + ", did not complete their" +
                                " installation process, as such it was removed and must be re-downloaded.");
            }
            else if (names.Length > 0)
            {
                string text = "Multiple additions; ";

                //place each additions' name in the message
                foreach (string name in names)
                {
                    if (name != names[names.Length - 2])
                    {//if not at the end
                        text += name + ", ";
                    }
                    else
                    {
                        text += name + " and ";
                    }
                }

                MessageBox.Show(text + "did not complete their installation processes, as " +
                                "such they where removed and must be re-downloaded.");

                //re-searching the Resources>Additions folder for installed additions...
                updateInstalledAddLstBx();
            }

            //getting Y location of the "manage additions" button for animation...
            org = AddBtn.Location.Y;
        }