コード例 #1
0
ファイル: LocationProperty.cs プロジェクト: ywscr/PDI
        //=====================================================================

        /// <summary>
        /// This is overridden to allow cloning of a PDI object
        /// </summary>
        /// <returns>A clone of the object</returns>
        public override object Clone()
        {
            LocationProperty o = new LocationProperty();

            o.Clone(this);
            return(o);
        }
コード例 #2
0
 public void SaveRequest(LocationProperty property)
 {
     if (Location != null)
     {
         Location.SaveRequest |= property;
     }
 }
コード例 #3
0
 private void OnLocationSaveRequested(LocationProperty saveRequest)
 {
     if ((saveRequest & LocationProperty.Monologues) == LocationProperty.Monologues && Window != null)
     {
         string text = GetCurrentText();
         Window.Message.Current = LocalizableString.ReturnNewLine(text);
     }
 }
コード例 #4
0
 public object this[LocationProperty property]
 {
     get
     {
         object result;
         return m_Properties.TryGetValue( property, out result ) ? result : null;
     }
     set
     {
         if ( !m_Properties.ContainsKey( property ) )
         {
             m_Properties.Add( property, value );
         }
         else
         {
             m_Properties[ property ] = value;
         }
     }
 }
コード例 #5
0
        public void SaveRequestedData()
        {
            if (SaveRequest == LocationProperty.None)
            {
                return;
            }

            SaveRequested.NullSafeInvoke(SaveRequest);

            using (new DisposableBeginEndActions(() => _xmlWriter.BeginWrite(), () => _xmlWriter.EndWrite()))
            {
                if ((SaveRequest & LocationProperty.Tags) == LocationProperty.Tags)
                {
                    _xmlWriter.WriteTags(Tags);
                    SaveRequest &= ~LocationProperty.Tags;
                    Importable  |= LocationProperty.Tags;
                }

                if ((SaveRequest & LocationProperty.Scripts) == LocationProperty.Scripts)
                {
                    foreach (AsmCommand command in ScriptCommands)
                    {
                        command.CommitChanges();
                    }

                    _xmlWriter.WriteScripts(Scripts);
                    SaveRequest &= ~LocationProperty.Scripts;
                    Importable  |= LocationProperty.Scripts;
                }

                if ((SaveRequest & LocationProperty.Monologues) == LocationProperty.Monologues)
                {
                    _xmlWriter.WriteMonologues(Monologues);
                    SaveRequest &= ~LocationProperty.Monologues;
                    Importable  |= LocationProperty.Monologues;
                }

                if (SaveRequest != LocationProperty.None)
                {
                    throw new NotImplementedException();
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// This is overridden to allow copying of the additional properties
        /// </summary>
        /// <param name="p">The PDI object from which the settings are to be copied</param>
        protected override void Clone(PDIObject p)
        {
            VEvent o = (VEvent)p;

            this.ClearProperties();

            classification = (ClassificationProperty)o.Classification.Clone();
            categories     = (CategoriesProperty)o.Categories.Clone();
            resources      = (ResourcesProperty)o.Resources.Clone();
            url            = (UrlProperty)o.Url.Clone();
            uid            = (UniqueIdProperty)o.UniqueId.Clone();
            geo            = (GeographicPositionProperty)o.GeographicPosition.Clone();
            lastMod        = (LastModifiedProperty)o.LastModified.Clone();
            dateCreated    = (DateCreatedProperty)o.DateCreated.Clone();
            startDate      = (StartDateProperty)o.StartDateTime.Clone();
            endDate        = (EndDateProperty)o.EndDateTime.Clone();
            dateStamp      = (TimeStampProperty)o.TimeStamp.Clone();
            summary        = (SummaryProperty)o.Summary.Clone();
            desc           = (DescriptionProperty)o.Description.Clone();
            location       = (LocationProperty)o.Location.Clone();
            priority       = (PriorityProperty)o.Priority.Clone();
            sequence       = (SequenceProperty)o.Sequence.Clone();
            transp         = (TimeTransparencyProperty)o.Transparency.Clone();
            rNum           = (RecurrenceCountProperty)o.RecurrenceCount.Clone();
            comment        = (CommentProperty)o.Comment.Clone();
            organizer      = (OrganizerProperty)o.Organizer.Clone();
            recurId        = (RecurrenceIdProperty)o.RecurrenceId.Clone();
            status         = (StatusProperty)o.Status.Clone();
            duration       = (DurationProperty)o.Duration.Clone();

            this.Contacts.CloneRange(o.Contacts);
            this.Attendees.CloneRange(o.Attendees);
            this.RelatedTo.CloneRange(o.RelatedTo);
            this.Attachments.CloneRange(o.Attachments);
            this.RequestStatuses.CloneRange(o.RequestStatuses);
            this.Alarms.CloneRange(o.Alarms);
            this.CustomProperties.CloneRange(o.CustomProperties);

            base.Clone(p);
        }
コード例 #7
0
        /// <summary>
        /// The method can be called to clear all current property values from the event.  The version is left
        /// unchanged.
        /// </summary>
        public override void ClearProperties()
        {
            classification = null;
            categories     = null;
            resources      = null;
            url            = null;
            uid            = null;
            geo            = null;
            lastMod        = null;
            dateCreated    = null;
            startDate      = null;
            endDate        = null;
            dateStamp      = null;
            summary        = null;
            desc           = null;
            location       = null;
            priority       = null;
            sequence       = null;
            transp         = null;
            rNum           = null;
            comment        = null;
            organizer      = null;
            recurId        = null;
            status         = null;
            duration       = null;

            contacts    = null;
            attendees   = null;
            relatedTo   = null;
            attachments = null;
            reqStats    = null;
            alarms      = null;

            customProps = null;

            base.ClearProperties();
        }
コード例 #8
0
ファイル: LocationProperty.cs プロジェクト: modulexcite/PDI
        //=====================================================================

        /// <summary>
        /// This is overridden to allow cloning of a PDI object
        /// </summary>
        /// <returns>A clone of the object</returns>
        public override object Clone()
        {
            LocationProperty o = new LocationProperty();
            o.Clone(this);
            return o;
        }
コード例 #9
0
 set => SetValue(LocationProperty, value);
コード例 #10
0
 public bool HasProperty( LocationProperty property )
 {
     return m_Properties.ContainsKey( property );
 }
コード例 #11
0
 get => (Point)GetValue(LocationProperty); set => SetValue(LocationProperty, value);
コード例 #12
0
 public ItemComparer( LocationProperty property )
 {
     m_Property = property;
 }
コード例 #13
0
        private static void AddListItemProperties( ListViewItem item, LocationTreeNode node, LocationProperty[] properties )
        {
            for ( int propertyIndex = 1; propertyIndex < properties.Length; ++propertyIndex )
            {
                LocationProperty property = properties[ propertyIndex ];

                if ( node.HasProperty( property ) )
                {
                    item.SubItems.Add( new ListViewItem.ListViewSubItem( item, node[ property ].ToString( ) ) );
                }
                else
                {
                    item.SubItems.Add( new ListViewItem.ListViewSubItem( item, "" ) );
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Invoke a method, converting any TargetInvocationException to an NUnitException.
        /// </summary>
        /// <param name="method">A MethodInfo for the method to be invoked</param>
        /// <param name="fixture">The object on which to invoke the method</param>
        /// <param name="args">The argument list for the method</param>
        /// <returns>The return value from the invoked method</returns>
        public static object InvokeMethod(MethodInfo method, object fixture, params object[] args)
        {
            if (method != null)
            {
                if (fixture == null && !method.IsStatic)
                {
                    Console.WriteLine("Trying to call {0} without an instance", method.Name);
                }
                try
                {
                    if (LocationProperty != null)
                    {
                        Environment.CurrentDirectory = System.IO.Path.GetDirectoryName((string)LocationProperty.GetValue(method.DeclaringType.Assembly, null));
                    }

                    object result = null;
                    if (GuiUnit.TestRunner.MainLoop == null)
                    {
                        result = method.Invoke(fixture, args);
                    }
                    else
                    {
                        var invokeHelper = new GuiUnit.InvokerHelper {
                            Context = TestExecutionContext.CurrentContext,
                            Func    = () => method.Invoke(fixture, args)
                        };

                        GuiUnit.TestRunner.MainLoop.InvokeOnMainLoop(invokeHelper);
                        invokeHelper.Waiter.WaitOne();
                        if (invokeHelper.ex != null)
                        {
                            Rethrow(invokeHelper.ex);
                        }
                        result = invokeHelper.Result;
                    }

                    if (result is System.Threading.Tasks.Task)
                    {
                        ((System.Threading.Tasks.Task)result).Wait();
                    }
                    return(result);
                }
                catch (Exception e)
                {
                    Rethrow(e);
                }
            }

            return(null);
        }