Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
Вы используете устаревший браузер. Этот и другие сайты могут отображаться в нём некорректно. Вам необходимо обновить браузер или попробовать использовать другой.
Thank you @LaGir! You are right, I should have looked for "FileSystem" into the webframe docs. Now I know what to look for.
I am trying to move all my code to CC so I can do a better debugging but even if my code worked "out of the box" in OwnCode, I run into some basic problems. I'm still having trouble understanding how the CC works.
What I have understood so far is that I have one main Program.cs that executes functions created in ActionGroup1,2,3 ... like this:
And inside the ActionGroupX.cs files I have to create my functions using the instance and project as arguments:
Код:
using System;
using System.Data;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Resources;
using System.ComponentModel;
using System.Collections.Generic;
using ZennoLab.CommandCenter;
using ZennoLab.InterfacesLibrary.ProjectModel;
using ZennoLab.InterfacesLibrary.ProjectModel.Enums;
using ZennoLab.Emulation;
namespace myProject
{
internal class ActionGroup1
{
public static int myCustomFunction(int myCustomVar, Instance instance, IZennoPosterProjectModel project)
{
Tab tab = instance.MainTab;
Document doc = tab.MainDocument;
HtmlElementCollection heCol = doc.FindElementsByAttribute("div", "class", "myClass", "text");
int count = heCol.Count;
return 0;
}
}
}
The problem is that I cannot retrieve the html elements correctly, meaning that the count variable returns 0 even if that div class element exists and previously returned the correct value. I also checked the doc variable and has the right value (the current document html)
Код:
HtmlElement he = tab.FindElementByAttribute("div", "class", "myClass", "text", 0)
doesn't return anything also even if when I check the tab I can see the correct html inside.
I think it has something to do with instance and project but don't know what should I do next.
Not sure if my approach described above is the correct but it works now. The problem was that the previous ActionGroup was loading a page that did not finish loading so adding:
Tab tab = instance.ActiveTab;
if ((tab.IsVoid) || (tab.IsNull)) return -1;
if (tab.IsBusy) tab.WaitDownloading();
If you need to use properties or methods of instance or project in your function/method - use them as arguments, otherwise - don't use. I think that's enough.
If your template is complicated, it makes sense to create separate class with instance and project properties, and initialize them at the beginning of this template. In this case you can write like:
Код:
MyClass.Project.SendInfoToLog("text");
...and you will not need to use instance and project as arguments in any methods.
Thread.Sleep belongs to the namespace System.Threading, maybe you don't have this "using" in ActionGroup2.cs (by default it is absent in CC).
Or you can just write like this: System.Threading.Thread.Sleep(beforeRnd);
Before using the CurrentTheard.cs method you described above I was able to use Thread.Sleep(beforeRnd) just like that but you are right, using System.Threading.Thread.Sleep(beforeRnd); works out of the box