func init // define project name sys.set_project(this.name) // init AssemblyInfo element this.parent.init_managers('AssemblyInfo') if(linked("onError")) this.setfield('ex', 'ex' + this.id) end // initialize properties platform_target = this.props("Platform").value if(platform_target != 'x86') warning(this.name + ' - change property «Platform» to «x86»') end //sys.set_typed_field(20, 'AcceptButton') // makes implementation methods for properties sys._prop_init('Title', 0, 1, 2) // makes implementation of methods as properties //sys._mtd_as_prop_init('ShowDialog()') //sys._mtd_as_prop_init('Form') // makes implementation of simple methods //sys._method_init('Activate') //sys._method_init('Close') // initialize events //sys.add_event_type('onActivated', 'Activated', 'Event', 'args') // initialize common events and properties include("GtkWidget-init") end func doStart() // add using namespaces sys.add_use('System') if(not isdef("OneInstance")) sys.add_use('System.Threading') end // add common references sys.reference_add('System') sys.reference_add('Microsoft.CSharp') sys.reference_add('atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('gtk-dotnet, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') sys.reference_add('pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL') event('onCreate') // init all unlinked elements ---------------------------------- this.parent.initall() end func _finally() // create main unit --------------------------------------------- if(linked("onError")) // save original blocks sys.blocks_store() blk.inc() event("onError", this.ex + '.Message') // move blocks to implementation a = block.reggen() if(not blk_lvars.empty()) a.copyhere(blk_lvars) end a.copyhere(blk) // restore original blocks sys.blocks_restore() end b = block.reggen() b.copyhere(blk_using) .println() namespace = 'my' + code(replace(project_name(), "-" , "_")) b.println('namespace ', namespace) .println('{').inc() if(not blk_struct.empty()) b.copyhere(blk_struct) .println() end b.println('public class MyWindow : Window {').inc() .println('private MyWindow ', this.codename, ';') if(not blk_fields.empty()) b.copyhere(blk_fields) .println() end b.copyhere(blk_vars) .println() .println('public MyWindow(string[] args, string title) : base(title) {').inc() .println(this.codename, ' = this;') .println('#region initialize') .copyhere(blk_init) .println('#endregion') .println('#region main body') .copyhere(blk_lvars) .println() .copyhere(blk_body) .println('#endregion') .dec().println('}') .println('static void OnDelete(object o, DeleteEventArgs e) {').inc() .println('Application.Quit();') .dec().println('}') .println('private void addWidget(Container frame, Widget ctl, int x, int y, int w, int h) {').inc() .println('ctl.Allocation = new Gdk.Rectangle(x, y, w, h);') .println('frame.Add(ctl);') .dec().println('}') .copyhere(blk_proc_imp) for(i = 0; i < inits.size(); i++) b.copyhere(inits.get(i)) end b.copyhere(blk_attr) .println('[STAThread]') .println('static void Main(string[] args) {').inc() .println('Application.Init();') linked("onError") ? b.println('try {').inc() : '' if(not isdef("OneInstance")) b.println('using (Mutex mutex = new Mutex(false, "Global\\\\my', code(project_name()), '")) {').inc() .println('if(!mutex.WaitOne(0, false)) {').inc() .println('MessageDialog messageDialog = new MessageDialog(null, 0, MessageType.Info, ButtonsType.None, "Instance already running");') .println('messageDialog.Run();') .println('messageDialog.Destroy();') .println('return;') .dec().println('}') .println('MyWindow myWindow = new MyWindow(args, ', this.props("Title").Value, ');') .println('myWindow.DeleteEvent += OnDelete;') .println('myWindow.SetDefaultSize(', this.props("Width").value, ', ', this.props("Height").value, ');') .println('myWindow.ShowAll();') .println('Application.Run();') .dec().println('}') else b.println('MyWindow myWindow = new MyWindow(args,', this.props("Title").Value, ');') .println('myWindow.SetDefaultSize (', this.props("Width").value, ', ', this.props("Height").value, ');') .println('myWindow.ShowAll();') .println('Application.Run();') end if(linked("onError")) b.dec().println('} catch (Exception ', this.ex, ') {').inc() .copyhere(a) .dec().println('}') end b.dec().println('}') .dec().println('}') .copyhere(blk_class) .dec().println('}') .println('// Made by HiAsm Studio version ' + version) pname = code(project_name()) fname = pname + '.cs' b.save(fname) blk = block.reg("result") blk.println('') .println('').inc() .println('').inc() .println('', this.props("Configuration").value, '') .println('', this.props("Platform").value, '') .println('WinExe') .println('', namespace, '') .println('', pname, '') .println('v', code(this.props("Framework").value), '') .println('') .println('') .println('', this.props("FileAligment").value, '') .dec().println('') // Custom configuration .println('').inc() .println('', this.props("Platform").value, '') b = this.props("Constants").value arr = new array() if(b _and_ 1) arr.add('DEBUG') end if(b _and_ 2) arr.add('TRACE') end blk.println('true') if(not isdef("Symbols")) arr.add(code(this.props("Symbols").value)) end blk.println('', lower(this.props("DebugInfo").value), '') .println('', lower(this.props("Optimize").value), '') if(isdef("OuputPath")) blk.println('', code(project_dir()), '') else blk.println('', code(this.props("OutputPath").value), '') end blk.println('', arr.join(';'), '') .println('', lower(this.props("ErrorReport").value), '') .println('', this.props("WarningLevel").value, '') InsertOtherParams() blk.dec().println('') // Debug configuration .println('').inc() .println('', this.props("Platform").value, '') .println('true') arr = new array('DEBUG','TRACE') if(not isdef("Symbols")) arr.add(code(this.props("Symbols").value)) end blk.println('full') .println('false') if(isdef("OuputPath")) blk.println('', code(project_dir()), '') else blk.println('', code(this.props("OutputPath").value), '') end blk.println('', arr.join(';'), '') .println('prompt') .println('4') InsertOtherParams() blk.dec().println('') // Release configuration .println('').inc() .println('', this.props("Platform").value, '') .println('true') arr = new array('TRACE') if(not isdef("Symbols")) arr.add(code(this.props("Symbols").value)) end blk.println('pdbonly') .println('true') if(isdef("OuputPath")) blk.println('', code(project_dir()), '') else blk.println('', code(this.props("OutputPath").value), '') end blk.println('', arr.join(';'), '') .println('prompt') .println('4') InsertOtherParams() blk.dec().println('') // Build params .println('').inc() .println('', namespace, '.MyWindow') .dec().println('') .println('').inc() .copyhere(blk_refs) .dec().println('') .println('').inc() .println('').inc() .println('Form') .dec().println('') .copyhere(blk_comp) .dec().println('') .copyhere(blk_resx) .println('').inc() .println('') .dec().println('') .println('') .dec().println('') end func InsertOtherParams() blk.println('', lower(this.props("Unsafe").value), '') if(not isdef("SuppressWarning")) blk.println('', code(this.props("SuppressWarning").value), '') end if(not isdef("TreatWarnings")) blk.println('true') end if(not isdef("WarningsAsErrors")) blk.println('', code(this.props("WarningsAsErrors").value), '') end blk.println('', lower(this.props("Serialization").value), '') if(not isdef("Language")) blk.println('', code(this.props("Language").value), '') end if(not isdef("CheckOverflow")) blk.println('true') end if(not isdef("NoStdLib")) blk.println('true') end blk.copyhere(blk_prop) .println('true') end func Arguments return('args') end include("GtkWidget")