void UpdateNodeCellsForResult(TreeModelViewNode viewNode, FileAssociation fileAssociation)
 {
   viewNode.SetValue(myPatternTypeColumn, fileAssociation.PatternType);
   
   string docType = String.Format("{0}{1}", fileAssociation.DocType, fileAssociation.Enabled ? null : " (disabled)");
   viewNode.SetValue(myAssociationColumn, docType);
 }
 public void CopyFrom(FileAssociation other)
 {
     Pattern = other.Pattern;
       PatternType = other.PatternType;
       DocType = other.DocType;
       Enabled = other.Enabled;
 }
        public EditFileAssociationControl(FileAssociation fileAssociation)
        {
            InitializeComponent();

              SetUpValues(fileAssociation);
              SetUpValueChangedHandlers();
        }
 public void CopyFrom(FileAssociation other)
 {
     Pattern     = other.Pattern;
     PatternType = other.PatternType;
     DocType     = other.DocType;
     Enabled     = other.Enabled;
 }
 public bool Equals(FileAssociation other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Pattern, Pattern) && Equals(other.DocType, DocType) && Equals(other.PatternType, PatternType) && other.Enabled.Equals(Enabled));
 }
    public EditFileAssociationForm(FileAssociation fileAssociation)
    {
      InitializeComponent();

      myEditor = new EditFileAssociationControl(fileAssociation)
      {
        Dock = DockStyle.Fill
      };

      myPanel.Controls.Add(myEditor);

      Icon = Shell.Instance.GetComponent<IApplicationDescriptor>().ProductIcon;
    }
    void SetUpValues(FileAssociation fileAssociation)
    {
      FileAssociation = fileAssociation;

      myPattern.Text = FileAssociation.Pattern;
      myEnabled.Checked = FileAssociation.Enabled;

      switch (FileAssociation.DocType)
      {
        case DocType.Html:
          myHtml.Checked = true;
          break;
        case DocType.Css:
          myCss.Checked = true;
          break;
        case DocType.Xsl:
          myXsl.Checked = true;
          break;
        case DocType.None:
          break;
        default:
          throw new ArgumentOutOfRangeException();
      }

      switch (FileAssociation.PatternType)
      {
        case PatternType.FileExtension:
          myFileExtension.Checked = true;
          break;
        case PatternType.Regex:
          myRegex.Checked = true;
          break;
        default:
          throw new ArgumentOutOfRangeException();
      }
    }
    private void BindModel(FileAssociation selection)
    {
      myThreading.ExecuteOrQueue(myLifetime, "ZenCodingOptionsPage.BindModel", () =>
      {
        myView.Model = BuildModel();
        myView.UpdateAllNodesPresentation();

        foreach (var pair in myFileAssociations)
        {
          var association = pair.Value;
          if (ReferenceEquals(selection, association))
          {
            myView.SetFocusedNode(myView.FindNodeByID(pair.Key));
            break;
          }
        }
      });
    }
    private void OpenEditor(FileAssociation association, Action<EditFileAssociationForm> onClose)
    {
      using (var form = new EditFileAssociationForm(association))
      {
        if (form.ShowDialog(this) != DialogResult.OK)
          return;

        onClose(form);
        myThreading.ExecuteOrQueue(myLifetime, "ZenCodingOptionPage.UpdateAllNodesPresentation", () => myView.UpdateAllNodesPresentation());
      }
    }
 private bool HandlerMatch(FileAssociation a, string fileName)
 {
   return myHandlers.FirstOrDefault(x => x.Matches(a, fileName)) != null;
 }
 private bool HandlerMatch(FileAssociation a, string fileName)
 {
     return(myHandlers.FirstOrDefault(x => x.Matches(a, fileName)) != null);
 }
        void OpenEditor(FileAssociation association, Action<EditFileAssociationForm> onClose)
        {
            using (var form = new EditFileAssociationForm(association))
              {
            if (form.ShowDialog(this) != DialogResult.OK)
            {
              return;
            }

            onClose(form);
            myView.UpdateAllNodesPresentation();
              }
        }
        void BindModel(FileAssociation selection)
        {
            myView.Model = BuildModel(Settings.Instance.FileAssociations);
              myView.UpdateAllNodesPresentation();

              for (int i = 0; i < Settings.Instance.FileAssociations.Count; i++)
              {
            var association = Settings.Instance.FileAssociations[i];
            if (ReferenceEquals(selection, association))
            {
              myView.SetFocusedNode(myView.FindNodeByID(i));
              break;
            }
              }
        }