C# Class RIM.VSNDK_Package.ViewModel

ViewModel is where the interesting portion of the VsTemplate Designer lives. The View binds to an instance of this class. The View binds the various designer controls to the methods derived from IViewModel that get and set values in the XmlModel. The ViewModel and an underlying XmlModel manage how an IVsTextBuffer is shared between the designer and the XML editor (if opened).
Inheritance: IViewModel, IDataErrorInfo, INotifyPropertyChanged
显示文件 Open project: blackberry/VSPlugin Class Usage Examples

Private Properties

Property Type Description
BufferReloaded void
CanEditFile bool
FormatBuffer void
GetParseTree System.Xml.Linq.XDocument
GetSource Microsoft.VisualStudio.Package.Source
GetXmlLanguageService Microsoft.VisualStudio.Package.LanguageService
LoadModelFromXmlModel void
LoadPermissions void
OnUnderlyingEditCompleted void
OnUndoRedoCompleted void
SaveModelToXmlModel void
getImagePath string
getPermissionIcon string
p_OutputDataReceived void

Public Methods

Method Description
AddIcon ( FileInfo icon ) : void
AddIcon ( string iconName ) : void
AddLocalAsset ( string assetPath ) : void
AddSplashScreen ( FileInfo splashScreen ) : void
AddSplashScreen ( string splashScreenName ) : void
CheckPermission ( string identifier ) : void
Close ( ) : void

Close View Model

DeleteIcon ( object iconName ) : void
DeleteLocalAsset ( object asset ) : void
DeleteSplashScreen ( object splashScreenName ) : void
DoIdle ( ) : void

Called on idle time. This is when we check if the designer is out of sync with the underlying text buffer.

EditLocalAsset ( string identifier, bool isPublic, string assetType ) : void
OnSelectChanged ( object p ) : void
UnCheckPermission ( string identifier ) : void
ViewModel ( Microsoft.VisualStudio.Shell.Package pkg, XmlStore xmlStore, XmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer ) : System

Constructor

getAuthor ( ) : string

Get the author ID

getAuthorID ( ) : string

Get the author ID

isPermissionChecked ( string identifier ) : bool
setAuthorInfo ( ) : void

Read the author information from the debug token and update the appropriate boxes.

this ( string columnName ) : string

Protected Methods

Method Description
NotifyPropertyChanged ( string propertyName ) : void

Private Methods

Method Description
BufferReloaded ( object sender, EventArgs e ) : void

BufferReloaded event handler

CanEditFile ( ) : bool

This function asks the QueryEditQuerySave service if it is possible to edit the file. This can result in an automatic checkout of the file and may even prompt the user for permission to checkout the file. If the user says no or the file cannot be edited this returns false.

FormatBuffer ( Microsoft.VisualStudio.Package.Source src ) : void

Reformat the text buffer

GetParseTree ( ) : System.Xml.Linq.XDocument

Get an up to date XML parse tree from the XML Editor.

GetSource ( ) : Microsoft.VisualStudio.Package.Source

Get the XML Editor Source object for this document.

GetXmlLanguageService ( ) : Microsoft.VisualStudio.Package.LanguageService

Get the XML Editor language service

LoadModelFromXmlModel ( ) : void

Load the model from the underlying text buffer.

LoadPermissions ( ) : void

Load the permissions list

OnUnderlyingEditCompleted ( object sender, XmlEditingScopeEventArgs e ) : void

Handle edit scope completion event. This happens when the XML editor buffer decides to update it's XDocument parse tree.

OnUndoRedoCompleted ( object sender, XmlEditingScopeEventArgs e ) : void

Handle undo/redo completion event. This happens when the user invokes Undo/Redo on a buffer edit operation. We need to resync when this happens.

SaveModelToXmlModel ( string undoEntry ) : void

This method is called when it is time to save the designer values to the underlying buffer.

getImagePath ( string imgName ) : string
getPermissionIcon ( string ID ) : string

Given the permission ID return the appropriate Icon

p_OutputDataReceived ( object sender, System e ) : void

On Data Received event handler

Method Details

AddIcon() public method

public AddIcon ( FileInfo icon ) : void
icon System.IO.FileInfo
return void

AddIcon() public method

public AddIcon ( string iconName ) : void
iconName string
return void

AddLocalAsset() public method

public AddLocalAsset ( string assetPath ) : void
assetPath string
return void

AddSplashScreen() public method

public AddSplashScreen ( FileInfo splashScreen ) : void
splashScreen System.IO.FileInfo
return void

AddSplashScreen() public method

public AddSplashScreen ( string splashScreenName ) : void
splashScreenName string
return void

CheckPermission() public method

public CheckPermission ( string identifier ) : void
identifier string
return void

Close() public method

Close View Model
public Close ( ) : void
return void

DeleteIcon() public method

public DeleteIcon ( object iconName ) : void
iconName object
return void

DeleteLocalAsset() public method

public DeleteLocalAsset ( object asset ) : void
asset object
return void

DeleteSplashScreen() public method

public DeleteSplashScreen ( object splashScreenName ) : void
splashScreenName object
return void

DoIdle() public method

Called on idle time. This is when we check if the designer is out of sync with the underlying text buffer.
public DoIdle ( ) : void
return void

EditLocalAsset() public method

public EditLocalAsset ( string identifier, bool isPublic, string assetType ) : void
identifier string
isPublic bool
assetType string
return void

NotifyPropertyChanged() protected method

protected NotifyPropertyChanged ( string propertyName ) : void
propertyName string
return void

OnSelectChanged() public method

public OnSelectChanged ( object p ) : void
p object
return void

UnCheckPermission() public method

public UnCheckPermission ( string identifier ) : void
identifier string
return void

ViewModel() public method

Constructor
public ViewModel ( Microsoft.VisualStudio.Shell.Package pkg, XmlStore xmlStore, XmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer ) : System
pkg Microsoft.VisualStudio.Shell.Package
xmlStore XmlStore
xmlModel XmlModel
provider IServiceProvider
buffer IVsTextLines
return System

getAuthor() public method

Get the author ID
public getAuthor ( ) : string
return string

getAuthorID() public method

Get the author ID
public getAuthorID ( ) : string
return string

isPermissionChecked() public method

public isPermissionChecked ( string identifier ) : bool
identifier string
return bool

setAuthorInfo() public method

Read the author information from the debug token and update the appropriate boxes.
public setAuthorInfo ( ) : void
return void

this() public method

public this ( string columnName ) : string
columnName string
return string