Example #1
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (this.IsLoaded)
            {
                var confirmDialog = new ConfirmationDialog();
                confirmDialog.Message = "Are you sure to quit AMicroblogAPI demo app?";
                confirmDialog.ConfirmButtonText = "Quit";
                confirmDialog.Owner = this;
                confirmDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

                var isPicAttached = poster.IsPicAttached;
                poster.IsPicAttached = false;
                this.DoBlur();
                var dialogResult = confirmDialog.ShowDialog();
                if (dialogResult.HasValue)
                {
                    if (!dialogResult.Value)
                        e.Cancel = true;
                }

                this.UndoBlur();
                poster.IsPicAttached = isPicAttached;
            }

            base.OnClosing(e);
        }
Example #2
0
        private void HandleDelete(object sender, RoutedEventArgs e)
        {
            var target = sender as FrameworkElement;
            var pos = Mouse.GetPosition(this);
            var confirmDialog = new ConfirmationDialog(this.Left + pos.X, this.Top + pos.Y);
            confirmDialog.Owner = this;

            DoBlur();
            var dialogResult = confirmDialog.ShowDialog();
            if (dialogResult.HasValue && dialogResult.Value)
            {
                var statusInfo = target.Tag as StatusData;
                var deletedStatus = AMicroblog.DeleteStatus(statusInfo.ID);

                viewModel.RemoveStatusFromView(deletedStatus);
            }
            UndoBlur();
        }
        private void HandleSaveAs(object sender, RoutedEventArgs e)
        {
            var source = imgLoader.CurrentImageSource;
            if (null != source && !source.IsDownloading)
            {
                var targetFileLocation = ImageHelper.Save(source);

                var dialog = new ConfirmationDialog();
                dialog.Owner = this;
                dialog.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
                dialog.Message = "Image saved to: " + targetFileLocation + ". Open it now?";
                dialog.ConfirmButtonText = "Open";
                var diaResult = dialog.ShowDialog();
                if (diaResult.HasValue && diaResult.Value)
                {
                    Process.Start(targetFileLocation);
                }
            }
        }