当前位置: 首页>>代码示例>>C#>>正文


C# NSNotification.object_方法代码示例

本文整理汇总了C#中NSNotification.object_方法的典型用法代码示例。如果您正苦于以下问题:C# NSNotification.object_方法的具体用法?C# NSNotification.object_怎么用?C# NSNotification.object_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NSNotification的用法示例。


在下文中一共展示了NSNotification.object_方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: docStateChanged

    public void docStateChanged(NSNotification notification)
    {
        DocChange change = notification.object_().To<DocChange>();

        NSGradient gradient = null;
        if (!NSObject.IsNullOrNil(change.Document))
        {
            if ((change.Type & ChangeType.Palette) == ChangeType.Palette)
            {
                float[] locations = new float[change.Document.Palette.Length];
                NSMutableArray colors = NSMutableArray.arrayWithCapacity((uint) change.Document.Palette.Length);

                for (int i = 0; i < change.Document.Palette.Length; ++i)
                {
                    locations[i] = change.Document.Palette[i].Location;
                    colors.addObject((NSColor) change.Document.Palette[i].Color);
                }

                gradient = NSGradient.Create(colors, locations).Retain();
            }
        }
        else
        {
            gradient = NSGradient.Create(NSColor.blackColor(), NSColor.blackColor()).Retain();
        }

        if (gradient != null)
        {
            if (m_gradient != null)
                m_gradient.release();
            m_gradient = gradient;

            setNeedsDisplay(true);
        }
    }
开发者ID:afrog33k,项目名称:mcocoa,代码行数:35,代码来源:PaletteView.cs

示例2: docStateChanged

    public void docStateChanged(NSNotification notification)
    {
        DocChange change = notification.object_().To<DocChange>();
        m_document = change.Document;

        m_exponent.setEnabled(!NSObject.IsNullOrNil(m_document));

        if (!NSObject.IsNullOrNil(m_document))
        {
            if ((change.Type & ChangeType.Palette) == ChangeType.Palette)
            {
                window().setTitle(NSString.Create(m_document.Palette.Name));
            }

            if ((change.Type & ChangeType.PaletteExponent) == ChangeType.PaletteExponent)
            {
                m_exponent.setFloatValue(m_document.PaletteExponent);
            }
        }
        else
        {
            m_exponent.setFloatValue(0.0f);
            window().setTitle(NSString.Create("Palette"));
        }
    }
开发者ID:afrog33k,项目名称:mcocoa,代码行数:25,代码来源:PaletteController.cs

示例3: docStateChanged

    public void docStateChanged(NSNotification notification)
    {
        DocChange change = notification.object_().To<DocChange>();

        string left = string.Empty;
        string right = string.Empty;
        string top = string.Empty;
        string bottom = string.Empty;
        string minDwell = string.Empty;
        string maxDwell = string.Empty;
        string precision = string.Empty;
        string title = "Document Info";

        if (!NSObject.IsNullOrNil(change.Document))
        {
            FractalSettings settings = change.Document.Settings;

            left = settings.Extent.Left.ToString().Replace('@', 'E');
            right = settings.Extent.Right.ToString().Replace('@', 'E');
            top = settings.Extent.Top.ToString().Replace('@', 'E');
            bottom = settings.Extent.Bottom.ToString().Replace('@', 'E');

            minDwell = change.Document.MinDwell.ToString();
            maxDwell = change.Document.MaxDwell.ToString();

        #if LIBGMP
            float p1 = (settings.Extent.Width/settings.Width).Precision;
            float p2 = (settings.Extent.Height/settings.Height).Precision;
            uint p = Math.Max((uint) p1, (uint) p2);

            if (p < Computer.MaxDoubleBits)
                precision = string.Format("{0} bits (double)", p);
            else
                precision = string.Format("{0} bits (bigfloat)", p);
        #else
            precision = "52 bits";
        #endif

            NSURL url = change.Document.fileURL();
            if (!NSObject.IsNullOrNil(url))
            {
                string path = url.path().description();
                title = System.IO.Path.GetFileNameWithoutExtension(path) + " Info";
            }
        }

        m_left.setStringValue(NSString.Create(left));
        m_right.setStringValue(NSString.Create(right));
        m_top.setStringValue(NSString.Create(top));
        m_bottom.setStringValue(NSString.Create(bottom));
        m_minDwell.setStringValue(NSString.Create(minDwell));
        m_maxDwell.setStringValue(NSString.Create(maxDwell));
        m_precision.setStringValue(NSString.Create(precision));

        window().setTitle(NSString.Create(title));
    }
开发者ID:afrog33k,项目名称:mcocoa,代码行数:56,代码来源:DocumentInfoController.cs

示例4: docStateChanged

	public void docStateChanged(NSNotification notification)
	{
		DocChange change = notification.object_().To<DocChange>();
		
		if (m_document == change.Document)
		{
			if ((change.Type & ChangeType.Settings) == ChangeType.Settings)
			{
				m_document = change.Document;
				FractalSettings settings = m_document.Settings;
				
				NSBitmapImageRep rep = NSBitmapImageRep.Alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel(
					IntPtr.Zero,				// initWithBitmapDataPlanes (null means use meshed)
					settings.Width, 		// pixelsWide
					settings.Height,		// pixelsHigh
					8,								// bitsPerSample
					3,								// samplesPerPixel
					false,						// hasAlpha
					false,						// isPlanar
					Externs.NSDeviceRGBColorSpace,	// colorSpaceName
					0,								// bitmapFormat
					0,								// bytesPerRow (padding may be added)
					0).To<NSBitmapImageRep>();	// bitsPerPixel (don't add meaningless bits)
				rep.autorelease();		// so the rep is released if an exception is thrown
					
				NSImage image = NSImage.Create();
				image.addRepresentation(rep);
				
				DoCleanup();
				
				m_rep = rep.Retain();
				m_image = image.Retain();
				setFrameSize(new NSSize(settings.Width, settings.Height));
				m_selection = NSRect.Empty;
			}
			
			if (!m_refreshing)
			{
				m_refreshing = true;
				NSApplication.sharedApplication().BeginInvoke(this.DoRefresh, TimeSpan.FromMilliseconds(100));
			}
		}
	}
开发者ID:afrog33k,项目名称:mcocoa,代码行数:43,代码来源:FractalView.cs

示例5: docStateChanged

    public void docStateChanged(NSNotification notification)
    {
        DocChange change = notification.object_().To<DocChange>();

        m_width.setEnabled(!NSObject.IsNullOrNil(change.Document));
        m_height.setEnabled(!NSObject.IsNullOrNil(change.Document));
        m_maxDwells.setEnabled(!NSObject.IsNullOrNil(change.Document));

        if (!NSObject.IsNullOrNil(change.Document))
        {
            if ((change.Type & ChangeType.Settings) == ChangeType.Settings)
            {
                m_width.setIntegerValue(change.Document.Settings.Width);
                m_height.setIntegerValue(change.Document.Settings.Height);
                m_maxDwells.setIntegerValue((int) change.Document.Settings.MaxDwell);

                string time = string.Format("Render Time: {0:0.000} mins", change.Document.RenderTime);
                m_timeLabel.setStringValue(NSString.Create(time));
            }
        }
    }
开发者ID:afrog33k,项目名称:mcocoa,代码行数:21,代码来源:FractalInfoController.cs


注:本文中的NSNotification.object_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。