Exemple #1
0
 private void HandleFiles()
 {
     // change tracking
     files.TrackChanges(GetFtpFiles(), true, out var changed, out var added, out var removed);
     foreach (var change in changed)
     {
         if (EnableRaisingEvents)
         {
             Changed?.Invoke(this, new FtpFileSystemEventArgs {
                 ChangeType = FtpWatcherChangeTypes.Changed, FullPath = change.Key, Name = change.Key
             });
         }
     }
     foreach (var add in added)
     {
         if (EnableRaisingEvents)
         {
             Created?.Invoke(this, new FtpFileSystemEventArgs {
                 ChangeType = FtpWatcherChangeTypes.Created, FullPath = add.Key, Name = add.Key
             });
         }
     }
     foreach (var remove in removed)
     {
         if (EnableRaisingEvents)
         {
             Deleted?.Invoke(this, new FtpFileSystemEventArgs {
                 ChangeType = FtpWatcherChangeTypes.Deleted, FullPath = remove.Key, Name = remove.Key
             });
         }
     }
 }
Exemple #2
0
 public virtual void InvokeDeletedEvent(BackupObject obj)
 {
     if (Deleted != null)
     {
         Deleted.Invoke(obj);
     }
 }
 public void Delete()
 {
     if (ConfirmationDialog.Make("Delete File", "Are you sure you want to delete this save file?"))
     {
         Deleted?.Invoke(new SaveEventArgs(this));
     }
 }
 private void IbtnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (ID != -1)
     {
         Deleted?.Invoke(this, new EventArgs());
     }
 }
Exemple #5
0
 internal void OnDeleted(object sender, FileSystemEventArgs e)
 {
     if (e.FullPath.EndsWith(".module.dll"))
     {
         Deleted?.Invoke(null, new ModuleEventArgs(e.ChangeType, e.FullPath.Replace(e.Name, String.Empty), null, e.Name));
     }
 }
        public NUIViewWrapper(View view)
        {
            _ref       = new WeakReference <View>(view);
            _view      = view;
            _isShown   = true;
            _isFocused = false;

            if (!string.IsNullOrEmpty((view).AutomationId))
            {
                _id = view.AutomationId;
            }
            else
            {
                _id = view.GetHashCode().ToString();
            }

            view.FocusGained += (s, e) =>
            {
                _isFocused = true;
            };

            view.FocusLost += (s, e) =>
            {
                _isFocused = false;
            };

            view.RemovedFromWindow += (s, e) =>
            {
                Deleted?.Invoke(this, EventArgs.Empty);
            };
        }
Exemple #7
0
        private void RaiseEventForChange([NotNull] FakeFileSystemVersionedChange change)
        {
            string rootDirectory = change.RootDirectory.GetText();

            switch (change.ChangeType)
            {
            case WatcherChangeTypes.Created:
            {
                Created?.Invoke(this, new FileSystemEventArgs(change.ChangeType, rootDirectory, change.RelativePath));
                break;
            }

            case WatcherChangeTypes.Deleted:
            {
                Deleted?.Invoke(this, new FileSystemEventArgs(change.ChangeType, rootDirectory, change.RelativePath));
                break;
            }

            case WatcherChangeTypes.Changed:
            {
                Changed?.Invoke(this, new FileSystemEventArgs(change.ChangeType, rootDirectory, change.RelativePath));
                break;
            }

            case WatcherChangeTypes.Renamed:
            {
                Renamed?.Invoke(this,
                                new RenamedEventArgs(change.ChangeType, rootDirectory, change.RelativePath,
                                                     change.PreviousRelativePathInRename));
                break;
            }
            }
        }
Exemple #8
0
 public InfoItem()
 {
     DeleteCommand = new Command(() => {
         DependencyService.Get <ISQLiteConnector>().GetConnection().Delete(this);
         Deleted?.Invoke(this, null);
     });
 }
Exemple #9
0
 private void OnDeleted(Object dataObject)
 {
     if (Deleted != null)
     {
         Deleted.Invoke(dataObject, EventArgs.Empty);
     }
 }
Exemple #10
0
        public bool Delete()
        {
            for (var i = upstream.Count - 1; i >= 0; i--)
            {
                if (!upstream[i].Delete())
                {
                    throw new Exception($"unable to clear upstream {upstream[i]} from {this}");
                }
            }
            if (upstream.Count > 0)
            {
                throw new Exception($"unable to clear upstream {upstream} from {this}");
            }

            for (var i = downstream.Count - 1; i >= 0; i--)
            {
                if (!downstream[i].Delete())
                {
                    throw new Exception($"unable to clear downstream {downstream[i]} from {this}");
                }
            }
            if (downstream.Count > 0)
            {
                throw new Exception($"unable to clear upstream {upstream} from {this}");
            }

            Deleted?.Invoke(this, EventArgs.Empty);
            return(true);
        }
 protected internal virtual void OnDeleted(EventArgs e)
 {
     InvalidateCachedReferences();
     Deleted?.Invoke(this, e);
     EntityManager.RaiseStaticOnDeleted(this, e);
     InvalidateCachedReferences();
 }
Exemple #12
0
        /// <summary>
        /// Déclenche l'événement <see cref="Deleted"/>
        /// </summary>
        protected virtual void OnDeleted(OperationEventArgs operationEventArgs)
        {
            if (operationEventArgs != null)
            {
                if (operationEventArgs.Succeed)
                {
                    // TODO : Close view
                    //ShellServices.NotificationService.NotifyInformation(true, GetHashCode(), Resources.Message_SaveSucceded);

                    //Closed += (s, e) => ShellServices.EventAggregator.GetEvent<RemoveFromJournalPubSubEvent>().Publish(this);

                    //// Close the view
                    //CloseCommand.Execute();
                }
                else
                {
                    IsDeleting = false;
                    IsBusy     = false;

                    // TODO : Manage exception
                    //ManageException(operationEventArgs.Error, Resources.Error_Deleting);
                }
            }

            IsDeleting = false;
            IsBusy     = false;

            Deleted?.Invoke(this, operationEventArgs);
        }
Exemple #13
0
 private void linkLabelAddNew_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (Deleted != null)
     {
         Deleted.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #14
0
 protected void OnDeleted()
 {
     if (Deleted != null)
     {
         Deleted.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #15
0
        private async void MenuButton_MenuSelected(object sender, MenuSelectedEventArgs e)
        {
            try
            {
                if (e.Result.Index == -1)
                {
                    return;
                }

                if (e.Result.Index == 1)
                {
                    Deleted?.Invoke(this, e);
                }
                if (e.Result.Index == 0)
                {
                    using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading..."))
                    {
                        var result = await APIContext.Assemblies.Get(Assembly.Id);

                        if (result.Success)
                        {
                            var componentsView = new AssemblyComponentsPage(result.Data.Assembly,
                                                                            (int)result.Data.Total);
                            await Navigation.PushModalAsync(componentsView);
                        }
                    }
                }
            }
            catch (Exception)
            {
                await MaterialDialog.Instance.SnackbarAsync(message : "An error occured!",
                                                            msDuration : MaterialSnackbar.DurationLong);
            }
        }
Exemple #16
0
 public virtual void Delete(T asset)
 {
     Deleted?.Invoke(asset);
     throw new NotImplementedException("Method " + MethodBase.GetCurrentMethod().Name +
                                       " in " + MethodBase.GetCurrentMethod().DeclaringType
                                       .ToString() + " not implemented.");
 }
        async void Delete_Clicked(object sender, EventArgs e)
        {
            if (IsBusy || input.IsVisible)
            {
                return;
            }

            if (Settings.Storage.AskDelete)
            {
                var ans = await DisplayActionSheet(Resource.DoYouWantToDelete + " " + Name + "?", null, null, Resource.Yes, Resource.Cancel);

                if (ans != Resource.Yes)
                {
                    return;
                }
            }

            IsBusy = true;
            var result = await DataBase.Manager.DelDataAsync(Name);

            IsBusy = false;

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

                return;
            }

            Deleted?.Invoke(this, new DeleteEventArgs(Name));
            await Navigation.PopAsync();
        }
Exemple #18
0
        private void TableEntityChange(object sender, RecordChangedEventArgs <Table> e)
        {
            var changedEntity = e.Entity;

            switch (e.ChangeType)
            {
            case ChangeType.None:
                break;

            case ChangeType.Delete:
                Deleted?.Invoke(changedEntity);
                break;

            case ChangeType.Insert:
                Inserted?.Invoke(changedEntity);
                break;

            case ChangeType.Update:
                Updated?.Invoke(changedEntity);
                break;

            default:
                break;
            }
        }
Exemple #19
0
        /// <summary>
        /// Uploads and optionally deletes a survey response from local storage.
        /// </summary>
        /// <param name="delete">
        /// Use <code>true</code> if the survey should be deleted.
        /// </param>
        /// <returns>
        /// A task to await the upload and delete operation.
        /// </returns>
        public async Task UploadAsync(bool delete)
        {
            _uploading = true;
            Update();

            try
            {
                await _response.UploadAsync();
            }
            finally
            {
                _uploading = false;
                Update();
            }

            if (delete)
            {
                DependencyService.Get <IMetricsManagerService>().TrackEvent("MySurveysDeleteAfterUpload");
                await DeleteAsync();

                // Wait a few seconds to send the delete notification so the user can see the uploaded update
                await Task.Delay(MySurveysViewModel.UploadDeleteDelayMilliseconds);

                Deleted?.Invoke(this, new EventArgs());
            }
        }
Exemple #20
0
 private void watcher_Deleted(object sender, FileSystemEventArgs e)
 {
     if (reIgnore.IsMatch(e.FullPath))
     {
         return;
     }
     Deleted?.Invoke(this, e);
 }
Exemple #21
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.TryGetComponent <Player>(out Player player) ||
         collision.TryGetComponent <DeleteProducts>(out DeleteProducts deleteProducts))
     {
         Deleted?.Invoke(_index);
     }
 }
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            var result = await APIContext.Assemblies.Delete(Assembly.Id, Component.Id, (int)Component.Type);

            if (result.Success)
            {
                Deleted?.Invoke(this, e);
            }
        }
Exemple #23
0
        /// <summary>
        /// Raises the <see cref="Deleted"/> event.
        /// </summary>
        /// <param name="args">Arguments for the event.</param>
        public void RaiseDeleted(FileChangedEventArgs args)
        {
            if (!ShouldRaiseEvent(args))
            {
                return;
            }

            Deleted?.Invoke(this, args);
        }
Exemple #24
0
		private void CleanLastRenameEvent() {
			if (lastRenameEvent != null) {
				var path = lastRenameEvent.Value.Path;
				if (Filter?.Invoke(lastRenameEvent.Value.Path) ?? true) {
					Deleted?.Invoke(lastRenameEvent.Value.Path);
				}
				lastRenameEvent = null;
			}
		}
Exemple #25
0
 public void Delete()
 {
     Clear();
     FileDeleted = true;
     if (Deleted != null)
     {
         Deleted.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #26
0
 public void DeleteResource()
 {
     if (Directory.Exists(Metadata.ResourceCacheDirectory))
     {
         Directory.Delete(Metadata.ResourceCacheDirectory, true);
     }
     Dispose();
     Deleted?.Invoke(this);
 }
Exemple #27
0
 /// <summary>Marks this object as deleted, invokes <see cref="Deleted"/> and makes all methods of this object fail.</summary>
 internal void MarkAsDeleted()
 {
     if (!IsDeleted)
     {
         IsDeleted = true;
         OnDeleted();
         Deleted?.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #28
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ComponentBase component = Tag as ComponentBase;

            if (MessageBox.Show($"Delete {component.TypeDescription} \"{component.Name}\"?", Resources.ProgramName, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Deleted?.Invoke(this, new EventArgs());
            }
        }
Exemple #29
0
                /// <summary>
                /// Creates and initializes a new instance of the RotarySelector class.
                /// </summary>
                /// <param name="parent">The Efl.Ui.Widget to which the new RotarySelector will be attached as a child.</param>
                /// <since_tizen> 6 </since_tizen>
                public RotarySelector(Efl.Ui.Widget parent) : base(Interop.Eext.eext_rotary_selector_add(parent.NativeHandle))
                {
                    smartClicked = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem clickedItem = FindItemByNativeHandle(e);
                        if (clickedItem != null)
                        {
                            ClickedEvt?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = clickedItem
                            });
                        }
                    });

                    smartSelected = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem selectedItem = FindItemByNativeHandle(e);
                        if (selectedItem != null)
                        {
                            SelectedEvt?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = selectedItem
                            });
                        }
                    });

                    smartDeleted = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem deletedItem = FindItemByNativeHandle(e);
                        if (deletedItem != null)
                        {
                            Deleted?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = deletedItem
                            });
                        }
                        Items.Remove(deletedItem);
                    });

                    smartReordered = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        var items_list = Interop.Eext.eext_rotary_selector_items_get(this.NativeHandle);
                        int idx        = Eina.ListNativeFunctions.eina_list_data_idx(items_list, e);
                        RotarySelectorItem reorderedItem = FindItemByNativeHandle(e);
                        if (reorderedItem != null)
                        {
                            Reordered?.Invoke(this, new RotarySelectorItemReorderedEventArgs
                            {
                                item = reorderedItem, OldIndex = Items.IndexOf(reorderedItem), NewIndex = idx
                            });
                        }
                        UpdateListOrder(reorderedItem, idx);
                    });

                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemClickedEventName, smartClicked, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemSelectedEventName, smartSelected, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemDeletedEventName, smartDeleted, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemReorderedEventName, smartReordered, IntPtr.Zero);
                }
Exemple #30
0
        public SelectableTextBlock()
        {
            this.Cursor = Cursors.IBeam;
            Focusable   = true;
            var contextMenu = new ContextMenu();

            ContextMenu = contextMenu;

            copyMenu                  = new MenuItem();
            copyMenu.Header           = "复制";
            copyMenu.InputGestureText = "Ctrl + C";
            copyMenu.Click           += (ss, ee) =>
            {
                Copy();
            };
            contextMenu.Items.Add(copyMenu);

            selectAllMenu                  = new MenuItem();
            selectAllMenu.Header           = "全选";
            selectAllMenu.InputGestureText = "Ctrl + A";
            selectAllMenu.Click           += (ss, ee) =>
            {
                SelectAll();
            };
            contextMenu.Items.Add(selectAllMenu);

            fowardMenu        = new MenuItem();
            fowardMenu.Header = "转发";
            fowardMenu.Click += (ss, ee) =>
            {
                FowardEvent?.Invoke(this);
            };
#if !CUSTOMSERVER
            contextMenu.Items.Add(fowardMenu);
#endif
            var deleteItem = new MenuItem();
            deleteItem.Header = "删除";
            deleteItem.Click += (ss, ee) =>
            {
                Deleted?.Invoke(this);
            };
            contextMenu.Items.Add(deleteItem);

            withDrawMenu        = new MenuItem();
            withDrawMenu.Header = "撤回";
            withDrawMenu.Click += (ss, ee) =>
            {
                WithDraw?.Invoke(this);
            };



            ContextMenuOpening += contextMenu_ContextMenuOpening;

            this.LineHeight = 30;
        }