static IGradientShader[] ConvertShaders(XmlGradientShader[] shaderArray) { IGradientShader[] convertedShaders = new IGradientShader[shaderArray.Length]; for (int i = 0; i < shaderArray.Length; i++ ) { switch (shaderArray[i].GradientType) { default: convertedShaders[i] = shaderArray[i].ToColorShader(); break; } } return convertedShaders; }
private void cmdSave_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; LinearShader[] shaders = (from ListViewItem item in shaderList.Items select item.Tag).Cast<LinearShader>().ToArray(); XmlGradientShader[] xmlShaders = new XmlGradientShader[shaders.Length]; for (int i = 0; i < xmlShaders.Length; i++) { xmlShaders[i] = new XmlGradientShader(shaders[i]); } Data.Serialize(xmlShaders, "UIshaders.xml"); System.Windows.Forms.Cursor.Current = Cursors.Default; }