public void AddPatternEntry(PatternEntryViewModel entry = null, Boolean duplicate = false)
        {
            Visibility customDirVisibility = Visibility.Collapsed;

            if (PatternEntries.Count > 0)
            {
                customDirVisibility = Visibility.Visible;
            }
            if (entry == null)
            {
                if (duplicate && PatternEntries.Count > 0)
                {
                    entry = PatternEntries.Last().Clone();
                }
                else
                {
                    entry = new PatternEntryViewModel(GetSelectedPattern(_selectedPattern));
                }
            }
            entry.PatternCustomDownloadFolderInputVisibility = customDirVisibility;
            entry.CloseEnteryEvent   += ClosePatternEntry;
            entry.SavePatternEvent   += _sender.OnSavePatternEvent;
            entry.RemovePatternEvent += _sender.OnRemovePatternEvent;
            PatternEntries.Add(entry);
        }
Exemple #2
0
        public PatternEntryViewModel Clone()
        {
            var          formatter = new BinaryFormatter();
            MemoryStream stream    = new MemoryStream();

            formatter.Serialize(stream, this);
            stream.Position = 0;
            PatternEntryViewModel entryViewModel = (PatternEntryViewModel)formatter.Deserialize(stream);

            return(entryViewModel);
        }