Beispiel #1
0
        public void ChangeValue()
        {
            _currentValue++;
            _slider.value = _currentValue;

            NewValue.Invoke();
        }
Beispiel #2
0
        private XElement DoChangeElement(XElement target, bool throwOnError, XDiffOptions options)
        {
            var e = Find(target, BasisElement, options);

            if (null == e)
            {
                if (throwOnError)
                {
                    throw new Exception("cannot find target for " + BasisElement);
                }
                return(target);
            }
            if (NewValue.Contains("<") && NewValue.Contains(">"))
            {
                e.Nodes().ToArray().Remove();
                var x = XElement.Parse("<a>" + NewValue + "</a>");
                foreach (var n in x.Nodes())
                {
                    e.Add(n);
                }
            }
            else
            {
                e.Value = NewValue;
            }
            return(target);
        }
Beispiel #3
0
        public new static Author FillBlanks(Gender gender)
        {
            var p = (Author)Person.FillBlanks(gender);

            p.Patronimic = MaleFirstNames[NewValue.Int(MaleFirstNames.Count)] + (gender == Gender.Female? "овна": "ович");
            return(p);
        }
Beispiel #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Element.Length != 0)
            {
                hash ^= Element.GetHashCode();
            }
            if (OldValue.Length != 0)
            {
                hash ^= OldValue.GetHashCode();
            }
            if (NewValue.Length != 0)
            {
                hash ^= NewValue.GetHashCode();
            }
            if (ChangeType != global::Google.Api.ChangeType.Unspecified)
            {
                hash ^= ChangeType.GetHashCode();
            }
            hash ^= advices_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public TOutput CompareTo <TOutput>(
            T oldValue,
            Func <TOutput> less,
            Func <TOutput> greater,
            Func <TOutput> equal = null
            )
        {
            Func <TOutput> invokable = () => default;
            var            equals    = ((Equality)NewValue.CompareTo(oldValue));

            if (equals == Equality.Less)
            {
                invokable = less;
            }
            else if (equals == Equality.Greater)
            {
                invokable = greater;
            }
            else
            {
                invokable = equal;
            }

            return(invokable != null
                ? invokable.Invoke()
                : default);
 public void CheckModified()
 {
     if (_noCheck)
     {
         return;
     }
     if (string.Empty.Equals(NewValue))
     {
         NewValue = null;
     }
     if (NewValue == null)
     {
         if (OldValue != null)
         {
             _modified = true;
         }
         else
         {
             _modified = false;
         }
     }
     else
     if (OldValue != null)
     {
         _modified = !(NewValue.Equals(OldValue));
     }
     else
     {
         _modified = true;
     }
 }
Beispiel #7
0
 private void ResolveAddedObjects()
 {
     AddedObjects.Clear();
     foreach (var addedMember in NewValue.Where(pm => !OldValue.Contains(pm)))
     {
         AddedObjects.Add(addedMember);
     }
 }
Beispiel #8
0
 private void ResolveRemovedObjects()
 {
     RemovedObjects.Clear();
     foreach (var removedMember in OldValue.Where(pm => !NewValue.Contains(pm)))
     {
         RemovedObjects.Add(removedMember);
     }
 }
Beispiel #9
0
        public static DbAuthor FillBlanks(Gender gender)
        {
            var p = NewPerson.FillBlanks(gender);
            var b = new DbAuthor(p.First, p.Last, p.Patronimic, (eWriterType)NewValue.Int(2));

            All.Add(b);
            return(b);
        }
    public int[,] SolveMatrix()
    {
        InputProgram facts = new ASPInputProgram();


        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                if (riddleGrid[i, j] != 0 && solvedGrid[i, j] != 1)
                {
                    try
                    {
                        solvedGrid[i, j] = 1;
                        facts.AddObjectInput(new Value(i, j, riddleGrid[i, j]));
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.ToString());
                        Console.Write(e.StackTrace);
                    }
                }
            }
        }

        handler.AddProgram(facts);

        Output o = handler.StartSync();

        AnswerSets answers = (AnswerSets)o;

        foreach (AnswerSet a in answers.Answersets)
        {
            try
            {
                foreach (object obj in a.Atoms)
                {
                    if (!(obj is NewValue))
                    {
                        continue;
                    }

                    NewValue newValue = (NewValue)obj;
                    riddleGrid[newValue.getRow(), newValue.getColumn()] = newValue.getValue();
                }

                //Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }

        return(riddleGrid);
    }
Beispiel #11
0
 public WaveDataSource(double amplitude, double frequency)
 {
     _amplitude      = amplitude;
     _frequency      = frequency;
     _start          = DateTime.UtcNow;
     _timer          = new Timer(100);
     _timer.Elapsed += (s, e) => NewValue?.Invoke(CurrentValue());
     _timer.Start();
 }
Beispiel #12
0
 private void DictForm_Load(object sender, EventArgs e)
 {
     this.Icon           = global::BOF.Properties.Resources.document;
     txtSCode.DataMember = "SCode";
     txtName.DataMember  = "Name";
     if (NewValue != null && Common.IsNullOrEmpty(this.Text))
     {
         this.Text = NewValue.ToString();
     }
 }
Beispiel #13
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + Name.GetHashCode();
         hash = hash * 23 + OldValue.GetHashCode();
         hash = hash * 23 + NewValue.GetHashCode();
         return(hash);
     }
 }
        public static DbReader FillBlanks(Gender gender)
        {
            var p = NewPerson.FillBlanks(gender);
            var b = new DbReader(p.First, p.Last, p.Patronimic, $"{GroupNames.Random()}-{NewValue.Int(15,18)}-{NewValue.Int(1,3)}")
            {
                AccessLevel = (byte)NewValue.Int(2)
            };

            All.Add(b);
            return(b);
        }
            private void ResetButton_Clicked(object sender, EventArgs e)
            {
                /*if (!(sender is Button button)) return;
                 * if (!(button.Tag is NumericUpDown numericUpDown)) return;
                 * if (!(numericUpDown.Tag is FileFormat.PrintParameterModifier modifier)) return;
                 * numericUpDown.Value = modifier.OldValue;*/

                NewValue.Value = Modifier.OldValue;
                NewValue.Select();
                return;
            }
Beispiel #16
0
 private void DoGrade(Person p)
 {
     if (NewValue == "+1")
     {
         p.Grade = p.Grade + 1;
     }
     else
     {
         p.Grade = NewValue.ToInt2();
     }
 }
Beispiel #17
0
 public static long ReadLines(Stream stream, Encoding encoding, byte[] workingBuffer, string separator,
                              NewValue onNewValue, IMetricsHost metrics = null, CancellationToken cancellationToken = default)
 {
     unsafe
     {
         NewLine onNewLine = (lineNumber, partial, start, length, e, m) =>
         {
             LineValuesReader.ReadValues(lineNumber, start, length, e, separator, onNewValue, m);
         };
         return(ReadLines(stream, encoding, workingBuffer, onNewLine, metrics, cancellationToken));
     }
 }
Beispiel #18
0
 public override void AcceptChildren(WSqlFragmentVisitor visitor)
 {
     if (Column != null)
     {
         Column.Accept(visitor);
     }
     if (NewValue != null)
     {
         NewValue.Accept(visitor);
     }
     base.AcceptChildren(visitor);
 }
Beispiel #19
0
 private void Add_Click(object sender, EventArgs e)
 {
     if (NewValue.Text.Trim() != "")
     {
         checkedListBox1.Items.Add(NewValue.Text);
         NewValue.Text = "";
     }
     else
     {
         MessageBox.Show("请输入一个字符串!");
         NewValue.Focus();
     }
 }
Beispiel #20
0
            public override bool Equals(object otherObject)
            {
                if (otherObject is AttributeUpdate)
                {
                    var otherUpdate = otherObject as AttributeUpdate;
                    return(EntityGuid.Equals(otherUpdate.EntityGuid) &&
                           ComponentName.Equals(otherUpdate.ComponentName) &&
                           AttributeName.Equals(otherUpdate.AttributeName) &&
                           NewValue.Equals(otherUpdate.NewValue));
                }

                return(false);
            }
        public static long ReadLines(Stream stream, Encoding encoding, byte[] buffer, string separator,
                                     NewValue onNewValue, ISafeLogger logger = null, IMetricsHost metrics = null,
                                     CancellationToken cancellationToken     = default)
        {
            unsafe
            {
                void OnNewLine(long lineNumber, bool partial, byte *start, int length, Encoding e)
                {
                    LineValuesReader.ReadValues(lineNumber, start, length, e, separator, onNewValue);
                }

                return(ReadLines(stream, encoding, buffer, OnNewLine, logger, metrics, cancellationToken));
            }
        }
Beispiel #22
0
        private void OnNewText(string text)
        {
            if (string.IsNullOrWhiteSpace(text) ||
                !Storage.ContainsKey(text))
            {
                NotHandledText?.Invoke(Text);
                return;
            }

            HandledText?.Invoke(Text);

            var value = Storage[text];

            NewValue?.Invoke(text, value);
        }
Beispiel #23
0
        public override String ToString()
        {
            var parts = new List <String>();

            parts.Add(PropertyName);
            if (_valuesAreProvided)
            {
                parts.Add(String.Format("+[{0}], -[{1}]", NewValue.ToInvariantString() ?? "null", OldValue.ToInvariantString() ?? "null"));
            }
            if (_tagIsProvided)
            {
                parts.Add(Tag.ToInvariantString());
            }
            return(parts.StringJoin(": "));
        }
Beispiel #24
0
        public void AddValue(double value)
        {
            _values.Add(value);

            // => Benachrichtigen

            // Option 1
            //if (NewValue != null)
            //{
            //    NewValue(value);
            //}

            // Option 2
            NewValue?.Invoke(this, value);
        }
Beispiel #25
0
 private void DoGrade(Person p)
 {
     if (NewValue == "+1")
     {
         p.Grade = p.Grade + 1;
     }
     else if (NewValue.Equal("none"))
     {
         p.Grade = null;
     }
     else
     {
         p.Grade = NewValue.ToInt2();
     }
 }
Beispiel #26
0
        private void DoApprovalCodes(Person p)
        {
            if (!NewValue.HasValue())
            {
                modelState.AddModelError("NewValue", "Must not be blank");
                return;
            }

            var i = p.Volunteers.SingleOrDefault();

            if (i == null)
            {
                i = new Volunteer {
                    PeopleId = p.PeopleId
                };
                DbUtil.Db.Volunteers.InsertOnSubmit(i);
                DbUtil.Db.SubmitChanges();
            }

            var code = NewValue.ToInt();
            var app  = (from v in DbUtil.Db.VoluteerApprovalIds
                        where v.ApprovalId == Math.Abs(code)
                        where v.PeopleId == p.PeopleId
                        select v).SingleOrDefault();

            if (code < 0)
            {
                if (app != null)
                {
                    DbUtil.Db.VoluteerApprovalIds.DeleteOnSubmit(app);
                }
            }
            else if (code > 0)
            {
                if (app == null)
                {
                    p.VoluteerApprovalIds.Add(new VoluteerApprovalId {
                        ApprovalId = code,
                    });
                }
            }
            else if (code == 0)
            {
                DbUtil.Db.VoluteerApprovalIds.DeleteAllOnSubmit(p.VoluteerApprovalIds);
            }
        }
        public bool HasChanged(object source)
        {
            OldValue = NewValue;
            NewValue = Property.GetValue(source);

            if (OldValue != null)
            {
                return(!OldValue.Equals(NewValue));
            }

            if (NewValue != null)
            {
                return(!NewValue.Equals(OldValue));
            }

            return(false);
        }
Beispiel #28
0
        public string TrimCommentsAndSpaces(string value)
        {
            string NewValue;

            if (value.IndexOf(CommentDelimiter) == -1)
            {
                NewValue = value;
            }
            else
            {
                NewValue = value.Substring(0, value.IndexOf(CommentDelimiter));
            }

            NewValue = NewValue.TrimStart(' ', '\t').TrimEnd(' ', '\t');

            return(NewValue);
        }
Beispiel #29
0
        /// <summary>
        /// Produce a description that may be useful in debugging event handling and the undo manager.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string str = PresentationName + ": " + SubHint.ToString(NumberFormatInfo.InvariantInfo);

            if (Object != null)
            {
                str = str + " " + Object.ToString();
                IGoLabeledPart goLabeledPart = Object as IGoLabeledPart;
                if (goLabeledPart != null)
                {
                    str = str + " \"" + goLabeledPart.Text + "\"";
                }
            }
            if (IsBeforeChanging)
            {
                str += " (before)";
            }
            str += ";";
            if (OldInt != 0)
            {
                str = str + " " + OldInt.ToString(NumberFormatInfo.InvariantInfo);
            }
            if (OldValue != null)
            {
                str = str + " (" + OldValue.ToString() + ")";
            }
            if (OldRect != default(RectangleF))
            {
                str = str + " [" + OldRect.X.ToString(NumberFormatInfo.InvariantInfo) + "," + OldRect.Y.ToString(NumberFormatInfo.InvariantInfo) + " " + OldRect.Width.ToString(NumberFormatInfo.InvariantInfo) + "x" + OldRect.Height.ToString(NumberFormatInfo.InvariantInfo) + "]";
            }
            str += " -->";
            if (NewInt != 0)
            {
                str = str + " " + NewInt.ToString(NumberFormatInfo.InvariantInfo);
            }
            if (NewValue != null)
            {
                str = str + " (" + NewValue.ToString() + ")";
            }
            if (NewRect != default(RectangleF))
            {
                str = str + " [" + NewRect.X.ToString(NumberFormatInfo.InvariantInfo) + "," + NewRect.Y.ToString(NumberFormatInfo.InvariantInfo) + " " + NewRect.Width.ToString(NumberFormatInfo.InvariantInfo) + "x" + NewRect.Height.ToString(NumberFormatInfo.InvariantInfo) + "]";
            }
            return(str);
        }
Beispiel #30
0
        private void DoBackgroundChecks(Person p)
        {
            if (!DateValid())
            {
                return;
            }
            var i = p.Volunteers.SingleOrDefault();

            if (i == null)
            {
                i = new Volunteer {
                    PeopleId = p.PeopleId
                };
                DbUtil.Db.Volunteers.InsertOnSubmit(i);
                DbUtil.Db.SubmitChanges();
            }
            i.ProcessedDate = NewValue.ToDate();
        }