コード例 #1
0
 MyForm()
 {
     Text = "NetDraw";
     try {
         RemotingConfiguration.Configure("NetDraw.exe.config");
         VirtualPaper              = new Paper();
         VirtualPaper.NewSegment  += (SH = new SegmentHandler(OnNewSegment));
         VirtualPaper.LastSegment += (EH = new EndHandler(OnLastSegment));
         VirtualPaper.ClearAll    += (CH = new ClearHandler(OnClear));
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         Close();
     }
     strokes = VirtualPaper.GetStrokes();
 }
コード例 #2
0
        public ClientForm()
        {
            InitializeComponent();

            connected = false;
            //IPAddress[] addrlist = Dns.GetHostAddresses(Dns.GetHostName());
            //myIp = Dns.GetHostAddresses(Dns.GetHostName())[3];

            WriteMessageD    += WriteMessage;
            AddManD          += AddMan;
            RemoveManD       += RemoveMan;
            AddFileD         += AddFile;
            RemoveFileD      += RemoveFile;
            ClearPeopleD     += ClearPeople;
            ClearFilesD      += ClearFiles;
            UpdateConnectedD += UpdateConnected;

            UpdateConnectedD();
        }
コード例 #3
0
        protected override bool ClearInternal(object item)
        {
            var handler = ClearHandler?.GetInvocationList();

            if (handler != null)
            {
                for (int i = 0; i < handler.Length; i++)
                {
                    if (((Func <object, bool>)handler[i]).Invoke(item))
                    {
                        return(true);
                    }
                }
            }
            var model = item as NotifyPropertyChangedBase;

            if (model != null)
            {
                ClearAttachedValues(model);
                return(true);
            }
#if TOUCH
            var nsObject = item as NSObject;
            if (nsObject != null)
            {
                var handle = nsObject.Handle;
                if (handle == IntPtr.Zero)
                {
                    return(false);
                }
                objc_setAssociatedObject(handle, AttachedValueKeyHandle, IntPtr.Zero, OBJC_ASSOCIATION_POLICY.OBJC_ASSOCIATION_RETAIN);

                AttachedValueHolder value;
                lock (AttachedValueHolders)
                {
                    if (AttachedValueHolders.TryGetValue(handle, out value))
                    {
                        AttachedValueHolders.Remove(handle);
                    }
                }
                if (value == null)
                {
                    return(false);
                }
                value.Dispose();
                return(true);
            }
#elif WINDOWS_UWP || WPF || WINFORMS
            var dependencyObject = item as DependencyObject;
            if (dependencyObject != null)
            {
                dependencyObject.ClearValue(AttachedValueDictionaryProperty);
                return(true);
            }
#elif XAMARIN_FORMS
            var bindableObject = item as BindableObject;
            if (bindableObject != null)
            {
                bindableObject.ClearValue(AttachedValueDictionaryProperty);
                return(true);
            }
#elif ANDROID
            if (SetTagSupported)
            {
                var view = item as View;
                if (view.IsAlive())
                {
                    view.SetTag(Resource.Id.AttachedProperties, null);
                    return(true);
                }
            }
#endif
            return(_internalDictionary.Remove(item));
        }