Esempio n. 1
0
 private void handleIndex(int index, OutputOrder item)
 {
     if (index > -1)
     {
         OutputOrder.Remove(item);
         OutputOrder.Insert(index, item);
     }
 }
Esempio n. 2
0
 public void SetOutputOrders(List <OutputOrder> data)
 {
     // OutputOrder = new ObservableCollection<OutputOrder>();
     foreach (var item in data)
     {
         OutputOrder.Add(item);
     }
     saveToSettings();
 }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        public string GetAlphabet()
        {
            if (ActiveAlphabet == null)
            {
                return(string.Empty);
            }

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

            foreach (var item in OutputOrder.OrderByDescending(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());
        }