Exemple #1
0
 public virtual void InvokeEditedEvent(BackupObject obj)
 {
     if (Edited != null)
     {
         Edited.Invoke(obj);
     }
 }
Exemple #2
0
 private void tryDelete(DrawableTile tile)
 {
     confirmation.Push("Are you sure you want to delete action for this tile?", () =>
     {
         Edited?.Invoke(tile, null);
     });
 }
Exemple #3
0
 public Message(dynamic Data)
 {
     _edited = new Edited(Data.edited);
     _text   = Data.message.text;
     _ts     = new Slack.TimeStamp((String)Data.message.ts);
     _user   = Data.message.user;
 }
 private void ViewModel_Deleted(object sender, EventArgs e)
 {
     if (sender is KeyBindingViewModel keyBinding)
     {
         _keyBindings.Remove(keyBinding.Model);
         KeyBindings.Remove(keyBinding);
         Edited?.Invoke(Command, _keyBindings);
     }
 }
Exemple #5
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 397) ^ MessageID.GetHashCode();
            hash = (hash * 397) ^ Edited.GetHashCode();

            return(hash);
        }
        public void Edit(string newTitle)
        {
            var oldTitle = Title;

            Title = newTitle;

            Edited.Fire(this, new EditedArgs {
                OldTitle = oldTitle
            });
        }
Exemple #7
0
 public void Redo()
 {
     if (stackRedo.Any())
     {
         var op = stackRedo.Pop();
         op.Invoke();
         stackUndo.Push(op);
     }
     StatusChanged?.Invoke(stackUndo.Any(), stackRedo.Any());
     Edited.Invoke();
 }
Exemple #8
0
 public void AddOperation(Operation operation)
 {
     if (!IsOperationValid(operation))
     {
         return;
     }
     stackUndo.Push(operation);
     stackRedo.Clear();
     StatusChanged?.Invoke(stackUndo.Any(), stackRedo.Any());
     Edited.Invoke();
 }
        public void RemoveVariable(NodeGraphVariable graphVariable)
        {
            NodeEditor.Assertions.IsTrue(Variables.Contains(graphVariable));
            NodeEditor.Logger.Log <NodeGraph>("Removing variable '{0}'", graphVariable.Name);

            Variables.Remove(graphVariable);
            VariableRemoved.InvokeSafe(graphVariable);
            graphVariable.Remove();

            Edited.InvokeSafe(this);
        }
        public void Disconnect(NodeConnection connection)
        {
            bool containsConnection = Connections.Contains(connection);

            NodeEditor.Assertions.IsTrue(containsConnection);

            if (containsConnection)
            {
                Connections.Remove(connection);
                NodeEditor.Logger.Log <NodeGraph>("Disconnected {0} from {1}.", connection.SourcePin.Node.Name, connection.TargetPin.Node.Name);
                Edited.InvokeSafe(this);
            }
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Value"></param>
        protected virtual void OnEdited(bool Value)
        {
            IsEditable = Value;

            if (Value)
            {
                Focus();
            }
            else
            {
                Edited?.Invoke(this, new EventArgs <string>(Text));
            }
        }
        public void Connect(NodeConnection connection)
        {
            bool hasConnection = Connections.Contains(connection);

            NodeEditor.Assertions.IsFalse(hasConnection);
            NodeEditor.Assertions.WarnIsNotNull(connection.SourcePin, "Attempted to connect two pins where the start pin was null.");
            NodeEditor.Assertions.WarnIsNotNull(connection.TargetPin, "Attempted to connect two pins where the end pin was null.");
            NodeEditor.Assertions.WarnIsFalse(connection.SourcePin == connection.TargetPin, "Attempted to connect a pin to itself.");
            //Assert.IsFalse(connection.StartPin.WillPinConnectionCreateCircularDependency(connection.EndPin), "Pin connection would create a circular dependency!");

            var canConnect = connection.SourcePin != null &&
                             connection.TargetPin != null &&
                             connection.SourcePin != connection.TargetPin;

            if (canConnect)
            {
                var existingConnectionOnStartPin = Helper.GetConnections(connection.SourcePin);
                var existingConnectionOnEndPin   = Helper.GetConnections(connection.TargetPin);

                if (connection.Type == NodeConnectionType.Execute)
                {
                    // Only one connection is allowed between any two execute pins.
                    existingConnectionOnStartPin.ForEach(x => Connections.Remove(x));
                    existingConnectionOnEndPin.ForEach(x => Connections.Remove(x));
                }
                else if (connection.Type == NodeConnectionType.Value)
                {
                    // Input pins on value types can never have multiple connections. Remove existing connections.
                    existingConnectionOnEndPin.ForEach(x => Connections.Remove(x));
                }

                var startPinId = connection.SourcePin.Index;
                var endPinId   = connection.TargetPin.Index;

                connection.SourcePin.Connect(connection.TargetPin);
                connection.TargetPin.Connect(connection.SourcePin);

                // Check if the pin has changed after connecting. This will happen for dynamic pin types.
                if (connection.SourcePin.Node.Pins[startPinId] != connection.SourcePin || connection.TargetPin.Node.Pins[endPinId] != connection.TargetPin)
                {
                    connection = new NodeConnection(connection.LeftNode.Pins[startPinId], connection.RightNode.Pins[endPinId]);
                }

                Connections.Add(connection);

                NodeEditor.Logger.Log <NodeGraph>("Connected {0}:(1) to {2}:{3}", connection.LeftNode.Name, connection.SourcePin.Name, connection.RightNode.Name, connection.TargetPin.Name);

                Edited.InvokeSafe(this);
            }
        }
        public async Task Add()
        {
            var newKeyBinding = new KeyBindingViewModel(new KeyBinding {
                Command = Command
            }, _dialogService);

            if (await newKeyBinding.Edit().ConfigureAwait(true))
            {
                newKeyBinding.Deleted += ViewModel_Deleted;
                newKeyBinding.Edited  += ViewModel_Edited;
                KeyBindings.Add(newKeyBinding);
                _keyBindings.Add(newKeyBinding.Model);
                Edited?.Invoke(Command, _keyBindings);
            }
        }
        NodeGraphVariable AddVariable(NodeGraphVariableData graphVariableData)
        {
            NodeEditor.Assertions.IsFalse(Variables.Any(x => x.ID == graphVariableData.ID), "Tried to spawn a variable that has the same ID as an existing variable.");

            var variable = new NodeGraphVariable(graphVariableData);

            variable.NameChangeRequested += Variable_NameChangeRequested;
            Variables.Add(variable);

            NodeEditor.Logger.Log <NodeGraph>("Added variable '{0}' ({1})", variable.Name, variable.GetType());

            VariableAdded.InvokeSafe(variable);
            Edited.InvokeSafe(this);

            return(variable);
        }
        void RegisterNode(Node node)
        {
            NodeEditor.Assertions.IsFalse(Nodes.Contains(node), "Node already exists in this graph.");

            if (!Nodes.Contains(node))
            {
                NodeEditor.Logger.Log <NodeGraph>("Registered node.");
                node.Destroyed  += RemoveNode;
                node.Changed    += Node_Changed;
                node.PinRemoved += Node_PinRemoved;

                Nodes.Add(node);
                NodeAdded.InvokeSafe(node);

                Edited.InvokeSafe(this);
            }
        }
Exemple #16
0
 public override string ToString()
 {
     return($"Name: {Name}{Environment.NewLine}" +
            $"Model: {Model}{Environment.NewLine}" +
            $"Starship Class: {StarshipClass}{Environment.NewLine}" +
            $"Manufacturer: {Manufacturer}{Environment.NewLine}" +
            $"Cost in Credits: {CostInCredits}{Environment.NewLine}" +
            $"Length: {Length}{Environment.NewLine}" +
            $"Crew: {Crew}{Environment.NewLine}" +
            $"Passengers: {Passengers}{Environment.NewLine}" +
            $"Max Atmosphering Speed: {MaxAtmospheringSpeed}{Environment.NewLine}" +
            $"Hyperdrive Rating: {HyperdriveRating}{Environment.NewLine}" +
            $"MGLT: {Mglt}{Environment.NewLine}" +
            $"Cargo Capacity: {CargoCapacity}{Environment.NewLine}" +
            $"Consumables: {Consumables}{Environment.NewLine}" +
            $"Films: {string.Join(", ", Films ?? new List<string>())}{Environment.NewLine}" +
            $"Pilots: {string.Join(", ", Pilots ?? new List<string>())}{Environment.NewLine}" +
            $"Url: {Url}{Environment.NewLine}" +
            $"Created at: {Created.ToString("yyyy-MM-dd HH:mm")}{Environment.NewLine}" +
            $"Edited at: {Edited.ToString("yyyy-MM-dd HH:mm")}{Environment.NewLine}");
 }
Exemple #17
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JToken token   = JToken.Load(reader);
            string special = token.Value <string>();

            Edited edit = new Edited {
                IsEdited = special == "true"
            };

            if (!edit.IsEdited)
            {
                double timeEdited;
                if (double.TryParse(special, out timeEdited))
                {
                    edit.IsEdited   = true;
                    edit.TimeEdited = DateUtils.FromUnixTime((long)timeEdited);
                }
            }

            return(edit);
        }
        public void RemoveNode(Node node)
        {
            NodeEditor.Assertions.IsTrue(Nodes.Contains(node), "Node Graph does not contain node.");

            if (Nodes.Contains(node))
            {
                NodeEditor.Logger.Log <NodeGraph>("Removing node.");
                Selection = null;
                node.Dispose();
                Nodes.Remove(node);
                NodeRemoved.InvokeSafe(node);

                // TODO: Gracefully handle disconnections...
                var connections = Connections
                                  .Where(x => x.SourcePin.Node.ID == node.ID || x.TargetPin.Node.ID == node.ID)
                                  .ToList();

                connections.ForEach(x => Disconnect(x));

                Edited.InvokeSafe(this);
            }
        }
Exemple #19
0
 /// <summary>
 ///     Raises the <see cref="Edited" /> event.
 /// </summary>
 /// <param name="e">An <see cref="EditGlobalObjectEventArgs" /> that contains the event data. </param>
 public virtual void OnEdited(EditGlobalObjectEventArgs e)
 {
     Edited?.Invoke(this, e);
 }
Exemple #20
0
 /// <summary>
 ///     Raises the <see cref="Edited" /> event.
 /// </summary>
 /// <param name="e">An <see cref="EditPlayerObjectEventArgs" /> that contains the event data. </param>
 public virtual void OnEdited(EditPlayerObjectEventArgs e)
 {
     Edited?.Invoke(this, e);
 }
Exemple #21
0
 public void OnEdited(IRibbonControl control, string text)
 => Edited?.Invoke(control, text);
Exemple #22
0
 public void handleEdit()
 {
     Edited?.Invoke(this, Base);
 }
 private void Edit()
 {
     Edited?.Invoke(this, new EventArgs());
 }
Exemple #24
0
 public void InvokeEdited()
 {
     Edited?.Invoke(this, EventArgs.Empty);
     Dismiss();
 }
 /// <summary>
 /// Called when curve gets edited.
 /// </summary>
 public void OnEdited()
 {
     Edited?.Invoke();
 }
        async void Save_Clicked(object sender, EventArgs e)
        {
            if (IsBusy || input.IsVisible)
            {
                return;
            }
            IsBusy = true;

            var result = await DataBase.Manager.EditTextAsync(Name, Text);

            if (result != DataBase.ReturnCode.Success)
            {
                IsBusy = false;
                await DisplayAlert(Resource.Error, Resource.SaveFileError + " " + result.GetDescription(), Resource.Ok);

                return;
            }

            string description;

            if (string.IsNullOrWhiteSpace(Text))
            {
                description = Resource.EmptyFile;
            }
            else if (Settings.Storage.UseKeyWords)
            {
                try
                {
                    var words = await CognitiveServices.TextAnalytics.KeyPhrasesAsync(new[] { Text });

                    if (words[0].Length > 0)
                    {
                        description = string.Join("; ", words[0]);
                    }
                    else
                    {
                        description = Resource.NoKeyWords;
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert(Resource.Error, Resource.GetKeyWordsError + " " + ex.Message, Resource.Ok);

                    description = Text;
                }
            }
            else
            {
                description = Text.Trim();
            }

            if (description.Length > 200)
            {
                description = description.Substring(0, 200);
            }

            result = await DataBase.Manager.EditDescriptionAsync(Name, description);

            if (result != DataBase.ReturnCode.Success)
            {
                IsBusy = false;
                await DisplayAlert(Resource.Error, Resource.UpdatingDescriptionError + " " + result.GetDescription(), Resource.Ok);

                return;
            }

            Edited?.Invoke(this, new EditEventArgs(Name, description, Text));

            IsBusy = false;
        }
 public virtual void OnEdited(PlayerEditEventArgs e)
 {
     AssertNotDisposed();
     Edited?.Invoke(this, e);
 }
 void Node_PinRemoved(NodePin pin)
 {
     Disconnect(pin);
     Edited.InvokeSafe(this);
 }
 void Node_Changed(Node node)
 {
     NodeEditor.Logger.Log <NodeGraph>("Node {0} changed.", node.Name);
     Edited.InvokeSafe(this);
 }
Exemple #30
0
 protected virtual void OnEdited(EditedEventArgs eventArgs)
 {
     Edited?.Invoke(this, eventArgs);
 }