Example #1
0
        private async Task OnDeleteVideoConfirmedAsync()
        {
            var deleteTask = OnDelete.InvokeAsync(this.VideoModel);

            this.ShowDeleteConfirm = false;
            await deleteTask;
        }
        public override string GetForeignKeySql(string fkName, string table, string column, string referencingTable,
                                                string referencingColumn, OnDelete onDelete)
        {
            string onDeleteSql;

            switch (onDelete)
            {
            case OnDelete.Cascade:
                onDeleteSql = "on delete cascade";
                break;

            case OnDelete.SetNull:
                onDeleteSql = "on delete set null";
                break;

            default:
                onDeleteSql = "";
                break;
            }

            return(String.Format("alter table {0} add constraint {1} foreign key ({2}) references {3} ({4}) {5}",
                                 table,
                                 fkName,
                                 column,
                                 referencingTable,
                                 referencingColumn,
                                 onDeleteSql));
        }
Example #3
0
        public void Saved()
        {
            var deleteAction = new NotificationAction
            {
                Icon  = _icons.Delete,
                Name  = _loc.Delete,
                Color = "LightPink"
            };

            deleteAction.Click += () =>
            {
                if (File.Exists(_recentItem.FileName))
                {
                    if (Shell32.FileOperation(_recentItem.FileName, FileOperationType.Delete, 0) != 0)
                    {
                        return;
                    }
                }

                Remove();

                OnDelete?.Invoke();
            };

            _notificationActions.Add(deleteAction);

            PrimaryText = _recentItem.FileType == RecentFileType.Video ? _loc.VideoSaved : _loc.AudioSaved;
            Finished    = true;
        }
Example #4
0
        protected async Task DeleteAsync()
        {
            await CardSectionRepository.DeleteAsync(CardSection.Id);

            OnDelete?.Invoke();
            Control.ClearScope();
        }
Example #5
0
        public virtual void AddForeignKey(string fkName, string table, string column, string referencingTable,
                                          string referencingColumn, OnDelete onDelete)
        {
            string sql = Dialect.GetForeignKeySql(fkName, table, column, referencingTable, referencingColumn, onDelete);

            Database.ExecuteSql(sql);
        }
Example #6
0
        /// <summary>
        /// This event is called every time that the user clicks on some cell in the grid.
        /// The Img Mouse Down is called first, determining what action caused the event.
        /// If it was caused by a click on some information, no action should be taken.
        /// </summary>
        private void BasicGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (action != Action.None)
            {
                if (CurrentItem != null)
                {
                    switch (action)
                    {
                    case Action.Edit:
                        OnEdit?.Invoke(CurrentItem);
                        break;

                    case Action.Delete:
                        OnDelete?.Invoke(CurrentItem);
                        break;

                    default:
                        break;
                    }
                }
            }

            action       = Action.None;
            SelectedItem = null;
        }
Example #7
0
        public async void Start()
        {
            client = new HttpClient();
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);

            var stream = await client.GetStreamAsync(url);

            var reader = new StreamReader(stream);

            string eventName = null;
            string data      = null;

            while (client != null)
            {
                var line = reader.ReadLine();


                if (string.IsNullOrEmpty(line) || line.StartsWith(":"))
                {
                    eventName = data = null;
                    continue;
                }

                if (line.StartsWith("event: "))
                {
                    eventName = line.Substring("event: ".Length).Trim();
                }
                else if (line.StartsWith("data: "))
                {
                    data = line.Substring("data: ".Length);

                    switch (eventName)
                    {
                    case "update":
                        var status = JsonConvert.DeserializeObject <Status>(data);
                        OnUpdate?.Invoke(this, new StreamUpdateEventArgs()
                        {
                            Status = status
                        });
                        break;

                    case "notification":
                        var notification = JsonConvert.DeserializeObject <Notification>(data);
                        OnNotification?.Invoke(this, new StreamNotificationEventArgs()
                        {
                            Notification = notification
                        });
                        break;

                    case "delete":
                        var statusId = int.Parse(data);
                        OnDelete?.Invoke(this, new StreamDeleteEventArgs()
                        {
                            StatusId = statusId
                        });
                        break;
                    }
                }
            }
        }
 private void ViewHolder_Click(object sender, EventArgs e)
 {
     if (!adpt.trimmode)
     {
         OnDelete?.Invoke(currentitem);
     }
 }
        public FileSavedNotification(string FileName, string Message)
        {
            _fileName = FileName;

            PrimaryText = Message;
            SecondaryText = Path.GetFileName(FileName);

            var loc = ServiceProvider.Get<LanguageManager>();
            var icons = ServiceProvider.Get<IIconSet>();

            var deleteAction = new NotificationAction
            {
                Icon = icons.Delete,
                Name = loc.Delete,
                Color = "LightPink"
            };

            deleteAction.Click += () =>
            {
                if (File.Exists(_fileName))
                {
                    if (Shell32.FileOperation(_fileName, FileOperationType.Delete, 0) != 0)
                        return;
                }

                Remove();

                OnDelete?.Invoke();
            };

            Actions = new[] { deleteAction };
        }
Example #10
0
 private void ContextDelete_Click(object sender, RoutedEventArgs e)
 {
     if (OnDelete != null)
     {
         OnDelete.Invoke(this);
     }
 }
Example #11
0
    public void Delete()
    {
        rootEntity.OnShapeUpdated -= OnShapeUpdate;
        rootEntity.OnNameChange   -= OnNameUpdate;

        Deselect();
        DestroyColliders();

        if (isNFT)
        {
            foreach (KeyValuePair <Type, ISharedComponent> kvp in rootEntity.sharedComponents)
            {
                if (kvp.Value.GetClassId() == (int)CLASS_ID.NFT_SHAPE)
                {
                    BuilderInWorldNFTController.i.StopUsingNFT(((NFTShape.Model)kvp.Value.GetModel()).assetId);
                    break;
                }
            }
        }

        associatedCatalogItem = null;
        DCL.Environment.i.world.sceneBoundsChecker.EvaluateEntityPosition(rootEntity);
        DCL.Environment.i.world.sceneBoundsChecker.RemoveEntityToBeChecked(rootEntity);
        OnDelete?.Invoke(this);
    }
Example #12
0
 public void SellBack(UIElement button)
 {
     if (Holding == null || !Roommate)
     {
         return;
     }
     if (Holding.IsBought)
     {
         if (Holding.CanDelete)
         {
             vm.SendCommand(new VMNetDeleteObjectCmd
             {
                 ObjectID   = Holding.MoveTarget,
                 CleanupAll = true
             });
             HITVM.Get().PlaySoundEvent(UISounds.MoneyBack);
         }
         else
         {
             ShowErrorAtMouse(LastState, VMPlacementError.CannotDeleteObject);
             return;
         }
     }
     OnDelete?.Invoke(Holding, null); //TODO: cleanup callbacks which don't need updatestate into another delegate.
     ClearSelected();
 }
Example #13
0
        public void Saved()
        {
            var deleteAction = new NotificationAction
            {
                Icon  = _icons.Delete,
                Name  = _loc.Delete,
                Color = "LightPink"
            };

            deleteAction.Click += () =>
            {
                if (File.Exists(_recentItem.FileName))
                {
                    var platformServices = ServiceProvider.Get <IPlatformServices>();

                    if (!platformServices.DeleteFile(_recentItem.FileName))
                    {
                        return;
                    }
                }

                Remove();

                OnDelete?.Invoke();
            };

            _notificationActions.Add(deleteAction);

            PrimaryText = _recentItem.FileType == RecentFileType.Video ? _loc.VideoSaved : _loc.AudioSaved;
            Finished    = true;
        }
        public static void DeleteMessage(string[] splited)
        {
            if (splited.Length < 4)
            {
                return;
            }
            if (!int.TryParse(splited[1], out var sessionId) || !int.TryParse(splited[2], out var senderId) || !int.TryParse(splited[3], out var messageId))
            {
                return;
            }
            var     fromMe = Id == senderId;
            Message mess   = null;

            if (fromMe)
            {
                int idx = Contacts[sessionId].Messages.FindIndex((item) => item.Id == messageId);
                Contacts[sessionId].Messages.RemoveAt(idx);
            }
            else
            {
                int idx = Contacts[senderId].Messages.FindIndex((item) => item.Id == messageId);
                Contacts[senderId].Messages.RemoveAt(idx);
            }

            OnDelete?.Invoke(messageId, senderId, sessionId);
        }
Example #15
0
 public void Delete(string host, string path, string json, Action <string, FizzException> callback)
 {
     if (OnDelete != null)
     {
         OnDelete.Invoke(host, path, json);
     }
 }
Example #16
0
        public new void Remove(T item)
        {
            int index = IndexOf(item);

            base.Remove(item);
            OnDelete?.Invoke(this, item, index);
        }
 private void DeleteProgram(object sender)
 {
     if (OnDelete != null)
     {
         OnDelete.Invoke(sender as TV_Card);
     }
 }
Example #18
0
        public new void RemoveAt(int index)
        {
            T item = base[index];

            base.RemoveAt(index);
            OnDelete?.Invoke(this, item, index);
        }
Example #19
0
        protected void SendEvent(string eventName, string data)
        {
            switch (eventName)
            {
            case "update":
                var status = JsonConvert.DeserializeObject <Status>(data);
                OnUpdate?.Invoke(this, new StreamUpdateEventArgs(status));
                break;

            case "notification":
                var notification = JsonConvert.DeserializeObject <Notification>(data);
                OnNotification?.Invoke(this, new StreamNotificationEventArgs(notification));
                break;

            case "delete":
                var statusId = (data);
                OnDelete?.Invoke(this, new StreamDeleteEventArgs(statusId));
                break;

            case "filters_changed":
                OnFiltersChanged?.Invoke(this, new StreamFiltersChangedEventArgs());
                break;

            case "conversation":
                var conversation = JsonConvert.DeserializeObject <Conversation>(data);
                OnConversation?.Invoke(this, new StreamConversationEvenTargs(conversation));
                break;
            }
        }
Example #20
0
 private void invokeDelete()
 {
     if (OnDelete != null)
     {
         OnDelete.Invoke(this, data);
     }
 }
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (ThingWrapper.CurrentThingsManager.DeleteThingWrapper(ThingWrapper))
     {
         OnDelete?.Invoke(this, new EventArgs());
     }
 }
Example #22
0
        public void Menu()
        {
            bool exit = false;

            while (!exit)
            {
                Console.WriteLine($"\n\t\t\t {typeof(T).Name} Menu" +
                                  $"\n\t1.Create {typeof(T).Name}" +
                                  $"\n\t2.Read {typeof(T).Name}" +
                                  $"\n\t3.Update {typeof(T).Name}" +
                                  $"\n\t4.Delete {typeof(T).Name}" +
                                  $"\n\t5.GetCollection of {typeof(T).Name}" +
                                  $"\n\t6.ReadFromFile" +
                                  $"\n\t7.WriteInFile" +
                                  $"\n\tanother.Exit\n");

                ConsoleKeyInfo consoleKey = Console.ReadKey();

                Console.WriteLine();

                switch (consoleKey.Key)
                {
                case ConsoleKey.D1:
                    OnCreate?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D2:
                    OnRead?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D3:
                    OnUpdate?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D4:
                    OnDelete?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D5:
                    OnReadCollection?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D6:
                    OnReadFromFile?.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D7:
                    OnWriteInFile?.Invoke(this, EventArgs.Empty);
                    break;

                default:
                    exit = true;
                    break;
                }

                Console.ReadKey();
                Console.Clear();
            }
        }
        private void Vh_OnDelete(MediaItem obj)
        {
            var index = allitems.IndexOf(obj);

            allitems.RemoveAt(index);
            NotifyItemRemoved(index);
            OnDelete?.Invoke(obj, index);
        }
 public void Delete(BacktraceDatabaseRecord record)
 {
     if (OnDelete != null)
     {
         OnDelete.Invoke(record);
     }
     return;
 }
        private async Task DeleteCustomer()
        {
            _confirmation.Hide();
            await OnDelete.InvokeAsync(_customerToDelete);

            await CustomerRepo.Delete(Endpoints.CustomersEndpoint, _customerToDelete);

            await LoadCustomers(1, 10);
        }
 private void bunifuFlatButton1_Click(object sender, EventArgs e)
 {
     flowLayoutPanel1.BackColor = Color.Tomato;
     pictureBox7.Visible        = false;
     notlab.Text  = @"Deleted";
     datelab.Text = "";
     bunifuFlatButton1.Enabled = false;
     OnDelete?.Invoke(this, new EventArgs());
 }
        private static void GameObjectOnDelete(GameObject sender, EventArgs args)
        {
            var obj = sender as T;

            if (obj != null)
            {
                OnDelete?.Invoke(null, obj);
            }
        }
 public static EntityTypeBuilder <TEntity> InterleaveInParent <TEntity>(
     this EntityTypeBuilder <TEntity> builder, Type parentEntity,
     OnDelete onDelete = OnDelete.NoAction)
     where TEntity : class
 {
     builder.Metadata.AddAnnotation(SpannerAnnotationNames.InterleaveInParent, parentEntity.FullName);
     builder.Metadata.AddAnnotation(SpannerAnnotationNames.InterleaveInParentOnDelete, onDelete);
     return(builder);
 }
Example #29
0
 public new void Remove(T item)
 {
     Int32 index = base.IndexOf(item);
     base.Remove(item);
     if (OnDelete != null)
     {
         OnDelete.Invoke(this, new NListEventArgs<T>(item, index));
     }
 }
Example #30
0
 public new void RemoveAt(Int32 index)
 {
     T item = base[index];
     base.RemoveAt(index);
     if (OnDelete != null)
     {
         OnDelete.Invoke(this, new NListEventArgs<T>(item, index));
     }
 }
        public string GetForeignKeySql(string fkName, string table, string column, string referencingTable, string referencingColumn, OnDelete onDelete) {
            string onDeleteSql;
            switch (onDelete) {
                case OnDelete.Cascade:
                    onDeleteSql = "ON DELETE CASCADE";
                    break;
                case OnDelete.SetNull:
                    onDeleteSql = "ON DELETE SET NULL";
                    break;
                default:
                    onDeleteSql = "";
                    break;
            }

            return String.Format("ALTER TABLE {0} ADD CONSTRAINT {1} FOREIGN KEY ({2}) REFERENCES {3} ({4}) {5}",
                             table,
                             fkName,
                             column,
                             referencingTable,
                             referencingColumn,
                             onDeleteSql);
        }
Example #32
0
	    public override string GetForeignKeySql(string fkName, string table, string column, string referencingTable,
		                                        string referencingColumn, OnDelete onDelete) {
			string onDeleteSql;
			switch (onDelete) {
				case OnDelete.Cascade:
					onDeleteSql = "on delete cascade";
					break;
				case OnDelete.SetNull:
					onDeleteSql = "on delete set null";
					break;
				default:
					onDeleteSql = "";
					break;
			}

			return String.Format("alter table {0} add constraint {1} foreign key ({2}) references {3} ({4}) {5}",
			                     table,
			                     fkName,
			                     column,
			                     referencingTable,
			                     referencingColumn,
			                     onDeleteSql);
		}
Example #33
0
 public virtual void AddForeignKey(string fkName, string table, string column, string referencingTable,
     string referencingColumn, OnDelete onDelete)
 {
     string sql = Dialect.GetForeignKeySql(fkName, table, column, referencingTable, referencingColumn, onDelete);
     Database.ExecuteSql(sql);
 }
Example #34
0
 public abstract string GetForeignKeySql(string fkName, string table, string column, string referencingTable,
     string referencingColumn, OnDelete onDelete);
Example #35
0
 public void OnDeleteSetNull() {
     OnDelete = OnDelete.SetNull;
     Execute();
 }
 public override string GetForeignKeySql(string fkName, string table, string column, string referencingTable, string referencingColumn, OnDelete onDelete)
 {
     throw new NotImplementedException();
 }
Example #37
0
 public void OnDeleteNoAction() {
     OnDelete = OnDelete.NoAction;
     Execute();
 }
Example #38
0
 public void OnDeleteCascade() {
     OnDelete = OnDelete.Cascade;
     Execute();
 }
Example #39
0
 public bool Equals(OnDelete other)
 {
     return Equals(other.value, value);
 }
Example #40
0
        public override string GetForeignKeySql(string fkName, string table, string column, string referencingTable,
                                                string referencingColumn, OnDelete onDelete) {
			throw new NotSupportedByDialect("ForeignKeys  not supported by SqlLite", "GetForeignKeySql", GetDialectName());
        }
 public void AddForeignKey(string fkName, string table, string column, string referencingTable, string referencingColumn, OnDelete onDelete)
 {
 }
Example #42
0
 public override string GetForeignKeySql(string fkName, string table, string column, string referencingTable, string referencingColumn, OnDelete onDelete) {
     return _postgreSqlConstraintsDialect.GetForeignKeySql(fkName, table, column, referencingTable, referencingColumn, onDelete);
 }