Ejemplo n.º 1
0
        void ReleaseDesignerOutlets()
        {
            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (MainImageView != null)
            {
                MainImageView.Dispose();
                MainImageView = null;
            }

            if (TimeLabel != null)
            {
                TimeLabel.Dispose();
                TimeLabel = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (ContentConstraint != null)
            {
                ContentConstraint.Dispose();
                ContentConstraint = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (AuthorLabel != null)
            {
                AuthorLabel.Dispose();
                AuthorLabel = null;
            }

            if (WhenLabel != null)
            {
                WhenLabel.Dispose();
                WhenLabel = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (ProfileImage != null)
            {
                ProfileImage.Dispose();
                ProfileImage = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (AuthorLabel != null)
            {
                AuthorLabel.Dispose();
                AuthorLabel = null;
            }

            if (BadgeLabel != null)
            {
                BadgeLabel.Dispose();
                BadgeLabel = null;
            }

            if (BadgeView != null)
            {
                BadgeView.Dispose();
                BadgeView = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }
        }
Ejemplo n.º 4
0
        void ReleaseDesignerOutlets()
        {
            if (HeadingLabel != null)
            {
                HeadingLabel.Dispose();
                HeadingLabel = null;
            }

            if (IntoImageView != null)
            {
                IntoImageView.Dispose();
                IntoImageView = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (PageControl != null)
            {
                PageControl.Dispose();
                PageControl = null;
            }

            if (NextButton != null)
            {
                NextButton.Dispose();
                NextButton = null;
            }
        }
Ejemplo n.º 5
0
        public string GetFileLabel(Stream stream, string inputFileName)
        {
            if (this.engine == null)
            {
                return(null);
            }

            try
            {
                var handler = this.engine.CreateFileHandler(stream, inputFileName);

                LateValue <ContentLabel> lateContentLabel = new LateValue <ContentLabel>();
                handler.GetLabelAsync(lateContentLabel);
                ContentLabel contentLabel = lateContentLabel.AwaitValue();

                if (contentLabel != null)
                {
                    return(contentLabel.Label.Name);
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     NavBar.RightBarButtonItem.Clicked += (sender, e) => Cancel();
     ContentLabel.AttributedText        = Content.FromMarkdown();
     ContentLabel.SizeToFit();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Sets the current questions labels.
 /// </summary>
 /// <param name="varlabel"></param>
 /// <param name="domain"></param>
 /// <param name="topic"></param>
 /// <param name="content"></param>
 /// <param name="product"></param>
 public void SetLabels(string varlabel, DomainLabel domain, TopicLabel topic, ContentLabel content, ProductLabel product)
 {
     CurrentQuestion.VarName.VarLabel = varlabel;
     CurrentQuestion.VarName.Domain   = domain;
     CurrentQuestion.VarName.Topic    = topic;
     CurrentQuestion.VarName.Content  = content;
     CurrentQuestion.VarName.Product  = product;
 }
Ejemplo n.º 8
0
        void ReleaseDesignerOutlets()
        {
            if (OwnerImageView != null)
            {
                OwnerImageView.Dispose();
                OwnerImageView = null;
            }

            if (CaptionLabel != null)
            {
                CaptionLabel.Dispose();
                CaptionLabel = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (FollowersImageVIew != null)
            {
                FollowersImageVIew.Dispose();
                FollowersImageVIew = null;
            }

            if (FollowersLabel != null)
            {
                FollowersLabel.Dispose();
                FollowersLabel = null;
            }

            if (ForksImageView != null)
            {
                ForksImageView.Dispose();
                ForksImageView = null;
            }

            if (ForksLabel != null)
            {
                ForksLabel.Dispose();
                ForksLabel = null;
            }

            if (UserImageView != null)
            {
                UserImageView.Dispose();
                UserImageView = null;
            }

            if (UserLabel != null)
            {
                UserLabel.Dispose();
                UserLabel = null;
            }
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        public void Run(AdWordsUser user)
        {
            using (CustomerNegativeCriterionService customerNegativeCriterionService =
                       (CustomerNegativeCriterionService)user.GetService(
                           AdWordsService.v201806.CustomerNegativeCriterionService)) {
                List <Criterion> criteria = new List <Criterion>();

                // Exclude tragedy & conflict content.
                ContentLabel tragedyContentLabel = new ContentLabel {
                    contentLabelType = ContentLabelType.TRAGEDY
                };
                criteria.Add(tragedyContentLabel);

                // Exclude a specific placement.
                Placement placement = new Placement {
                    url = "http://www.example.com"
                };
                criteria.Add(placement);

                // Additional criteria types are available for this service. See the types listed
                // under Criterion here:
                // https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion

                // Create operations to add each of the criteria above.
                List <CustomerNegativeCriterionOperation> operations =
                    new List <CustomerNegativeCriterionOperation>();
                foreach (Criterion criterion in criteria)
                {
                    CustomerNegativeCriterion negativeCriterion = new CustomerNegativeCriterion {
                        criterion = criterion
                    };
                    CustomerNegativeCriterionOperation operation = new CustomerNegativeCriterionOperation {
                        @operator = Operator.ADD,
                        operand   = negativeCriterion
                    };
                    operations.Add(operation);
                }

                try {
                    // Send the request to add the criteria.
                    CustomerNegativeCriterionReturnValue result =
                        customerNegativeCriterionService.mutate(operations.ToArray());

                    // Display the results.
                    foreach (CustomerNegativeCriterion negativeCriterion in result.value)
                    {
                        Console.WriteLine("Customer negative criterion with criterion ID {0} and type '{1}' " +
                                          "was added.", negativeCriterion.criterion.id,
                                          negativeCriterion.criterion.type);
                    }
                } catch (Exception e) {
                    throw new System.ApplicationException("Failed to set customer negative criteria.", e);
                }
            }
        }
Ejemplo n.º 10
0
        public void UpdateContentLabel(ContentLabel label)
        {
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }


            _labelRepository.Update(label);

            //cache
            _cacheManager.RemoveByPattern(LABELS_PATTERN_KEY);
        }
        void ReleaseDesignerOutlets()
        {
            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }
        }
Ejemplo n.º 12
0
        public int InsertContentLabel(ContentLabel label)
        {
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }

            var labelId = _labelRepository.InsertAndGetId(label);

            //cache
            _cacheManager.RemoveByPattern(LABELS_PATTERN_KEY);

            return(labelId);
        }
Ejemplo n.º 13
0
        void ReleaseDesignerOutlets()
        {
            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (NavBar != null)
            {
                NavBar.Dispose();
                NavBar = null;
            }
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (HasId)
            {
                hash ^= Id.GetHashCode();
            }
            if (Type != global::Google.Ads.GoogleAds.V6.Enums.CriterionTypeEnum.Types.CriterionType.Unspecified)
            {
                hash ^= Type.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.ContentLabel)
            {
                hash ^= ContentLabel.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.MobileApplication)
            {
                hash ^= MobileApplication.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.MobileAppCategory)
            {
                hash ^= MobileAppCategory.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.Placement)
            {
                hash ^= Placement.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.YoutubeVideo)
            {
                hash ^= YoutubeVideo.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.YoutubeChannel)
            {
                hash ^= YoutubeChannel.GetHashCode();
            }
            hash ^= (int)criterionCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (id_ != null)
            {
                hash ^= Id.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.ContentLabel)
            {
                hash ^= ContentLabel.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.MobileApplication)
            {
                hash ^= MobileApplication.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.MobileAppCategory)
            {
                hash ^= MobileAppCategory.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.Placement)
            {
                hash ^= Placement.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.YoutubeVideo)
            {
                hash ^= YoutubeVideo.GetHashCode();
            }
            if (criterionCase_ == CriterionOneofCase.YoutubeChannel)
            {
                hash ^= YoutubeChannel.GetHashCode();
            }
            hash ^= (int)criterionCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        void ReleaseDesignerOutlets()
        {
            if (ThumbnailImageView != null)
            {
                ThumbnailImageView.Dispose();
                ThumbnailImageView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }
        }
Ejemplo n.º 17
0
        void ReleaseDesignerOutlets()
        {
            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (UrlTextView != null)
            {
                UrlTextView.Dispose();
                UrlTextView = null;
            }
        }
Ejemplo n.º 18
0
        public void SavePostDetails(Content Model, bool isPublished)
        {
            Content cont = new Content();

            cont.Type  = "post";
            cont.Title = Model.Title;

            //var sanitizer = new Html.HtmlSanitizer();
            CQ doc = CQ.Create(Model.Description);

            string[] BlackList = new string[] { "script" };
            string   selector  = String.Join(",", BlackList);

            doc = doc[selector].Remove();
            Model.Description = doc.Render();

            cont.Description = Model.Description;
            cont.GUID        = Functions.GetRandomGUID();
            if (string.IsNullOrEmpty(Model.URL))
            {
                Model.URL = Model.Title;
            }
            cont.URL          = Functions.ToUrlSlug(Model.URL, "post", 0);
            cont.IsSlugEdited = Model.IsSlugEdited;
            cont.IsFeatured   = Model.IsFeatured;
            cont.ContentOrder = Model.ContentOrder;

            cont.EnableComment      = Model.EnableComment;
            cont.CommentEnabledTill = Model.CommentEnabledTill;
            cont.CoverContent       = Model.CoverContent;
            if (!string.IsNullOrEmpty(Model.FeaturedImage))
            {
                cont.FeaturedImage = Model.FeaturedImage;
            }
            else
            {
                cont.FeaturedImage = null;
            }
            cont.AddedOn = DateTime.UtcNow;
            cont.AddedBy = Functions.CurrentUserID();
            if (isPublished)
            {
                cont.isPublished = true;
                cont.PublishedOn = cont.AddedOn;
            }
            else
            {
                cont.isPublished = false;
            }
            context.Content.Add(cont);
            context.SaveChanges();

            if (Request.Form["LabelId"] != null)
            {
                string[] allLables = Request.Form["LabelId"].Split(',');
                foreach (string currLblID in allLables)
                {
                    ContentLabel contLabel = new ContentLabel();
                    contLabel.ContentID = cont.ID;
                    contLabel.LabelID   = Convert.ToInt32(currLblID);
                    contLabel.AddedOn   = DateTime.UtcNow;
                    contLabel.AddedBy   = Functions.CurrentUserID();
                    context.ContentLabel.Add(contLabel);
                    context.SaveChanges();
                }
            }
            if (Request.Form["CategoryId"] != null)
            {
                string[] allCategories = Request.Form["CategoryId"].Split(',');
                foreach (string currCatID in allCategories)
                {
                    ContentCategory contentCategory = new ContentCategory();
                    contentCategory.ContentID  = cont.ID;
                    contentCategory.CategoryID = Convert.ToInt32(currCatID);
                    contentCategory.AddedOn    = DateTime.UtcNow;
                    contentCategory.AddedBy    = Functions.CurrentUserID();
                    context.ContentCategory.Add(contentCategory);
                    context.SaveChanges();
                }
            }
            if (!string.IsNullOrWhiteSpace(Request.Form["txtMetaTitle"]) || !string.IsNullOrWhiteSpace(Request.Form["txtMetaKeyword"]) || !string.IsNullOrWhiteSpace(Request.Form["txtMetaDescription"]) || !string.IsNullOrWhiteSpace(Request.Form["txtMetaAuthor"]))
            {
                Meta metaData = new Meta();
                metaData.ContentID   = cont.ID;
                metaData.Title       = Request.Form["txtMetaTitle"].ToString();
                metaData.Keyword     = Request.Form["txtMetaKeyword"].ToString();
                metaData.Description = Request.Form["txtMetaDescription"].ToString();
                metaData.Author      = Request.Form["txtMetaAuthor"].ToString();
                metaData.CreatedOn   = DateTime.UtcNow;
                context.Meta.Add(metaData);
                context.SaveChanges();
            }
        }
        public void MergeFrom(CustomerNegativeCriterion other)
        {
            if (other == null)
            {
                return;
            }
            if (other.ResourceName.Length != 0)
            {
                ResourceName = other.ResourceName;
            }
            if (other.id_ != null)
            {
                if (id_ == null || other.Id != 0L)
                {
                    Id = other.Id;
                }
            }
            if (other.Type != 0)
            {
                Type = other.Type;
            }
            switch (other.CriterionCase)
            {
            case CriterionOneofCase.ContentLabel:
                if (ContentLabel == null)
                {
                    ContentLabel = new global::Google.Ads.GoogleAds.V2.Common.ContentLabelInfo();
                }
                ContentLabel.MergeFrom(other.ContentLabel);
                break;

            case CriterionOneofCase.MobileApplication:
                if (MobileApplication == null)
                {
                    MobileApplication = new global::Google.Ads.GoogleAds.V2.Common.MobileApplicationInfo();
                }
                MobileApplication.MergeFrom(other.MobileApplication);
                break;

            case CriterionOneofCase.MobileAppCategory:
                if (MobileAppCategory == null)
                {
                    MobileAppCategory = new global::Google.Ads.GoogleAds.V2.Common.MobileAppCategoryInfo();
                }
                MobileAppCategory.MergeFrom(other.MobileAppCategory);
                break;

            case CriterionOneofCase.Placement:
                if (Placement == null)
                {
                    Placement = new global::Google.Ads.GoogleAds.V2.Common.PlacementInfo();
                }
                Placement.MergeFrom(other.Placement);
                break;

            case CriterionOneofCase.YoutubeVideo:
                if (YoutubeVideo == null)
                {
                    YoutubeVideo = new global::Google.Ads.GoogleAds.V2.Common.YouTubeVideoInfo();
                }
                YoutubeVideo.MergeFrom(other.YoutubeVideo);
                break;

            case CriterionOneofCase.YoutubeChannel:
                if (YoutubeChannel == null)
                {
                    YoutubeChannel = new global::Google.Ads.GoogleAds.V2.Common.YouTubeChannelInfo();
                }
                YoutubeChannel.MergeFrom(other.YoutubeChannel);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Ejemplo n.º 20
0
        public ActionResult Edit(Content Model, string GUID, string UpdateType)
        {
            Content content = context.Content.Where(m => m.GUID == GUID).FirstOrDefault();

            if (content != null)    // if content not found
            {
                if (Functions.CurrentUserID() == content.AddedBy)
                {
                    if (!aclService.HasRight(Rights.EditOwnPosts))
                    {
                        return(RedirectToAction("AccessDenied", "Home"));
                    }
                }
                else
                {
                    if (!aclService.HasRight(Rights.EditOtherUsersPosts))
                    {
                        return(RedirectToAction("AccessDenied", "Home"));
                    }
                }

                if (ModelState.IsValid)
                {
                    CQ       doc       = CQ.Create(Model.Description);
                    string[] BlackList = new string[] { "script" };
                    string   selector  = String.Join(",", BlackList);
                    doc = doc[selector].Remove();
                    Model.Description = doc.Render();

                    string postContent = Model.Description.Replace("&nbsp;", "").Replace("<p>", "").Replace("</p>", "").Trim();
                    if (!string.IsNullOrEmpty(postContent))
                    {
                        content.Title       = Model.Title;
                        content.Description = Model.Description.Replace("<img src=\"../../../", "<img src=\"../../");
                        if (!string.IsNullOrEmpty(Model.URL) && content.URL.ToLower() != Model.URL.ToLower())
                        {
                            content.URL = Functions.ToUrlSlug(Model.URL, "post", content.ID);
                        }
                        content.IsSlugEdited = Model.IsSlugEdited;
                        content.IsFeatured   = Model.IsFeatured;
                        content.ContentOrder = Model.ContentOrder;
                        content.ModifiedOn   = DateTime.UtcNow;
                        content.ModifiedBy   = Functions.CurrentUserID();

                        content.EnableComment      = Model.EnableComment;
                        content.CommentEnabledTill = Model.CommentEnabledTill;
                        content.CoverContent       = Model.CoverContent;
                        if (!string.IsNullOrEmpty(Model.FeaturedImage))
                        {
                            content.FeaturedImage = Model.FeaturedImage;
                        }
                        else
                        {
                            content.FeaturedImage = null;
                        }
                        if (UpdateType == "Publish")
                        {
                            content.isPublished = true;
                            content.PublishedOn = content.ModifiedOn;
                        }
                        else
                        {
                            content.isPublished = false;
                            content.PublishedOn = null;
                        }
                        context.SaveChanges();

                        #region update label
                        List <ContentLabel> contentLabel = context.ContentLabel.Where(m => m.ContentID == content.ID).ToList();
                        context.ContentLabel.RemoveRange(contentLabel);
                        context.SaveChanges();
                        if (Request.Form["LabelId"] != null)
                        {
                            string[] allLables = Request.Form["LabelId"].Split(',');
                            foreach (string currLblID in allLables)
                            {
                                ContentLabel contLabel = new ContentLabel();
                                contLabel.ContentID = content.ID;
                                contLabel.LabelID   = Convert.ToInt32(currLblID);
                                contLabel.AddedOn   = DateTime.UtcNow;
                                contLabel.AddedBy   = Functions.CurrentUserID();
                                context.ContentLabel.Add(contLabel);
                                context.SaveChanges();
                            }
                        }
                        #endregion
                        #region update Category
                        List <ContentCategory> contentCategoryList = context.ContentCategory.Where(m => m.ContentID == content.ID).ToList();
                        context.ContentCategory.RemoveRange(contentCategoryList);
                        context.SaveChanges();
                        if (Request.Form["CategoryId"] != null)
                        {
                            string[] allCategories = Request.Form["CategoryId"].Split(',');
                            foreach (string currCatID in allCategories)
                            {
                                ContentCategory contentCategory = new ContentCategory();
                                contentCategory.ContentID  = content.ID;
                                contentCategory.CategoryID = Convert.ToInt32(currCatID);
                                contentCategory.AddedOn    = DateTime.UtcNow;
                                contentCategory.AddedBy    = Functions.CurrentUserID();
                                context.ContentCategory.Add(contentCategory);
                                context.SaveChanges();
                            }
                        }
                        #endregion
                        #region update meta
                        Meta meta = context.Meta.FirstOrDefault(m => m.ContentID == content.ID);
                        if (meta == null)
                        {
                            meta             = new Meta();
                            meta.ContentID   = content.ID;
                            meta.CreatedOn   = DateTime.UtcNow;
                            meta.Title       = Request.Form["txtMetaTitle"].ToString();
                            meta.Keyword     = Request.Form["txtMetaKeyword"].ToString();
                            meta.Description = Request.Form["txtMetaDescription"].ToString();
                            meta.Author      = Request.Form["txtMetaAuthor"].ToString();
                            context.Meta.Add(meta);
                        }
                        else
                        {
                            meta.Title       = Request.Form["txtMetaTitle"].ToString();
                            meta.Keyword     = Request.Form["txtMetaKeyword"].ToString();
                            meta.Description = Request.Form["txtMetaDescription"].ToString();
                            meta.Author      = Request.Form["txtMetaAuthor"].ToString();
                        }
                        context.SaveChanges();
                        #endregion
                        TempData["SuccessMessage"] = "Post updated successfully.";
                    }
                    else
                    {
                        TempData["ErrorMessage"] = "Please enter post content.";
                        return(RedirectToAction("Edit"));
                    }
                }
                else
                {
                    return(RedirectToAction("Edit"));
                }
            }
            else
            {
                TempData["ErrorMessage"] = "Post Not Found.";
            }
            return(RedirectToAction("List", "Post"));
        }
Ejemplo n.º 21
0
        void ReleaseDesignerOutlets()
        {
            if (HeightTest1 != null)
            {
                HeightTest1.Dispose();
                HeightTest1 = null;
            }

            if (HeightTest2 != null)
            {
                HeightTest2.Dispose();
                HeightTest2 = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (ContentText != null)
            {
                ContentText.Dispose();
                ContentText = null;
            }

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }

            if (HeaderLabel2 != null)
            {
                HeaderLabel2.Dispose();
                HeaderLabel2 = null;
            }

            if (HeaderLabel3 != null)
            {
                HeaderLabel3.Dispose();
                HeaderLabel3 = null;
            }

            if (HeaderLabel4 != null)
            {
                HeaderLabel4.Dispose();
                HeaderLabel4 = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (StoriesHeightConstraint != null)
            {
                StoriesHeightConstraint.Dispose();
                StoriesHeightConstraint = null;
            }

            if (StoriesTable != null)
            {
                StoriesTable.Dispose();
                StoriesTable = null;
            }

            if (Style1Button != null)
            {
                Style1Button.Dispose();
                Style1Button = null;
            }

            if (Style2Button != null)
            {
                Style2Button.Dispose();
                Style2Button = null;
            }
        }
        /// <summary>
        /// Handle File Watch Engine events for state changes and failures.
        /// </summary>
        private void fileWatchEngine_EngineEvent(object sender, EngineEventArgs e)
        {
            if (e.NotificationType == EngineNotificationType.Watching ||
                e.NotificationType == EngineNotificationType.Suspended)
            {
                this.Invoke(new AppendToLog(doAppendToLog), "** " + e.NotificationType.ToString() + "\r\n");
            }
            else if (e.NotificationType == EngineNotificationType.Processing)
            {
                this.Invoke(new AppendToLog(doAppendToLog), e.NotificationType.ToString() + ": " + e.FullPath + "...");

                // append 'p' to file extension to denote as protected
                //String[] outputPath = e.FullPath.Split('.');
                //outputPath[outputPath.Length - 1] = "p" + outputPath[outputPath.Length - 1];
                //String outFile = String.Join(".", outputPath);
                String[] outputPath = e.FullPath.Split('\\');

                // create 'protected' dir if it doesn't exist
                //Directory.CreateDirectory();

                //outputPath[outputPath.Length - 1] = "protected\\" + outputPath[outputPath.Length - 1];
                //String outFile = String.Join("\\", outputPath);

                String tmpFilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

                //String outFile = e.FullPath;
                Action.FileOptions options = new Action.FileOptions
                {
                    FileName                 = e.FullPath,
                    OutputName               = tmpFilePath,
                    ActionSource             = ActionSource.Manual,
                    AssignmentMethod         = AssignmentMethod.Standard,
                    DataState                = DataState.Rest,
                    GenerateChangeAuditEvent = true,
                    IsAuditDiscoveryEnabled  = true,
                    LabelId = currentProtectionPolicy.Id
                };

                this.Invoke(new AppendToLog(doAppendToLog), "Checking for existing Label" + "\r\n");

                ContentLabel currLabel = action.GetLabel(options);

                Boolean doProtect = true;
                // determine if this file should be protected or unprotected
                if (listBoxUnprotect.Items.Count > 0)
                {
                    for (int i = 0; i < listBoxUnprotect.Items.Count; i++)
                    {
                        String path = (string)listBoxUnprotect.Items[i];
                        if (e.FullPath.StartsWith(path))
                        {
                            doProtect = false;
                            break;
                        }
                    }
                }

                ////
                if (doProtect)
                {
                    if (currLabel != null)
                    {
                        this.Invoke(new AppendToLog(doAppendToLog), "Already Protected!\r\n");
                    }

                    if (currentProtectionPolicy != null && currLabel == null)
                    {
                        this.Invoke(new AppendToLog(doAppendToLog), "Setting Label and saving to " + tmpFilePath + "\r\n");
                        action.SetLabel(options);
                        this.Invoke(new AppendToLog(doAppendToLog), "Replacing file with protected version" + "\r\n");
                        File.Delete(e.FullPath);
                        this.Invoke(new AppendToLog(doAppendToLog), "Deleted old " + "\r\n");
                        File.Copy(tmpFilePath, e.FullPath);
                        this.Invoke(new AppendToLog(doAppendToLog), "Protected!\r\n");
                    }
                }
                else     // Unprotect the file

                {
                    if (currLabel == null)
                    {
                        this.Invoke(new AppendToLog(doAppendToLog), "Already NOT Protected!\r\n");
                        return;
                    }
                    this.Invoke(new AppendToLog(doAppendToLog), "Unprotect this file \r\n");
                    options.LabelId = null; // remove label??
                    this.Invoke(new AppendToLog(doAppendToLog), "Removing Label and saving to " + tmpFilePath + "\r\n");
                    action.DeleteLabel(options);
                    this.Invoke(new AppendToLog(doAppendToLog), "Replacing file with unprotected version" + "\r\n");
                    File.Delete(e.FullPath);
                    this.Invoke(new AppendToLog(doAppendToLog), "Deleted old " + "\r\n");
                    File.Copy(tmpFilePath, e.FullPath);
                    this.Invoke(new AppendToLog(doAppendToLog), "Protection Removed!\r\n");
                }
            }
            else
            {
                this.Invoke(new AppendToLog(doAppendToLog), e.NotificationType.ToString() + "\r\n");
            }
        }
Ejemplo n.º 23
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (ChooseLanguageHeaderLbl != null)
            {
                ChooseLanguageHeaderLbl.Dispose();
                ChooseLanguageHeaderLbl = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (ContentLabelOne != null)
            {
                ContentLabelOne.Dispose();
                ContentLabelOne = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (Header != null)
            {
                Header.Dispose();
                Header = null;
            }

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }

            if (BokmalButton != null)
            {
                BokmalButton.Dispose();
                BokmalButton = null;
            }

            if (BokmalLabel != null)
            {
                BokmalLabel.Dispose();
                BokmalLabel = null;
            }

            if (NynorskButton != null)
            {
                NynorskButton.Dispose();
                NynorskButton = null;
            }

            if (NynorskLabel != null)
            {
                NynorskLabel.Dispose();
                NynorskLabel = null;
            }

            if (EnglishButton != null)
            {
                EnglishButton.Dispose();
                EnglishButton = null;
            }

            if (EnglishLabel != null)
            {
                EnglishLabel.Dispose();
                EnglishLabel = null;
            }

            if (PolishButton != null)
            {
                PolishButton.Dispose();
                PolishButton = null;
            }

            if (PolishLabel != null)
            {
                PolishLabel.Dispose();
                PolishLabel = null;
            }

            if (SomaliButton != null)
            {
                SomaliButton.Dispose();
                SomaliButton = null;
            }

            if (SomaliLabel != null)
            {
                SomaliLabel.Dispose();
                SomaliLabel = null;
            }

            if (TigrinyaButton != null)
            {
                TigrinyaButton.Dispose();
                TigrinyaButton = null;
            }

            if (TigrinyaLabel != null)
            {
                TigrinyaLabel.Dispose();
                TigrinyaLabel = null;
            }

            if (ArabicButton != null)
            {
                ArabicButton.Dispose();
                ArabicButton = null;
            }

            if (ArabicLabel != null)
            {
                ArabicLabel.Dispose();
                ArabicLabel = null;
            }

            if (LithuanianButton != null)
            {
                LithuanianButton.Dispose();
                LithuanianButton = null;
            }

            if (LithuanianLabel != null)
            {
                LithuanianLabel.Dispose();
                LithuanianLabel = null;
            }

            if (UrduButton != null)
            {
                UrduButton.Dispose();
                UrduButton = null;
            }

            if (UrduLabel != null)
            {
                UrduLabel.Dispose();
                UrduLabel = null;
            }

            if (RestartAppLabl != null)
            {
                RestartAppLabl.Dispose();
                RestartAppLabl = null;
            }

            if (SmittestopLinkButtonLbl != null)
            {
                SmittestopLinkButtonLbl.Dispose();
                SmittestopLinkButtonLbl = null;
            }

            if (SmittestopLinkButtonStackView != null)
            {
                SmittestopLinkButtonStackView.Dispose();
                SmittestopLinkButtonStackView = null;
            }

            if (switchButton != null)
            {
                switchButton.Dispose();
                switchButton = null;
            }
        }
Ejemplo n.º 24
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (ChooseLanguageHeaderLbl != null)
            {
                ChooseLanguageHeaderLbl.Dispose();
                ChooseLanguageHeaderLbl = null;
            }

            if (ContentLabel != null)
            {
                ContentLabel.Dispose();
                ContentLabel = null;
            }

            if (ContentLabelOne != null)
            {
                ContentLabelOne.Dispose();
                ContentLabelOne = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (Header != null)
            {
                Header.Dispose();
                Header = null;
            }

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }

            if (RadioButton1 != null)
            {
                RadioButton1.Dispose();
                RadioButton1 = null;
            }

            if (RadioButton1Lbl != null)
            {
                RadioButton1Lbl.Dispose();
                RadioButton1Lbl = null;
            }

            if (RadioButton2 != null)
            {
                RadioButton2.Dispose();
                RadioButton2 = null;
            }

            if (RadioButton2Lbl != null)
            {
                RadioButton2Lbl.Dispose();
                RadioButton2Lbl = null;
            }

            if (RadioButton3 != null)
            {
                RadioButton3.Dispose();
                RadioButton3 = null;
            }

            if (RadioButton3Lbl != null)
            {
                RadioButton3Lbl.Dispose();
                RadioButton3Lbl = null;
            }

            if (RestartAppLabl != null)
            {
                RestartAppLabl.Dispose();
                RestartAppLabl = null;
            }

            if (SmittestopLinkButtonLbl != null)
            {
                SmittestopLinkButtonLbl.Dispose();
                SmittestopLinkButtonLbl = null;
            }

            if (SmittestopLinkButtonStackView != null)
            {
                SmittestopLinkButtonStackView.Dispose();
                SmittestopLinkButtonStackView = null;
            }

            if (switchButton != null)
            {
                switchButton.Dispose();
                switchButton = null;
            }
        }