コード例 #1
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("BlockCapsule \n[ ");
            builder.Append("hash=").Append(Id).Append("\n");
            builder.Append("number=").Append(Num).Append("\n");
            builder.Append("parentId=").Append(ParentId.ToString()).Append("\n");
            builder.Append("witness address=").Append(WitnessAddress.ToByteArray().ToHexString()).Append("\n");

            builder.Append("generated by myself=").Append(generate_by_myself).Append("\n");
            builder.Append("generate time=").Append(Timestamp.ToDateTime().ToLocalTime().ToString(@"dd\\:hh\\:mm")).Append("\n");

            if (transactions.Count > 0)
            {
                builder.Append("merkle root=").Append(MerkleRoot).Append("\n");
                builder.Append("account root=").Append(AccountRoot).Append("\n");
                builder.Append("txs size=").Append(this.transactions.Count).Append("\n");
            }
            else
            {
                builder.Append("txs are empty\n");
            }
            builder.Append("]");
            return(builder.ToString());
        }
コード例 #2
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "namespaceid": // Int
                return(NamespaceId.ToString(strFormat, formatProvider));

            case "parentid": // Int
                return(ParentId.ToString(strFormat, formatProvider));

            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "namespacename": // NVarChar
                return(PropertyAccess.FormatString(NamespaceName, strFormat));

            case "lastqualifier": // NVarChar
                return(PropertyAccess.FormatString(LastQualifier, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
コード例 #3
0
        public override string ToString()
        {
            string parentIdStr    = ParentId?.ToString() ?? "Null";
            string parentValueStr = ParentValue?.ToString() ?? "Null";

            return($"Id: {Id}, ParentId: {parentIdStr}, Level: {Level}, " + base.ToString() + $", ParentValue: {parentValueStr}");
        }
コード例 #4
0
ファイル: GroupNode.cs プロジェクト: runnane/PrtgAPI
        public override GroupItem GetTestItem()
        {
            if (Id == -1)
            {
                throw new InvalidOperationException("Id was not initialized");
            }

            if (ParentId == -1)
            {
                throw new InvalidOperationException("ParentId was not initialized");
            }

            return(new GroupItem(
                       probe: GetProbe(this).Name,
                       devicenum: TotalDevices.ToString(),
                       devicenumRaw: TotalDevices.ToString(),
                       groupnum: TotalGroups.ToString(),
                       groupnumRaw: TotalGroups.ToString(),
                       totalsens: TotalSensors.ToString(),
                       totalsensRaw: TotalSensors.ToString(),
                       name: Name,
                       objid: Id.ToString(),
                       parentId: ParentId.ToString()
                       ));
        }
コード例 #5
0
        /// <summary> Stops tracking the activity and emits a telemetry event. </summary>
        public void Dispose()
        {
            _stopwatch.Stop();

            if (NuGetTelemetryService != null && TelemetryEvent != null)
            {
                var endTime = DateTime.UtcNow;
                TelemetryEvent["StartTime"] = _startTime.ToString("O");
                TelemetryEvent["EndTime"]   = endTime.ToString("O");
                TelemetryEvent["Duration"]  = _stopwatch.Elapsed.TotalSeconds;

                if (ParentId != Guid.Empty)
                {
                    TelemetryEvent[nameof(ParentId)] = ParentId.ToString();
                }

                if (OperationId != Guid.Empty)
                {
                    TelemetryEvent[nameof(OperationId)] = OperationId.ToString();
                }

                foreach (var interval in _intervalList)
                {
                    TelemetryEvent[interval.Item1] = interval.Item2.TotalSeconds;
                }

                NuGetTelemetryService.EmitTelemetryEvent(TelemetryEvent);
            }

            _telemetryActivity?.Dispose();
        }
コード例 #6
0
        /// <summary>
        /// Returns a System.String containing an Xml representation of the current object
        /// </summary>
        /// <returns></returns>
        public string ToXml()
        {
            string pictureDataBase64Encoded;

            if (PictureUpdated && PictureData != null && PictureData.Length > 0)
            {
                pictureDataBase64Encoded = Convert.ToBase64String(PictureData);
            }
            else
            {
                pictureDataBase64Encoded = null;
            }

            var xml = new XElement(_objectName,
                                   Id != 0 ? new XElement("id", Id.ToString()) : null,
                                   ParentId != 0 ? new XElement("parent_id", ParentId.ToString()) : null,
                                   Name != null ? new XElement("name_nl", Name) : null,
                                   SortOrder != 0 ? new XElement("sort_order", SortOrder.ToString()) : null,
                                   PictureFilename != null ? new XElement("picture_file_name", PictureFilename) : null,
                                   pictureDataBase64Encoded != null ? new XElement("picture_data", pictureDataBase64Encoded) : null,
                                   TargetUrl != null ? new XElement("target_url", TargetUrl) : null,
                                   Test == true ? new XElement("test", Test.ToInt()) : null,
                                   !CreatedDttm.IsNullOrDefault() ? new XElement("created", ((DateTime)CreatedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null,
                                   !UpdatedDttm.IsNullOrDefault() ? new XElement("updated", ((DateTime)UpdatedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null,
                                   !DeletedDttm.IsNullOrDefault() ? new XElement("deleted", ((DateTime)DeletedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null
                                   );

            return(xml.ToString());
        }
コード例 #7
0
        public void AddAsChild(IUnitOfWork db)
        {
            var child = new FeatureValue
            {
                FeatureId     = 13,
                Value         = Name,
                ExtendedValue = ParentId.ToString(),
                ExtendedData  = JsonHelper.Serialize <FeatureExAttributes>(new FeatureExAttributes()
                {
                    WMCharacter          = WMCharacter,
                    WMCharacterPermanent = WMCharacterPermanent,
                })
            };

            db.FeatureValues.Add(child);
            db.Commit();
            Id = child.Id;
        }
コード例 #8
0
        public string ToQueryString()
        {
            string returnString = "(";

            returnString += "'" + ParentId.ToString() + "', ";                                  // 1
            returnString += "'" + Title + "', ";                                                // 2
            returnString += "'" + ShortDescription + "', ";                                     // 3
            returnString += "'" + DetailedDescription + "', ";                                  // 4
            returnString += "'" + ParentProject.ToString() + "', ";                             // 5
            returnString += "'" + DateCreated.ToShortDateString() + "', ";                      // 6
            returnString += "'" + CreatedBy.ToString() + "', ";                                 // 7
            returnString += "'" + DateCompleted.ToShortDateString() + "', ";                    // 8
            returnString += "'" + CompletedBy.ToString() + "', ";                               // 9
            returnString += "'" + DeadLine.ToShortDateString() + "', ";                         //10
            returnString += "'" + Status + "'";                                                 //11

            return(returnString += ")");
        }         // End of ToQueryString()
コード例 #9
0
ファイル: SensorNode.cs プロジェクト: runnane/PrtgAPI
        public override SensorItem GetTestItem()
        {
            if (Id == -1)
            {
                throw new InvalidOperationException("Id was not initialized");
            }

            if (ParentId == -1)
            {
                throw new InvalidOperationException("ParentId was not initialized");
            }

            return(new SensorItem(
                       probe: GetProbe(this).Name,
                       group: GetGroup(this).Name,
                       name: Name,
                       objid: Id.ToString(),
                       parentId: ParentId.ToString()
                       ));
        }
コード例 #10
0
ファイル: YamlItem.cs プロジェクト: sebastiantecsi/Rainbow
        public virtual void WriteYaml(YamlWriter writer)
        {
            writer.WriteMap("ID", Id.ToString("D"));
            writer.WriteMap("Parent", ParentId.ToString("D"));
            writer.WriteMap("Template", TemplateId.ToString("D"));
            writer.WriteMap("Path", Path);
            writer.WriteMap("DB", DatabaseName);

            if (BranchId != default(Guid))
            {
                writer.WriteMap("BranchID", BranchId.ToString());
            }

            if (SharedFields.Any())
            {
                writer.WriteMap("SharedFields");
                writer.IncreaseIndent();

                foreach (var field in SharedFields)
                {
                    field.WriteYaml(writer);
                }

                writer.DecreaseIndent();
            }

            if (Languages.Any())
            {
                writer.WriteMap("Languages");
                writer.IncreaseIndent();

                foreach (var language in Languages)
                {
                    language.WriteYaml(writer);
                }

                writer.DecreaseIndent();
            }
        }
コード例 #11
0
        public override bool Rename(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            Drive.ValidateName(name);

            if (string.Compare(name, Name, StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(false);
            }

            if (FullPath == null || !Directory.Exists(FullPath))
            {
                return(false);
            }

            Directory.Move(FullPath, Path.Combine(Path.GetDirectoryName(FullPath), Id.ToString("N") + "." + ParentId.ToString("N") + "." + name));
            return(true);
        }
コード例 #12
0
 /// <nodoc/>
 public override string ToString()
 {
     return
         ($"{Id}\t{ParentId?.ToString() ?? string.Empty}\t{EvaluationPassDescription ?? string.Empty}\t{File ?? string.Empty}\t{Line?.ToString() ?? string.Empty}\t{ElementName ?? string.Empty}\tDescription:{ElementDescription}\t{this.EvaluationPassDescription}");
 }
コード例 #13
0
    // Get population from MYSQL database
    public static IEnumerator GetPopulation(int numLSystems, Action <LSystemWrapper[]> done)
    {
Request:
        UnityWebRequest request = new UnityWebRequest(getPopulationURL + "?Algorithm=" + algorithm.ToString() + "&NumLSystems=" + numLSystems +
                                                      (ParentId != null ? "&ParentId=" + ParentId?.ToString() : "") +
                                                      ((ParentId.HasValue && ParentId.Value == PopulationId) || (!ParentId.HasValue && PopulationId != null) ? "&PopulationId=" + PopulationId : ""));

        request.downloadHandler = new DownloadHandlerBuffer();
        Debug.Log("Retreiving Population: " + request.url);
        yield return(request.SendWebRequest());

        LSystemWrapper[] retreivedLSystems = null;
        if (request.error != null)
        {
            Debug.LogError("There was an error retreiving the population: " + request.error);
        }
        else
        {
            try
            {
                string response = request.downloadHandler.text;
                Debug.Log(response);
                var JSONObj = JsonUtility.FromJson <PostLSystemHelper>(response);
                if (JSONObj == null)
                {
                    goto Request;
                }
                PopulationId = JSONObj.PopulationId;
                hash         = JSONObj.Hash;

                //if (numLSystems > 0 && (JSONObj.LSystems == null || JSONObj.LSystems.Length != numLSystems))
                //{
                //    goto Request;
                //}
                retreivedLSystems = JSONObj.LSystems;
            }
            catch
            {
                goto Request;
            }
        }

        done(retreivedLSystems);
    }
コード例 #14
0
        /// <summary>
        /// Binds the drop down list.
        /// </summary>
        protected void BindDropDownList()
        {
            if (IsNew)
            {
                using (IDataReader items = mc.MenuItem.LoadByMenuId(MenuId, LanguageId))
                {
                    ParentMenuItem.Items.Clear();
                    while (items.Read())
                    {
                        ListItem newItem = new ListItem(Offset((int)items["OutlineLevel"]) + items["Text"].ToString(), items["MenuItemId"].ToString());
                        ParentMenuItem.Items.Insert(ParentMenuItem.Items.Count, newItem);
                    }
                    items.Close();
                }
                using (IDataReader root = Mediachase.Cms.MenuItem.LoadMenuRoot(MenuId))
                {
                    if (root.Read())
                    {
                        ListItem newItem = new ListItem(root["Text"].ToString(), root["MenuItemId"].ToString());
                        ParentMenuItem.Items.Insert(0, newItem);
                    }
                    root.Close();
                }


                //ParentMenuItem.SelectedValue = MenuItemId.ToString();
                ManagementHelper.SelectListItem(ParentMenuItem, MenuItemId);
                ParentMenuItem.DataBind();
            }
            else
            {
                //gets all childs and current node
                ArrayList child = new ArrayList();
                child.Add(MenuItemId);
                using (IDataReader items = mc.MenuItem.LoadAllChild(MenuItemId))
                {
                    while (items.Read())
                    {
                        child.Add((int)items["MenuItemId"]);
                    }

                    items.Close();
                }

                using (IDataReader items = mc.MenuItem.LoadByMenuId(MenuId, LanguageId))
                {
                    ParentMenuItem.Items.Clear();
                    while (items.Read())
                    {
                        if (!child.Contains((int)items["MenuItemId"]))
                        {
                            ListItem newItem = new ListItem(Offset((int)items["OutlineLevel"]) + items["Text"].ToString(), items["MenuItemId"].ToString());
                            ParentMenuItem.Items.Insert(ParentMenuItem.Items.Count, newItem);
                        }
                    }
                    items.Close();
                }
                using (IDataReader root = Mediachase.Cms.MenuItem.LoadMenuRoot(MenuId))
                {
                    if (root.Read())
                    {
                        ListItem newItem = new ListItem(root["Text"].ToString(), root["MenuItemId"].ToString());
                        ParentMenuItem.Items.Insert(0, newItem);
                    }
                    root.Close();
                }

                if (ParentId != -1)
                {
                    ParentMenuItem.SelectedValue = ParentId.ToString();
                }


                ParentMenuItem.DataBind();
            }
        }
コード例 #15
0
ファイル: Node.cs プロジェクト: lulzzz/daipan
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(GetType().Name + " |Activity Id: " + Id.ToString() + " |ParentActivityId:" + ParentId.ToString());
 }
コード例 #16
0
        public XmlNode ToXml(XmlDocument xmlDocument)
        {
            XmlNode topicXml = xmlDocument.CreateElement("topic");

            topicXml.AppendChild(umbraco.xmlHelper.addTextNode(xmlDocument, "title", Title));
            topicXml.AppendChild(umbraco.xmlHelper.addCDataNode(xmlDocument, "body", Body));

            topicXml.AppendChild(umbraco.xmlHelper.addTextNode(xmlDocument, "urlname", UrlName));

            // tags
            XmlNode tags = umbraco.xmlHelper.addTextNode(xmlDocument, "tags", "");

            foreach (var tag in Tags)
            {
                var tagNode = umbraco.xmlHelper.addTextNode(xmlDocument, "tag", tag.Name);
                tagNode.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "id", tag.Id.ToString()));
                tagNode.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "weight", tag.Weight.ToString()));
                tags.AppendChild(tagNode);
                tags.AppendChild(tagNode);
            }
            topicXml.AppendChild(tags);

            if (topicXml.Attributes != null)
            {
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "id", Id.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "parentId", ParentId.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "memberId", MemberId.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "latestReplyAuthor", LatestReplyAuthor.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "created", Created.ToString(CultureInfo.InvariantCulture)));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "updated", Updated.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "locked", Locked.ToString()));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "replies", Replies.ToString(CultureInfo.InvariantCulture)));

                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "answer", Answer.ToString()));
                topicXml.Attributes.Append(umbraco.xmlHelper.addAttribute(xmlDocument, "score", Score.ToString()));
            }

            return(topicXml);
        }
コード例 #17
0
        public string getInsertSQL()
        {
            String sqlString = "INSERT into board_param (name,controltype,linkkind,linkindex,locationx,locationy,text,basecolor,visible,editable,level,parentid)" +
                               "VALUES('{0}', '{1}', '{2}', {3}, {4}, {5}, '{6}', '{7}', '{8}', '{9}', {10}, {11}) ";

            return(String.Format(sqlString, ControlName, ControlType, LinkKind, LinkIndex.ToString(), LocationX.ToString(), LocationY.ToString(), ShowText, BaseColor, Visible, Editable, level.ToString(), ParentId.ToString()));
        }
コード例 #18
0
        public string getUpdateSQL()
        {
            String sqlString = "update board_param set linkkind = '{0}',linkindex = {1},locationx = {2},locationy = {3},text = '{4}',basecolor = '{5}',visible = '{6}'," +
                               "editable = '{7}',level = {8},parentid = {9} where id = {10}";

            return(String.Format(sqlString, LinkKind, LinkIndex.ToString(), LocationX.ToString(), LocationY.ToString(), ShowText, BaseColor, Visible, Editable, level.ToString(), ParentId.ToString(), id.ToString()));
        }
コード例 #19
0
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound)
        {
            string outputFormat = string.Empty;

            if (format == string.Empty)
            {
                outputFormat = "g";
            }

            string lowerPropertyName = propertyName.ToLower();

            if (currentScope == Scope.NoSettings)
            {
                propertyNotFound = true;
                return(PropertyAccess.ContentLocked);
            }
            propertyNotFound = true;

            string result   = string.Empty;
            bool   isPublic = true;

            switch (lowerPropertyName)
            {
            case "tabid":
                propertyNotFound = false;
                result           = (TabID.ToString(outputFormat, formatProvider));
                break;

            case "taborder":
                isPublic         = false;
                propertyNotFound = false;
                result           = (TabOrder.ToString(outputFormat, formatProvider));
                break;

            case "portalid":
                propertyNotFound = false;
                result           = (PortalID.ToString(outputFormat, formatProvider));
                break;

            case "tabname":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(LocalizedTabName, format);
                break;

            case "isvisible":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsVisible, formatProvider));
                break;

            case "parentid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (ParentId.ToString(outputFormat, formatProvider));
                break;

            case "level":
                isPublic         = false;
                propertyNotFound = false;
                result           = (Level.ToString(outputFormat, formatProvider));
                break;

            case "iconfile":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFile, format);
                break;

            case "iconfilelarge":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFileLarge, format);
                break;

            case "disablelink":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(DisableLink, formatProvider));
                break;

            case "title":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Title, format);
                break;

            case "description":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Description, format);
                break;

            case "keywords":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(KeyWords, format);
                break;

            case "isdeleted":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsDeleted, formatProvider));
                break;

            case "url":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Url, format);
                break;

            case "skinsrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinSrc, format);
                break;

            case "containersrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerSrc, format);
                break;

            case "tabpath":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(TabPath, format);
                break;

            case "startdate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (StartDate.ToString(outputFormat, formatProvider));
                break;

            case "enddate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (EndDate.ToString(outputFormat, formatProvider));
                break;

            case "haschildren":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(HasChildren, formatProvider));
                break;

            case "refreshinterval":
                isPublic         = false;
                propertyNotFound = false;
                result           = (RefreshInterval.ToString(outputFormat, formatProvider));
                break;

            case "pageheadtext":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(PageHeadText, format);
                break;

            case "skinpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinPath, format);
                break;

            case "skindoctype":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinDoctype, format);
                break;

            case "containerpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerPath, format);
                break;

            case "issupertab":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsSuperTab, formatProvider));
                break;

            case "fullurl":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(FullUrl, format);
                break;

            case "sitemappriority":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SiteMapPriority.ToString(), format);
                break;
            }
            if (!isPublic && currentScope != Scope.Debug)
            {
                propertyNotFound = true;
                result           = PropertyAccess.ContentLocked;
            }
            return(result);
        }
コード例 #20
0
        public IEnumerable <Tuple <SerializedNotification, string> > GetNotifications(EntityState entityState)
        {
            if (ReadAccess == FileAccess.Nobody)
            {
                yield break;
            }

            var info = GetInfo();
            var type = entityState.ToChangeType();

            string?parent = ParentId != null?ParentId.ToString() : "root";

            switch (ReadAccess)
            {
            case FileAccess.Public:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedPublicPrefix + parent));

                break;

            case FileAccess.RestrictedUser:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedRestrictedUserPrefix + parent));

                break;

            case FileAccess.User:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedUserPrefix + parent));

                break;

            case FileAccess.Developer:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedDeveloperPrefix + parent));

                break;

            case FileAccess.OwnerOrAdmin:
                yield return(new Tuple <SerializedNotification, string>(new FolderContentsUpdated()
                {
                    Type = type,
                    Item = info
                }, NotificationGroups.FolderContentsUpdatedOwnerPrefix + parent));

                break;
            }

            yield return(new Tuple <SerializedNotification, string>(new StorageItemUpdated()
            {
                Item = GetDTO()
            }, NotificationGroups.StorageItemUpdatedPrefix + Id));
        }
コード例 #21
0
        /// <summary>
        /// Create the native .net child controls for this control
        /// </summary>
        protected override void CreateChildControls()
        {
            // Create the panel surround
            Panel = new Panel
            {
                ID       = "FolderBrowser",
                CssClass = "umbFolderBrowser"
            };

            Panel.Attributes.Add("data-parentid", ParentId.ToString());

            var sb = new StringBuilder();

            // Create the breadcrumb
            var breadCrumb = new List <global::umbraco.cms.businesslogic.media.Media> {
                ParentNode
            };

            var parent = ParentNode;

            while (parent.Id != -1)
            {
                parent = new global::umbraco.cms.businesslogic.media.Media(parent.ParentId);
                breadCrumb.Add(parent);
            }

            breadCrumb.Reverse();

            sb.Append("<ul class='breadcrumb'><li><strong>You are here:</strong></li>");
            foreach (var media in breadCrumb)
            {
                if (media.Id == ParentId)
                {
                    if (media.Id == -1)
                    {
                        sb.AppendFormat("<li>Media</li>");
                    }
                    else
                    {
                        sb.AppendFormat("<li>{0}</li>", media.Text);
                    }
                }
                else
                if (media.Id == -1)
                {
                    sb.AppendFormat("<li><a href='dashboard.aspx?app=media'>Media</a></li>");
                }
                else
                {
                    sb.AppendFormat("<li><a href='editMedia.aspx?id={1}'>{0}</a></li>", media.Text, media.Id);
                }
            }
            sb.Append("</ul>");

            // Path for tree refresh
            Panel.Attributes.Add("data-nodepath", ParentNode.Path);

            // Create size changer
            sb.Append("<div class='thumb-sizer'>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_small' value='small' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_small'><img src='images/thumbs_smll.png' alt='Small thumbnails' /></label>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_medium' value='medium' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_medium'><img src='images/thumbs_med.png' alt='Medium thumbnails' /></label>" +
                      "<input type='radio' name='thumb_size' id='thumb_size_large' value='large' data-bind='checked: thumbSize' />" +
                      "<label for='thumb_size_large'><img src='images/thumbs_lrg.png' alt='Large thumbnails' /></label>" +
                      "</div>");

            // Create the filter input
            sb.Append("<div class='filter'>Filter: <input type='text' data-bind=\"value: filterTerm, valueUpdate: 'afterkeydown'\" id='filterTerm'/></div>");

            // Create throbber to display whilst loading items
            sb.Append("<img src='images/throbber.gif' alt='' class='throbber' data-bind=\"visible: filtered().length == 0\" />");

            // Create thumbnails container
            sb.Append("<ul class='items' data-bind='foreach: filtered'>" +
                      "<li data-bind=\"attr: { 'data-id': Id, 'data-order': $index() }, css: { selected: selected() }, event: { mousedown: toggleSelected, contextmenu: toggleSelected, dblclick: edit }\"><div><span class='img'><img data-bind='attr: { src: ThumbnailUrl }' /></span><span data-bind='text: Name'></span></div></li>" +
                      "</ul>");

            Panel.Controls.Add(new LiteralControl(sb.ToString()));

            Controls.Add(Panel);

            Page.ClientScript.RegisterStartupScript(typeof(FolderBrowser),
                                                    "RegisterFolderBrowsers",
                                                    string.Format("$(function () {{ $(\".umbFolderBrowser\").folderBrowser({{ umbracoPath : '{0}', basePath : '{1}' }}); " +
                                                                  "$(\".umbFolderBrowser #filterTerm\").keypress(function(event) {{ return event.keyCode != 13; }});}});",
                                                                  IOHelper.ResolveUrl(SystemDirectories.Umbraco),
                                                                  IOHelper.ResolveUrl(SystemDirectories.Base)),
                                                    true);
        }