示例#1
0
        private void Close_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            CloseCanExecuteEventArgs canExec = new CloseCanExecuteEventArgs();

            CanClose?.Invoke(this, canExec);
            e.CanExecute = canExec.CanExecute;
        }
示例#2
0
 public void ConfirmEdit()
 {
     if (Service.UpdateGadget(EditGadget))
     {
         MessageBox.Show("Update was Successful");
         CanClose?.Invoke(this, new EventArgs());
     }
 }
示例#3
0
 public void Save()
 {
     if (!Service.AddGadget(Gadget))
     {
         MessageBox.Show("Error while adding your new gadget");
     }
     else
     {
         CanClose?.Invoke(this, new EventArgs());
     }
 }
示例#4
0
 public void ConfirmDeleteGadget()
 {
     if (!Service.DeleteGadget(Gadget))
     {
         MessageBox.Show("Error while deleting the Gadget. Please try later");
     }
     else
     {
         MessageBox.Show("Deleted Successfully");
     }
     CanClose?.Invoke(this, new EventArgs());
 }
示例#5
0
 public async Task CloseModal()
 {
     if (CanClose.Invoke())
     {
         _showAnimateAway = true;
         _showAnimateUp   = false;
         StateHasChanged();
         await Task.Run(() =>
         {
             Thread.Sleep(300);
             _isOpen          = false;
             _showAnimateAway = false;
             InvokeAsync(StateHasChanged);
         });
     }
 }
示例#6
0
        /// <summary>
        /// 重写 Tostring方法,输出属性的值。
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("DisplayName=");
            stringBuilder.Append(DisplayName);
            stringBuilder.Append(System.Environment.NewLine);

            stringBuilder.Append("ViewType=");
            stringBuilder.Append(ViewType);
            stringBuilder.Append(System.Environment.NewLine);

            stringBuilder.Append("ViewAssemblyName=");
            stringBuilder.Append(ViewAssemblyName);
            stringBuilder.Append(System.Environment.NewLine);


            stringBuilder.Append("ViewName=");
            stringBuilder.Append(ViewName);
            stringBuilder.Append(System.Environment.NewLine);


            stringBuilder.Append("ViewModelAssemblyName=");
            stringBuilder.Append(ViewModelAssemblyName);
            stringBuilder.Append(System.Environment.NewLine);


            stringBuilder.Append("ViewModelName=");
            stringBuilder.Append(ViewModelName);
            stringBuilder.Append(System.Environment.NewLine);

            stringBuilder.Append("Parameter=");
            stringBuilder.Append(Parameter);
            stringBuilder.Append(System.Environment.NewLine);

            stringBuilder.Append("CanClose=");
            stringBuilder.Append(CanClose.ToString());
            stringBuilder.Append(System.Environment.NewLine);

            return(stringBuilder.ToString());
        }
示例#7
0
 public void CancelEdit()
 {
     CanClose?.Invoke(this, new EventArgs());
 }
示例#8
0
        public virtual void WriteXml(System.Xml.XmlWriter writer)
        {
            if (!string.IsNullOrWhiteSpace(Title))
            {
                writer.WriteAttributeString("Title", Title);
            }

            //if (IconSource != null)
            //    writer.WriteAttributeString("IconSource", IconSource.ToString());

            if (IsSelected)
            {
                writer.WriteAttributeString("IsSelected", IsSelected.ToString());
            }

            if (IsLastFocusedDocument)
            {
                writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString());
            }

            if (!string.IsNullOrWhiteSpace(ContentId))
            {
                writer.WriteAttributeString("ContentId", ContentId);
            }


            if (ToolTip != null && ToolTip is string)
            {
                if (!string.IsNullOrWhiteSpace((string)ToolTip))
                {
                    writer.WriteAttributeString("ToolTip", (string)ToolTip);
                }
            }

            if (FloatingLeft != 0.0)
            {
                writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingTop != 0.0)
            {
                writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingWidth != 0.0)
            {
                writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingHeight != 0.0)
            {
                writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
            }

            if (IsMaximized)
            {
                writer.WriteAttributeString("IsMaximized", IsMaximized.ToString());
            }
            if (!CanClose)
            {
                writer.WriteAttributeString("CanClose", CanClose.ToString());
            }
            if (!CanFloat)
            {
                writer.WriteAttributeString("CanFloat", CanFloat.ToString());
            }

            if (LastActivationTimeStamp != null)
            {
                writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                    writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString());
                }
            }
        }
 private void CloseButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     CanClose?.Invoke(this, EventArgs.Empty);
 }
 private void SaveButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     Player.Save();
     CanClose?.Invoke(this, EventArgs.Empty);
     PlayerSaved?.Invoke(this, Player);
 }
示例#11
0
 public void CancelDeleteGadget()
 {
     CanClose?.Invoke(this, new EventArgs());
 }
示例#12
0
        public virtual void WriteXml(System.Xml.XmlWriter writer)
        {
            //write strong type if necessary (if it's not a basic object )
            var type = this.GetType();

            if (type.Name != "LayoutAnchorablePaneGroup" &&
                type.Name != "LayoutAnchorablePane" &&
                type.Name != "LayoutAnchorable" &&
                type.Name != "LayoutDocumentPaneGroup" &&
                type.Name != "LayoutDocumentPane" &&
                type.Name != "LayoutDocument" &&
                type.Name != "LayoutAnchorGroup" &&
                type.Name != "LayoutPanel"
                )
            {
                writer.WriteAttributeString("StrongType", type.AssemblyQualifiedName);
            }

            if (!string.IsNullOrWhiteSpace(Title))
            {
                writer.WriteAttributeString("Title", Title);
            }

            //if (IconSource != null)
            //    writer.WriteAttributeString("IconSource", IconSource.ToString());

            if (IsSelected)
            {
                writer.WriteAttributeString("IsSelected", IsSelected.ToString());
            }

            if (IsLastFocusedDocument)
            {
                writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString());
            }

            if (!string.IsNullOrWhiteSpace(ContentId))
            {
                writer.WriteAttributeString("ContentId", ContentId);
            }


            if (ToolTip != null && ToolTip is string)
            {
                if (!string.IsNullOrWhiteSpace((string)ToolTip))
                {
                    writer.WriteAttributeString("ToolTip", (string)ToolTip);
                }
            }

            if (FloatingLeft != 0.0)
            {
                writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingTop != 0.0)
            {
                writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingWidth != 0.0)
            {
                writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
            }
            if (FloatingHeight != 0.0)
            {
                writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
            }

            if (IsMaximized)
            {
                writer.WriteAttributeString("IsMaximized", IsMaximized.ToString());
            }
            if (!CanClose)
            {
                writer.WriteAttributeString("CanClose", CanClose.ToString());
            }
            if (!CanFloat)
            {
                writer.WriteAttributeString("CanFloat", CanFloat.ToString());
            }

            if (LastActivationTimeStamp != null)
            {
                writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                    writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString());
                }
            }
        }