private void handleIndex(int index, OutputOrder item)
 {
     if (index > -1)
     {
         OutputOrder.Remove(item);
         OutputOrder.Insert(index, item);
     }
 }
 public void SetOutputOrders(List <OutputOrder> data)
 {
     // OutputOrder = new ObservableCollection<OutputOrder>();
     foreach (var item in data)
     {
         OutputOrder.Add(item);
     }
     saveToSettings();
 }
        private void ToggleButton_Drop(object sender, DragEventArgs e)
        {
            var btn    = ((ToggleButton)sender);
            var target = (OutputOrder)btn.DataContext;
            var source = (OutputOrder)e.Data.GetData("CrypTool.Alphabets.OutputOrder");

            if (target == source)
            {
                btn.IsChecked = !btn.IsChecked;
                e.Handled     = true;
                return;
            }

            var targetIndex = OutputOrder.IndexOf(target);
            var sourceIndex = OutputOrder.IndexOf(source);

            handleIndex(targetIndex, source);
            handleIndex(sourceIndex, target);

            OutputOrderView.Refresh();
            raiseChange();
        }
        public string GetAlphabet()
        {
            if (ActiveAlphabet == null)
            {
                return(string.Empty);
            }

            var alp     = ActiveAlphabet.GetAlphabet();
            var builder = new StringBuilder();

            foreach (var item in OutputOrder.OrderBy(x => x.Index).Where(x => x.IsActive))
            {
                try
                {
                    var obj = alp.SingleOrDefault(x => x.OutputOrderType == item.OutputType);
                    builder.Append(obj.Output);
                }
                catch (Exception)
                { }
            }

            return(builder.ToString());
        }