예제 #1
0
        public override void AddLine(LineSpan line, bool willUpdateImmediately)
        {
            bool isTouching = false;

            if (line.FirstLine - 1 <= LineNumber &&
                LineNumber <= line.LastLine + 1 &&
                line.LastLine - line.FirstLine >= MinimumLength &&
                line.Indent == Position)
            {
                isTouching = true;
            }

            if (line.Highlight != isTouching)
            {
                line.Highlight = isTouching;
                if (!willUpdateImmediately)
                {
                    Modified.Add(line);
                }
                Modified.AddRange(line.LinkedLines);
            }
        }
예제 #2
0
        // Creates a basic Source type that contains common attributes needed
        // to describe to the remote peer the features and expectations of the
        // Source of the Receiver link.
        private static Source CreateBasicSource()
        {
            Source source = new Source();

            // These are the outcomes this link will accept.
            Symbol[] outcomes = new Symbol[] { new Symbol("amqp:accepted:list"),
                                               new Symbol("amqp:rejected:list"),
                                               new Symbol("amqp:released:list"),
                                               new Symbol("amqp:modified:list") };

            // Default Outcome for deliveries not settled on this link
            Modified defaultOutcome = new Modified();

            defaultOutcome.DeliveryFailed    = true;
            defaultOutcome.UndeliverableHere = false;

            // Configure Source.
            source.DefaultOutcome = defaultOutcome;
            source.Outcomes       = outcomes;

            return(source);
        }
예제 #3
0
        private void RemoveItem_Click(object sender, EventArgs e)
        {
            if (SelectedFrame == null)
            {
                return;
            }

            int index = SelectedFrame.Parent.Controls.IndexOf(SelectedFrame);

            SelectedFrame.Parent.Controls.Remove(SelectedFrame);
            _direction.Frames.RemoveAt(_direction.Frames.Count - 1 - index);

            if (index < ImagesPanel.Controls.Count && ImagesPanel.Controls[index] is FramePanel)
            {
                SelectedFrame = (FramePanel)ImagesPanel.Controls[index];
            }
            else
            {
                SelectedFrame = null;
            }
            Modified?.Invoke(this, new EventArgs());
        }
예제 #4
0
        /// <summary>
        /// Returns a string representation of this object and its properties
        /// </summary>
        /// <returns>A string value</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (Type == FtpFileSystemObjectType.File)
            {
                sb.Append("FILE");
            }
            else if (Type == FtpFileSystemObjectType.Directory)
            {
                sb.Append("DIR ");
            }
            else if (Type == FtpFileSystemObjectType.Link)
            {
                sb.Append("LINK");
            }
            sb.Append("   ");
            sb.Append(Name);
            if (Type == FtpFileSystemObjectType.File)
            {
                sb.Append("      ");
                sb.Append("(");
                sb.Append(Size.FileSizeToString());
                sb.Append(")");
            }
            if (Created != null && Created != DateTime.MinValue)
            {
                sb.Append("      ");
                sb.Append("Created : ");
                sb.Append(Created.ToString());
            }
            if (Modified != null && Modified != DateTime.MinValue)
            {
                sb.Append("      ");
                sb.Append("Modified : ");
                sb.Append(Modified.ToString());
            }
            return(sb.ToString());
        }
예제 #5
0
        private void LoadSIPAssetsFromXML(XmlDocument xmlDom)
        {
            Dictionary <Guid, object> assets = (new T()).Load(xmlDom);

            m_sipAssets.Clear();
            foreach (KeyValuePair <Guid, object> keyValPair in assets)
            {
                m_sipAssets.Add(keyValPair.Key, (T)keyValPair.Value);
            }

            Modified?.Invoke();

            if (m_xmlFileWatcher == null)
            {
                string dir  = Path.GetDirectoryName(m_xmlAssetFilePath);
                string file = Path.GetFileName(m_xmlAssetFilePath);
                Logger.Logger.Debug("Starting file 1 watch on " + dir + " and " + file + ".");
                m_xmlFileWatcher                     = new FileSystemWatcher(dir, file);
                m_xmlFileWatcher.Changed            += new FileSystemEventHandler(AssetXMLFileChanged);
                m_xmlFileWatcher.EnableRaisingEvents = true;
            }
        }
예제 #6
0
        public override void OnEndUpdate(ItemBase updatedAttribute)
        {
            Modified?.Invoke(this);
            // get default analysis solver
            if (_solver != null)
            {
                // clear solutions
                _solutions.Clear();
                _solver.ProcessAnalysis(this);
            }
            else
            {
                _log.Error("_solver == null : solver was not set");
            }

            if (_solutions.Count == 0)
            {
                _log.Debug("Recomputed analysis has no solutions");
            }
            // set modified / propagate modifications
            Modify();
        }
예제 #7
0
        public TriggerView(Lazurite.MainDomain.TriggerBase trigger)
        {
            InitializeComponent();

            Refresh(trigger);

            buttons.AddNewClick += () => complexActionView.AddFirst();

            btScaleMinus.Click += (o, e) => {
                scale.ScaleX -= 0.1;
                scale.ScaleY -= 0.1;
            };

            btScalePlus.Click += (o, e) => {
                scale.ScaleX += 0.1;
                scale.ScaleY += 0.1;
            };

            complexActionView.Modified += (element) => Modified?.Invoke();

            btSelectScenario.Click += (o, e) => {
                SelectScenarioView.Show(
                    (selectedScenario) => {
                    if (_trigger.GetScenario() != null && !_trigger.GetScenario().ValueType.IsCompatibleWith(selectedScenario.ValueType))
                    {
                        _trigger.TargetAction = new ComplexAction();
                    }
                    _trigger.TargetScenarioId = selectedScenario.Id;
                    _trigger.SetScenario(selectedScenario);
                    Refresh(trigger);
                    Modified?.Invoke();
                },
                    null,
                    ActionInstanceSide.OnlyRight,
                    _trigger.TargetScenarioId
                    );
            };
        }
예제 #8
0
        private Outcome GetModifiedOutcome(IDictionary <string, object> propertiesToModify, bool undeliverableHere)
        {
            object   obj;
            Modified modified = new Modified();

            if (undeliverableHere)
            {
                modified.UndeliverableHere = new bool?(true);
            }
            if (propertiesToModify != null)
            {
                modified.MessageAnnotations = new Fields();
                foreach (KeyValuePair <string, object> keyValuePair in propertiesToModify)
                {
                    if (!MessageConverter.TryGetAmqpObjectFromNetObject(keyValuePair.Value, MappingType.ApplicationProperty, out obj))
                    {
                        continue;
                    }
                    modified.MessageAnnotations.Add(keyValuePair.Key, obj);
                }
            }
            return(modified);
        }
예제 #9
0
        /// <summary>
        /// Updates the tree definition.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="definition">The definition.</param>
        internal void UpdateTreeDefinition(IRepository repository, TreeDefinition definition)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (definition == null)
            {
                throw new ArgumentNullException(nameof(definition));
            }

            var buffer = new StringBuilder();

            foreach (var change in Modified.Concat(Added))
            {
                change.New.ToJson(buffer);
                definition.Add(change.Path, repository.CreateBlob(buffer), Mode.NonExecutableFile);
            }
            foreach (var deleted in Deleted)
            {
                definition.Remove(deleted.Path);
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Url != null)
         {
             hashCode = hashCode * 59 + Url.GetHashCode();
         }
         if (Images != null)
         {
             hashCode = hashCode * 59 + Images.GetHashCode();
         }
         if (Source != null)
         {
             hashCode = hashCode * 59 + Source.GetHashCode();
         }
         if (Cuisine != null)
         {
             hashCode = hashCode * 59 + Cuisine.GetHashCode();
         }
         if (Created != null)
         {
             hashCode = hashCode * 59 + Created.GetHashCode();
         }
         if (Modified != null)
         {
             hashCode = hashCode * 59 + Modified.GetHashCode();
         }
         if (NutrientsNotice != null)
         {
             hashCode = hashCode * 59 + NutrientsNotice.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #11
0
        public CompositeScenarioView(CompositeScenario scenario)
        {
            InitializeComponent();

            buttons.AddNewClick += () => complexActionView.AddFirst();

            btScaleMinus.Click += (o, e) => {
                if (scale.ScaleY > 0.2)
                {
                    scale.ScaleX -= 0.1;
                    scale.ScaleY -= 0.1;
                }
            };

            btScalePlus.Click += (o, e) => {
                scale.ScaleX += 0.1;
                scale.ScaleY += 0.1;
            };

            btSettings.Click += (o, e) => {
                ActionControlResolver.BeginCompositeScenarioSettings(
                    _scenario,
                    (result) => {
                    if (result)
                    {
                        Modified?.Invoke();
                    }
                });
            };

            _scenario = scenario;
            Refresh();
            complexActionView.BeginInit();
            complexActionView.Refresh(new ActionHolder(_scenario.TargetAction), _scenario);
            complexActionView.EndInit();
            complexActionView.Modified += (element) => Modified?.Invoke();
        }
예제 #12
0
        public Word Clone()
        {
            var clone = new Word
            {
                Id           = Id.Clone() as string,
                Vernacular   = Vernacular.Clone() as string,
                Plural       = Plural.Clone() as string,
                Created      = Created.Clone() as string,
                Modified     = Modified.Clone() as string,
                PartOfSpeech = PartOfSpeech.Clone() as string,
                OtherField   = OtherField.Clone() as string,
                ProjectId    = ProjectId.Clone() as string,
                Audio        = new List <string>(),
                EditedBy     = new List <string>(),
                History      = new List <string>(),
                Senses       = new List <Sense>()
            };

            foreach (var file in Audio)
            {
                clone.Audio.Add(file.Clone() as string);
            }
            foreach (var id in EditedBy)
            {
                clone.EditedBy.Add(id.Clone() as string);
            }
            foreach (var id in History)
            {
                clone.History.Add(id.Clone() as string);
            }
            foreach (var sense in Senses)
            {
                clone.Senses.Add(sense.Clone());
            }

            return(clone);
        }
예제 #13
0
        public virtual LocalEmbed ToEmbed()
        {
            var embed = new LocalEmbed()
            {
                Title        = $"{Name} ({ShortName})",
                Description  = Description,
                ThumbnailUrl = IconUrl,
                Color        = Grid.Color,
                Url          = WikiUrl
            };

            embed.AddField("Weight", $"{Weight} kg", true);

            var width  = Grid.Width;
            var height = Grid.Height;

            embed.AddField("Size", $"{width}x{height} ({width * height})", true);

            embed.AddField("Base Price", $"{Price:#,##0} ₽", true);

            embed.WithFooter($"{Kind.Humanize()} • Modified {Modified.Humanize()}");

            return(embed);
        }
예제 #14
0
 public void BeginEditAction()
 {
     ActionControlResolver.UserInitialize(
         (result) => {
         if (result)
         {
             Model.Refresh(ActionHolder);
             Modified?.Invoke(this);
             if (MasterAction != null && !MasterAction.ValueType.IsCompatibleWith(ActionHolder.Action.ValueType))
             {
                 MessageView.ShowMessage(
                     "Тип действия не совпадает с типом главного действия. Нужно настроить подчиненное действие еще раз.",
                     "Внимание!",
                     Icons.Icon.WarningCircle, null,
                     () => BeginEditAction()
                     );
             }
         }
     },
         ActionHolder.Action,
         MasterAction?.ValueType,
         MasterAction != null,
         MasterAction);
 }
예제 #15
0
파일: TypeSet.cs 프로젝트: shaneasd/ConEdit
 public void ModifyLocalizedString(LocalizedStringData typeData)
 {
     m_types[typeData.TypeId]            = new TypeData((name, id, defaultValue, document) => new LocalizedStringParameter(name, id, typeData.TypeId), typeData.Name);
     m_localizedStrings[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }
예제 #16
0
파일: TypeSet.cs 프로젝트: shaneasd/ConEdit
 public void ModifyInteger(IntegerData typeData)
 {
     m_types[typeData.TypeId]    = new TypeData((name, id, defaultValue, document) => new IntegerParameter(name, id, typeData.TypeId, typeData.Definition(), defaultValue), typeData.Name);
     m_integers[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }
예제 #17
0
파일: TypeSet.cs 프로젝트: shaneasd/ConEdit
 public void ModifyDecimal(DecimalData typeData)
 {
     m_types[typeData.TypeId]    = new TypeData((name, id, defaultValue, document) => new DecimalParameter(name, id, typeData.TypeId, m_decimals[typeData.TypeId].Definition(), defaultValue), typeData.Name);
     m_decimals[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }
예제 #18
0
 protected void RaiseModified(ModifiedEventArgs?e = null)
 => Modified?.Invoke(this, e ?? new ModifiedEventArgs(this));
예제 #19
0
 /// <summary>
 /// Called when a file event occurred.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The file event.</param>
 protected virtual void OnModified(object sender, FileEvent e)
 {
     Modified?.Invoke(sender, e);
 }
예제 #20
0
 protected virtual void OnModified()
 {
     Modified?.Invoke(this, new EventArgs());
 }
예제 #21
0
        public RemoteScenarioView(RemoteScenario scenario)
        {
            InitializeComponent();
            Refresh(scenario);

            tbPort.Validation = (v) => EntryViewValidation.UShortValidation().Invoke(v);

            tbServiceName.TextChanged    += (o, e) => ApplyCurrent();
            tbSecretCode.PasswordChanged += (o, e) => ApplyCurrent();
            tbPort.TextChanged           += (o, e) => ApplyCurrent();
            tbPassword.PasswordChanged   += (o, e) => ApplyCurrent();
            tbLogin.TextChanged          += (o, e) => ApplyCurrent();
            tbHost.TextChanged           += (o, e) => ApplyCurrent();
            btExitingCredentials.Click   += (o, e) => {
                var credentialsSelect = new ExistingConnectionSelect(ClientFactory.ConnectionCredentials);
                var dialog            = new DialogView(credentialsSelect);
                credentialsSelect.SelectedCredentialsChanged += (o1, args) => {
                    tbHost.Text           = args.Value.Host;
                    tbLogin.Text          = args.Value.Login;
                    tbPassword.Password   = args.Value.Password;
                    tbPort.Text           = args.Value.Port.ToString();
                    tbSecretCode.Password = args.Value.SecretKey;
                    tbServiceName.Text    = args.Value.ServiceName;
                    Modified?.Invoke();
                    dialog.Close();
                };
                dialog.Show();
            };
            btScenariosList.Click += (o, e) =>
            {
                try
                {
                    var remoteScenarios = _scenario.GetServer().GetScenariosInfo().Decrypt(_scenario.Credentials.SecretKey).ToArray();
                    if (!remoteScenarios.Any())
                    {
                        throw new Exception("На удаленном сервере отсутсвуют сценарии.");
                    }
                    var selectScenarioControl = new RemoteScenarioSelect(remoteScenarios, _scenario.RemoteScenarioId);
                    var dialog = new DialogView(selectScenarioControl);
                    selectScenarioControl.ScenarioInfoSelected += (info) =>
                    {
                        dialog.Close();
                        _scenario.RemoteScenarioId   = info.ScenarioId;
                        _scenario.RemoteScenarioName = info.Name;
                        tbScenario.Text = _scenario.RemoteScenarioName;
                        var loadWindowCloseToken = MessageView.ShowLoad("Соединение с удаленным сервером...");
                        _scenario.InitializeAsync((result) =>
                        {
                            loadWindowCloseToken.Cancel();
                            Dispatcher.BeginInvoke(new Action(() => {
                                if (result)
                                {
                                    Modified?.Invoke();
                                    Succeed?.Invoke();
                                }
                                else
                                {
                                    WarningHandler.Error("Невозможно получить список сценариев.");
                                    Failed?.Invoke();
                                }
                            }));
                        });
                    };
                    dialog.Show();
                }
                catch (Exception exception)
                {
                    WarningHandler.Error("Невозможно получить список сценариев.", exception);
                    Failed?.Invoke();
                }
            };
            btTest.Click += (o, e) => {
                var loadWindowCloseToken = MessageView.ShowLoad("Соединение с удаленным сервером...");
                _scenario.InitializeAsync((result) => {
                    loadWindowCloseToken.Cancel();
                    if (result)
                    {
                        MessageView.ShowMessage("Соединение успешно!", "Тест удаленного сценария", Icons.Icon.Check);
                        Dispatcher.BeginInvoke(new Action(() => Succeed?.Invoke()));
                    }
                    else
                    {
                        MessageView.ShowMessage("Невозможно активировать удаленный сценарий!", "Тест удаленного сценария", Icons.Icon.Cancel);
                        Dispatcher.BeginInvoke(new Action(() => Failed?.Invoke()));
                    }
                });
            };
        }
예제 #22
0
 public virtual void UpdateProperty(Guid id, string propertyName, object value)
 {
     Modified.Invoke();
     throw new NotImplementedException("Method " + System.Reflection.MethodBase.GetCurrentMethod().Name + " in " + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " not implemented.");
 }
예제 #23
0
파일: TypeSet.cs 프로젝트: shaneasd/ConEdit
 public void AddOther(ParameterType id, string name, ParameterGenerator factory)
 {
     m_types.Add(id, new TypeData(factory, name));
     Modified.Execute(id);
 }
예제 #24
0
 public override void Modify()
 {
     _dirty = true;
     Modified?.Invoke(this, new EventArgs());
 }
예제 #25
0
        public IEnumerable <Guid> CommitEnumerable()
        {
            var response           = new List <Guid>();
            var transactionRequest = new ExecuteTransactionRequest
            {
                Requests = new OrganizationRequestCollection()
            };

            foreach (var entity in Added.Keys)
            {
                Added[entity].PersistAdded(entity);
            }
            foreach (var entity in Modified.Keys)
            {
                Modified[entity].PersistUpdated(entity);
            }
            foreach (var entity in Removed.Keys)
            {
                Removed[entity].PersistRemoved(entity);
            }

            Added.Clear();
            Modified.Clear();
            Removed.Clear();

            try
            {
                for (int i = 0; i < Requests.Count; i += _batchSize)
                {
                    var requestBatch = Requests.Skip(i).Take(_batchSize);

                    transactionRequest.Requests.AddRange(requestBatch);
                    var multipleResponse = (ExecuteTransactionResponse)_service.Execute(transactionRequest);
                    response.AddRange(CrmHelper.GetGuidsAsEnumerable(multipleResponse));

                    transactionRequest = new ExecuteTransactionRequest
                    {
                        Requests = new OrganizationRequestCollection()
                    };
                }
            }
            catch (FaultException <OrganizationServiceFault> fault)
            {
                if (fault.Detail.ErrorDetails.Contains("MaxBatchSize"))
                {
                    int maxBatchSize = Convert.ToInt32(fault.Detail.ErrorDetails["MaxBatchSize"]);
                    if (maxBatchSize < transactionRequest.Requests.Count)
                    {
                        var errMsg =
                            string.Format(
                                "The input request collection contains {0} requests, which exceeds the maximum allowed {1}",
                                transactionRequest.Requests.Count, maxBatchSize);
                        throw new InvalidOperationException(errMsg, fault);
                    }
                }

                throw;
            }

            return(response);
        }
 public void ScenarioModified()
 {
     btCancel.IsEnabled = btApply.IsEnabled = true;
     Modified?.Invoke();
 }
예제 #27
0
        private void OnTick(DateTime now)
        {
            if (!IsStarted || !IsActive)
            {
                return;
            }

            _lastRecordedTime = now;

            var timeFrame = new ActivityTimeFrame();

            timeFrame.Timestamp = now;

            // Get useful data from detected sensors
            if (SensorService != null)
            {
                if (SensorService.Gps != null)
                {
                    // Position from GPS
                    var status = SensorService.Gps.Geolocator.Status;
                    if (!status.Position.IsEmpty)
                    {
                        timeFrame.Position = status.Position;
                    }
                }
                if (SensorService.HeartRateMonitor != null)
                {
                    var hrData = SensorService.HeartRateMonitor.HeartRateData;
                    if (hrData != null)
                    {
                        timeFrame.HeartRate = (byte)hrData.HeartRateValue;
                    }
                }

                if (SensorService.SpeedSensor != null)
                {
                    // trying to get speed from speed sensor first
                    timeFrame.Speed = SensorService.SpeedSensor.Speed;
                }
                else if (SensorService.Gps != null)
                {
                    // fallback to GPS
                    if (SensorService.Gps.Geolocator.Status != null)
                    {
                        var speed = (float)SensorService.Gps.Geolocator.Status.Speed;
                        if (speed > 0)
                        {
                            timeFrame.Speed = new Speed(speed, SpeedUnit.MeterPerSecond);
                        }
                    }
                }

                // update cadence data
                if (SensorService.CadenceSensor != null)
                {
                    timeFrame.Cadence = SensorService.CadenceSensor.Cadence.RevolutionsPerMinute;
                }

                // update power data
                if (SensorService.BikePowerMeter != null)
                {
                    if (SensorService.BikePowerMeter.Power.HasValue)
                    {
                        timeFrame.Power = (ushort)SensorService.BikePowerMeter.Power.Watts;
                    }
                }
            }
            if (AutoPause)
            {
                var speedMeterPerSecond = timeFrame.Speed.GetValueOrDefault().GetValueAs(SpeedUnit.MeterPerSecond);
                // check auto-pause speed limit
                if (speedMeterPerSecond < AutoPauseSpeedLimit.GetValueAs(SpeedUnit.MeterPerSecond) && !_autoPaused)
                {
                    _autoPaused = true;
                    AddTimeFrame(new ActivityTimeFrame {
                        Timestamp = now, Type = ActivityTimeFrameType.Stop
                    });
                    AutoPaused?.Invoke(this, EventArgs.Empty);
                }
                else if (_autoPaused && speedMeterPerSecond >= AutoPauseSpeedLimit.GetValueAs(SpeedUnit.MeterPerSecond))
                {
                    _autoPaused = false;
                    AddTimeFrame(new ActivityTimeFrame {
                        Timestamp = now, Type = ActivityTimeFrameType.Start
                    });
                    AutoResumed?.Invoke(this, EventArgs.Empty);
                }
                if (_autoPaused)
                {
                    return;
                }
            }
            AddTimeFrame(timeFrame);
            if (_streamDest != null)
            {
                _streamDest.Flush();
            }
            Modified?.Invoke(this, EventArgs.Empty);
        }
예제 #28
0
        private static MethodHandler <SemanticDocument> BuildPostHandlerForMethodInfo(MethodInfoNode methodNode,
                                                                                      ServiceLocatorDelegate serviceLocator)
        {
            MethodHandler <SemanticDocument> .InvokeMethodDelegate invoke2 = async(submittedArgs) =>
            {
                var argsEnumerator = submittedArgs.GetEnumerator();
                var argsList       = methodNode.MethodInfo.GetParameters()
                                     .Select(pi =>
                {
                    if (pi.GetCustomAttribute <InjectAttribute>() != null)
                    {
                        if (serviceLocator == null)
                        {
                            throw new InvalidOperationException(
                                $"Cannot [Inject] parameter {pi.Name} for {methodNode.MethodInfo.DeclaringType.Name}.{methodNode.MethodInfo.DeclaringType.Name} Please set ServiceLocator at startup");
                        }
                        return(serviceLocator(pi.ParameterType));
                    }
                    else
                    {
                        argsEnumerator.MoveNext();
                        var current = argsEnumerator.Current;
                        if (current.Item1 != new UrlPart(pi.Name))
                        {
                            throw new ArgumentException("Mismatch: expected " + pi.Name + ", received" +
                                                        current.Item1.ToString());
                        }
                        return(Tuple.Create(current.Item2, null as Action));
                    }
                }).ToList();
                var parameters   = argsList.Select(a => a.Item1).ToArray();
                var invokeResult = methodNode.MethodInfo.Invoke(methodNode.Parent, parameters);
                foreach (var tuple in argsList)
                {
                    tuple.Item2?.Invoke();
                }

                if (methodNode.MethodInfo.ReturnType == typeof(void))
                {
                }
                var task = invokeResult as Task;
                if (task != null)
                {
                    await task;
                    invokeResult = task.GetType().GetRuntimeProperty("Result")?.GetValue(task) ?? invokeResult;
                }
                var representation = new SemanticDocument();


                //Add a link back to the thing that the action happened to
                {
                    OneOf.OneOf <Modified, Created> result = default(OneOf.OneOf <Modified, Created>);
                    if (invokeResult is Created)
                    {
                        result = (Created)invokeResult;
                    }
                    if (invokeResult is Modified)
                    {
                        result = (Modified)invokeResult;
                    }
                    if (invokeResult is AbstractNode)
                    {
                        result = new Created((AbstractNode)invokeResult);
                    }
                    result = new Modified(methodNode.Parent);

                    result.Switch(
                        modified => representation.AddLink(Links.CreateLink($"Modified \'{modified.Node.Title}\'",
                                                                            modified.Node.Uri, modified.Node.Term)),
                        created => representation.AddLink(Links.CreateLink($"Created \'{created.Node.Title}\'",
                                                                           created.Node.Uri, created.Node.Term)));
                }

                representation.Value.Add(SemanticProperty.CreateValue(Terms.Title, JToken.FromObject(methodNode.Title)));
                return(new InvokeResult <SemanticDocument> .RepresentationResult(representation));
            };

            var parameterInfo = methodNode.GetParameters();

            return(new MethodHandler <SemanticDocument>(new Method.Post(), parameterInfo, invoke2));
        }
예제 #29
0
 protected virtual void OnModified(EventArgs e)
 {
     IsDirty     = true;
     NeedsRedraw = true;
     Modified?.Invoke(this, e);
 }
예제 #30
0
 /// <summary>
 /// Raises the Modified events for this asset.
 /// </summary>
 public void RaiseModifiedEvent()
 {
     TutorialContainerModified?.Invoke(this);
     Modified?.Invoke();
 }