private void ResolveTypeName(string longName) { string error; XamlTypeName typeName = XamlTypeName.ParseInternal(longName, _context.FindNamespaceByPrefix, out error); if (typeName == null) { throw new XamlParseException(this, error); } // In curly form, we search for TypeName + 'Extension' before TypeName string bareTypeName = typeName.Name; typeName.Name = typeName.Name + KnownStrings.Extension; XamlType xamlType = _context.GetXamlType(typeName, false); // This would be cleaner if we moved the Extension fallback logic out of XSC if (xamlType == null || // Guard against Extension getting added twice (xamlType.UnderlyingType != null && KS.Eq(xamlType.UnderlyingType.Name, typeName.Name + KnownStrings.Extension))) { typeName.Name = bareTypeName; xamlType = _context.GetXamlType(typeName, true); } _tokenXamlType = xamlType; _tokenNamespace = typeName.Namespace; }
public static void Init() { menu = Menu.AddMenu("Azeryo'SINGED"); Casual = menu.AddSubMenu("Default"); Casual.AddSeparator("if no mod enabled"); Casual.Add(new MenuCheckbox("Q", "Use 'smart' Q", true)); Casual.Add(new MenuSlider("QMana", "min mana", 0, 100, 5)); Combo = menu.AddSubMenu("Combo"); Combo.Add(new MenuCheckbox("Q", "Use Q to poison").SetValue(true)); Combo.Add(new MenuCheckbox("E", "Use 'smart' E").SetValue(true)); Combo.Add(new MenuCheckbox("W", "Use 'smart' W").SetValue(true)); Combo.Add(new MenuCheckbox("R", "Use 'smart' R").SetValue(true)); LastHit = menu.AddSubMenu("LastHit"); LastHit.Add(new MenuCheckbox("E", "Use 'smart' E").SetValue(true)); LastHit.Add(new MenuCheckbox("Q", "Use 'smart' Q").SetValue(true)); Harass = menu.AddSubMenu("Harass (E engage)"); Harass.Add(new MenuCheckbox("Q", "Setup engages with 'smart' Q").SetValue(true)); Harass.Add(new MenuSlider("QMana", "Min mana % to Q", 0, 100, 34)); Harass.Add(new MenuCheckbox("E", "'smart' engages").SetValue(true)); LaneClear = menu.AddSubMenu("LaneClear"); LaneClear.Add(new MenuCheckbox("Q", "Use 'smart' Q").SetValue(true)); LaneClear.Add(new MenuSlider("QMana", "Min mana% to Q", 0, 100, 38)); KS = menu.AddSubMenu("KS"); KS.Add(new MenuCheckbox("E", "Use E").SetValue(true)); KS.Add(new MenuCheckbox("Q", "Use Q").SetValue(true)); Singed.MyOrbwalker = new Orbwalker.OrbwalkerInstance(menu.AddSubMenu("Orbwalker")); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,ShortCompShopName,LVUID,AOTypeID,Notes,CreationDate")] KS kS) { if (id != kS.ID) { return(NotFound()); } if (ModelState.IsValid) { try { kS.LastEditDate = DateTime.Now; _context.Update(kS); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KSExists(kS.ID)) { ModelState.AddModelError(string.Empty, "КС з таким ID вже існує."); return(View()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LVUID"] = new SelectList(_context.LVUs, "ID", "Name", kS.LVUID); return(View(kS)); }
public async Task <IActionResult> Create([Bind("ID,Name,ShortCompShopName,LVUID,AOTypeID,Notes")] KS kS) { ViewData["AOTypeID"] = new SelectList(_context.AOTypes, "ID", "Name", kS.AOTypeID); //var aotype = await _context.AOTypes.SingleOrDefaultAsync(t => t.AOTableName == "KS"); //Ищем тип ОА, НЕ ИМЯ,а именно "тип" //if (aotype != null) //{ // ViewData["AOTypeID"] = aotype.ID; // kS.AOType = aotype; //} //else //{ // ModelState.AddModelError(string.Empty, "Такий тип об'єкту автоматизації відсутній."); // return View(); //} //------------------------------------------------------------------------------ ViewData["LVUID"] = new SelectList(_context.LVUs, "ID", "Name", kS.LVUID); if (ModelState.IsValid) { kS.CreationDate = DateTime.Now; _context.Add(kS); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(kS)); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.Filter = "All Script Files|*.xbx; *.ks"; if (fd.ShowDialog() != DialogResult.OK) { return; } FilterMode = fd.FileName.ToLower().EndsWith(".ks"); byte[] Script = File.ReadAllBytes(fd.FileName); string[] Strings; if (FilterMode) { Filter = new KS(Script); Strings = Filter.Import(); } else { Editor = new XBX(Script); Strings = Editor.Import(); } listBox1.Items.Clear(); foreach (string str in Strings) { listBox1.Items.Add(str); } }
private string GetPrefixForClrNs(string clrNs, string assemblyName) { if (string.IsNullOrEmpty(assemblyName)) { return("local"); } StringBuilder builder = new StringBuilder(); foreach (string str in clrNs.Split(new char[] { '.' })) { if (!string.IsNullOrEmpty(str)) { builder.Append(char.ToLower(str[0], TypeConverterHelper.InvariantEnglishUS)); } } if (builder.Length <= 0) { return("local"); } string a = builder.ToString(); if (KS.Eq(a, "x")) { return("p"); } if (KS.Eq(a, "xml")) { return("p"); } return(a); }
private ICollection <XamlType> LookupAllTypes() { List <XamlType> list = new List <XamlType>(); if (this.IsResolved) { foreach (AssemblyNamespacePair pair in this._assemblyNamespaces) { Assembly assembly = pair.Assembly; if (assembly != null) { string clrNamespace = pair.ClrNamespace; foreach (Type type in assembly.GetTypes()) { if (KS.Eq(type.Namespace, clrNamespace)) { XamlType xamlType = this.SchemaContext.GetXamlType(type); list.Add(xamlType); } } } } } return(list.AsReadOnly()); }
private ICollection <XamlType> LookupAllTypes() { List <XamlType> xamlTypeList = new List <XamlType>(); if (IsResolved) { foreach (AssemblyNamespacePair assemblyNamespacePair in _assemblyNamespaces) { Assembly asm = assemblyNamespacePair.Assembly; if (asm == null) { // This is a dynamic assembly that got unloaded; ignore it continue; } string clrPrefix = assemblyNamespacePair.ClrNamespace; Type[] types = asm.GetTypes(); foreach (Type t in types) { if (!KS.Eq(t.Namespace, clrPrefix)) { continue; } XamlType xamlType = SchemaContext.GetXamlType(t); xamlTypeList.Add(xamlType); } } } return(xamlTypeList.AsReadOnly()); }
private void PreprocessForTypeArguments(List <XamlAttribute> attrList) { int typeArgsIdx = -1; for (int i = 0; i < attrList.Count; i++) { XamlAttribute attr = attrList[i]; // Find x:TypeArguments if it was present. if (KS.Eq(attr.Name.Name, XamlLanguage.TypeArguments.Name)) { string attrNamespace = _parserContext.FindNamespaceByPrefix(attr.Name.Prefix); XamlMember directiveProperty = _parserContext.ResolveDirectiveProperty(attrNamespace, attr.Name.Name); if (directiveProperty != null) { typeArgsIdx = i; _typeArgumentAttribute = attr; break; } } } if (typeArgsIdx >= 0) { attrList.RemoveAt(typeArgsIdx); } }
/// <summary> /// Configure key and value serdes /// </summary> /// <typeparam name="KS">Key serdes type</typeparam> /// <typeparam name="VS">Value serdes type</typeparam> /// <returns>Itself</returns> public Materialized <K, V, S> With <KS, VS>() where KS : ISerDes <K>, new() where VS : ISerDes <V>, new() { KeySerdes = new KS(); ValueSerdes = new VS(); return(this); }
private static bool TryParseUri(string uriInput, out string clrNs, out string assemblyName, out string error, bool returnErrors) { clrNs = null; assemblyName = null; error = null; int index = KS.IndexOf(uriInput, ":"); if (-1 == index) { if (returnErrors) { error = System.Xaml.SR.Get("MissingTagInNamespace", new object[] { ":", uriInput }); } return(false); } if (!KS.Eq(uriInput.Substring(0, index), "clr-namespace")) { if (returnErrors) { error = System.Xaml.SR.Get("MissingTagInNamespace", new object[] { "clr-namespace", uriInput }); } return(false); } int startIndex = index + 1; int num3 = KS.IndexOf(uriInput, ";"); if (-1 == num3) { clrNs = uriInput.Substring(startIndex); assemblyName = null; return(true); } int length = num3 - startIndex; clrNs = uriInput.Substring(startIndex, length); int num5 = num3 + 1; int num6 = KS.IndexOf(uriInput, "="); if (-1 == num6) { if (returnErrors) { error = System.Xaml.SR.Get("MissingTagInNamespace", new object[] { "=", uriInput }); } return(false); } if (!KS.Eq(uriInput.Substring(num5, num6 - num5), "assembly")) { if (returnErrors) { error = System.Xaml.SR.Get("AssemblyTagMissing", new object[] { "assembly", uriInput }); } return(false); } assemblyName = uriInput.Substring(num6 + 1); return(true); }
public override string ToString() { string str = (base.XamlType == null) ? string.Empty : base.XamlType.Name; string str2 = (base.Member == null) ? "-" : base.Member.Name; string str3 = (this.Instance == null) ? "-" : ((this.Instance is string) ? this.Instance.ToString() : "*"); string str4 = (this.Collection == null) ? "-" : "*"; return(KS.Fmt("{0}.{1} inst={2} coll={3}", new object[] { str, str2, str3, str4 })); }
//反填 public KS FanLB(int Id) { string sql = $"select * from KaoShi where KSid={Id}"; var dt = DBHelper.ExecuteQuery(sql, System.Data.CommandType.Text); string str = JsonConvert.SerializeObject(dt); KS z = JsonConvert.DeserializeObject <List <KS> >(str).FirstOrDefault(); return(z); }
private void скачатьToolStripMenuItem_Click(object sender, EventArgs e) { try { if (saveFileDialog1.ShowDialog() == DialogResult.Cancel) { return; } // получаем выбранный файл string filename = saveFileDialog1.FileName; var str = ""; if (KS != null) { str += "КС грамматика: " + Environment.NewLine; str += "Алфавит: " + KS.GetVTString() + Environment.NewLine; str += "Алфавит нетерминальный: " + KS.GetVNString() + Environment.NewLine; str += "Лямбда: " + KS.Lambda + Environment.NewLine; str += "Стартовый символ: " + KS.Start + Environment.NewLine; str += "Грамматика: " + KS.ToString() + Environment.NewLine; if (ChainKS != null) { str += "Цепочки: " + Environment.NewLine; foreach (var ch in ChainKS) { str += ch.Str + Environment.NewLine; } } } if (BNF != null) { str += "БНФ грамматика: " + Environment.NewLine; str += "Алфавит: " + BNF.GetVTString() + Environment.NewLine; str += "Алфавит нетерминальный: " + BNF.GetVNString() + Environment.NewLine; str += "Лямбда: " + BNF.Lambda + Environment.NewLine; str += "Стартовый символ: " + BNF.Start + Environment.NewLine; str += "Грамматика: " + BNF.ToString() + Environment.NewLine; if (ChainBNF != null) { str += "Цепочки: " + Environment.NewLine; foreach (var ch in ChainBNF) { str += ch.Str + Environment.NewLine; } } } // сохраняем текст в файл System.IO.File.WriteAllText(filename, str); MessageBox.Show("Файл сохранен"); } catch (Exception ex) { textBox1.Text += Environment.NewLine + ex.Message; } }
public static bool TryParseUri(string uriInput, out string clrNs, out string assemblyName) { clrNs = null; assemblyName = null; // xmlns:foo="clr-namespace:System.Windows;assembly=myassemblyname" // xmlns:bar="clr-namespace:MyAppsNs" // xmlns:spam="clr-namespace:MyAppsNs;assembly=" int colonIdx = KS.IndexOf(uriInput, ":"); if (colonIdx == -1) { return(false); } string keyword = uriInput.Substring(0, colonIdx); if (!KS.Eq(keyword, KnownStrings.UriClrNamespace)) { return(false); } int clrNsStartIdx = colonIdx + 1; int semicolonIdx = KS.IndexOf(uriInput, ";"); if (semicolonIdx == -1) { clrNs = uriInput.Substring(clrNsStartIdx); assemblyName = null; return(true); } else { int clrnsLength = semicolonIdx - clrNsStartIdx; clrNs = uriInput.Substring(clrNsStartIdx, clrnsLength); } int assemblyKeywordStartIdx = semicolonIdx + 1; int equalIdx = KS.IndexOf(uriInput, "="); if (equalIdx == -1) { return(false); } keyword = uriInput.Substring(assemblyKeywordStartIdx, equalIdx - assemblyKeywordStartIdx); if (!KS.Eq(keyword, KnownStrings.UriAssembly)) { return(false); } assemblyName = uriInput.Substring(equalIdx + 1); return(true); }
public override string ToString() { string type = (this.XamlType == null) ? string.Empty : this.XamlType.Name; string prop = (this.Member == null) ? "-" : this.Member.Name; string inst = (Instance == null) ? "-" : ((Instance is string) ? Instance.ToString() : "*"); string coll = (Collection == null) ? "-" : "*"; string res = KS.Fmt("{0}.{1} inst={2} coll={3}", type, prop, inst, coll); return(res); }
private bool IsAttachablePropertySetter(MethodInfo mi, out string name) { name = null; if (!KS.StartsWith(mi.Name, "Set")) { return(false); } if (!this.IsAttachablePropertySetter(mi)) { return(false); } name = mi.Name.Substring("Set".Length); return(true); }
KS ks2(double[] P, bool ris, bool test) { double xmin; Dnmin = -2; kol = 0; List <double> disti = P.Distinct().ToList(); System.ComponentModel.BackgroundWorker[] BW = new System.ComponentModel.BackgroundWorker[disti.Count]; Xmin = 0; int i = 0; foreach (double p in disti) { xmin = p; double alfi = ot(xmin, P); BW[i] = new System.ComponentModel.BackgroundWorker(); BW[i].DoWork += new System.ComponentModel.DoWorkEventHandler(BackgroundWorker1_DoWork); BW[i].RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(BackgroundWorker1_RunWorkerCompleted); List <double[]> rasp = dist2(co, test, xmin); if (rasp[rasp.Count - 1][1] == 1) { break; } Find fd = new Find(xmin, alfi, rasp, ris); BW[i].RunWorkerAsync(fd); if (double.IsNaN(fd.D)) { break; } i++; } while (kol != BW.Length - 1) { Application.DoEvents(); } if (ris == true) { chart2.SaveImage(Application.StartupPath + "\\p-test\\DN\\" + code + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); } KS res = new KS(Xmin, ot(Xmin, P), Dnmin); return(res); }
private bool IsAttachablePropertySetter(MethodInfo mi, out string name) { name = null; if (!KS.StartsWith(mi.Name, KnownStrings.Set)) { return(false); } if (!IsAttachablePropertySetter(mi)) { return(false); } name = mi.Name.Substring(KnownStrings.Set.Length); return(true); }
private void StripUidProperty() { for (int i = _attributes.Count - 1; i >= 0; i--) { if (KS.Eq(_attributes[i].Name.ScopedName, XamlLanguage.Uid.Name)) { _attributes.RemoveAt(i); } } if (_attributes.Count == 0) { _attributes = null; } }
private bool IsAttachableEventAdder(MethodInfo mi, out string name) { name = null; if (!KS.StartsWith(mi.Name, "Add") || !KS.EndsWith(mi.Name, "Handler")) { return(false); } if (!this.IsAttachableEventAdder(mi)) { return(false); } name = mi.Name.Substring("Add".Length, (mi.Name.Length - "Add".Length) - "Handler".Length); return(true); }
private static void InitMenu() { Menu = MainMenu.AddMenu("Kappa Vegiar", "menu"); ComboM = Menu.AddSubMenu("Combo", "combo"); RMenu = Menu.AddSubMenu("R Manager", "rmng"); HarassM = Menu.AddSubMenu("Harass", "harass"); LaneclearM = Menu.AddSubMenu("Laneclear", "laneclear"); Draw = Menu.AddSubMenu("Drawings", "draw"); KS = Menu.AddSubMenu("Killsteal", "ks"); Menu.AddGroupLabel("Kappa Veigar - Made by Capitao Addon"); Menu.AddSeparator(); Menu.AddSeparator(); Menu.AddLabel("Version: 1.0.0.0"); ComboM.Add("stunW", new CheckBox("Only use W in immobile enemies")); ComboM.Add("useQ", new CheckBox("Use Q in Combo")); ComboM.Add("useW", new CheckBox("Use W in Combo")); ComboM.Add("useE", new CheckBox("Use E in Combo")); ComboM.Add("useR", new CheckBox("Use R when you can kill target")); KS.Add("useQ", new CheckBox("Q to KS")); KS.Add("useE", new CheckBox("Use E + W")); KS.Add("useR", new CheckBox("R to KS")); HarassM.Add("useQ", new CheckBox("Use in Combo")); HarassM.Add("manaQ", new Slider("Min mana to use Q harass", 60, 0, 100)); HarassM.Add("autoQ", new KeyBind("Auto harass", false, KeyBind.BindTypes.PressToggle, 'X')); HarassM.Add("farm", new CheckBox("Priority farm", false)); LaneclearM.Add("farmQ", new CheckBox("Q to lasthit")); LaneclearM.Add("manaQ", new Slider("Min mana to use Q", 30, 0, 100)); LaneclearM.Add("minQ", new CheckBox("Use Q only when you can farm 2 minions", false)); LaneclearM.AddSeparator(); LaneclearM.Add("farmW", new CheckBox("W to laneclear")); LaneclearM.Add("manaW", new Slider("Min mana to use W", 60, 0, 100)); LaneclearM.Add("minW", new Slider("Min minions to use W", 3, 1, 9)); Draw.Add("drawq", new CheckBox("Draw Q")); Draw.Add("draww", new CheckBox("Draw W")); Draw.Add("drawe", new CheckBox("Draw E")); Draw.Add("drawr", new CheckBox("Draw R")); // R foreach (var enemy in ObjectManager.Get <AIHeroClient>().Where(a => a.IsEnemy)) { RMenu.Add(enemy.ChampionName + "R", new CheckBox("Use R when you can kill " + enemy.ChampionName)); } }
private bool IsAttachableEventAdder(MethodInfo mi, out string name) { name = null; if (!KS.StartsWith(mi.Name, KnownStrings.Add) || !KS.EndsWith(mi.Name, KnownStrings.Handler)) { return(false); } if (!IsAttachableEventAdder(mi)) { return(false); } name = mi.Name.Substring(KnownStrings.Add.Length, mi.Name.Length - KnownStrings.Add.Length - KnownStrings.Handler.Length); return(true); }
internal bool CheckIsXmlNamespaceDefinition(out string definingPrefix, out string uri) { uri = string.Empty; definingPrefix = string.Empty; if (KS.Eq(this.Name.Prefix, "xmlns")) { uri = this.Value; definingPrefix = !this.Name.IsDotted ? this.Name.Name : (this.Name.OwnerName + "." + this.Name.Name); return(true); } if (string.IsNullOrEmpty(this.Name.Prefix) && KS.Eq(this.Name.Name, "xmlns")) { uri = this.Value; definingPrefix = string.Empty; return(true); } return(false); }
void Goodness(double alfa, double xmin, double Dmin, double[] V) { double pv = 0; int N = V.Length; int Ntail = 0; for (int i = 0; i < N; i++) { if (V[i] < xmin) { Ntail++; } else { break; } } Ntail = N - Ntail; double v = (double)Ntail / (double)N; int kl = 2500; for (int k = 1; k <= kl; k++) { double[] W = GenVib(alfa, N, xmin, v, Ntail, V); co.Clear(); co = coun(W); InFile("Test " + k.ToString() + ":", "ptest"); KS SD = ks2(W, false, false); W = new double[0]; InFile("xmin = " + SD.xmin + "; alfa = " + SD.alfa + "; Dnmin = " + SD.Dnmin, "ptest"); if (SD.Dnmin > Dmin) { pv++; } InFile("p = " + pv.ToString(), "ptest"); } pv = pv / kl; InFile("p = " + pv.ToString(), "ptest"); label1.Text = "p = " + pv.ToString(); }
private void UpdatePreferredPrefixes(XmlNsInfo newNamespaces, ConcurrentDictionary <string, string> prefixDict) { foreach (KeyValuePair <string, string> pair in newNamespaces.Prefixes) { string str; string preferredPrefix = pair.Value; if (!prefixDict.TryGetValue(pair.Key, out str)) { str = TryAdd <string, string>(prefixDict, pair.Key, preferredPrefix); } while (str != preferredPrefix) { preferredPrefix = XmlNsInfo.GetPreferredPrefix(str, preferredPrefix); if (!KS.Eq(preferredPrefix, str)) { str = TryUpdate <string, string>(prefixDict, pair.Key, preferredPrefix, str); } } } }
public static void Init() { menu = Menu.AddMenu("Azeryo'Trynda"); Perma = menu.AddSubMenu("Perma"); Perma.Add(new MenuCheckbox("R", "Use R", true)); Perma.Add(new MenuCheckbox("Q", "Use Q", true)); Combo = menu.AddSubMenu("Combo"); Combo.Add(new MenuCheckbox("E", "Use E").SetValue(true)); Combo.Add(new MenuCheckbox("W", "Use W").SetValue(true)); LastHit = menu.AddSubMenu("LastHit"); LastHit.Add(new MenuCheckbox("E", "Use E").SetValue(true)); LaneClear = menu.AddSubMenu("LaneClear"); LaneClear.Add(new MenuCheckbox("E", "Use E").SetValue(true)); KS = menu.AddSubMenu("KS"); KS.Add(new MenuCheckbox("E", "Use E").SetValue(true)); }
private void ResolveTypeName(string longName) { string str; XamlTypeName typeName = XamlTypeName.ParseInternal(longName, new Func <string, string>(this._context.FindNamespaceByPrefix), out str); if (typeName == null) { throw new XamlParseException(this, str); } string name = typeName.Name; typeName.Name = typeName.Name + "Extension"; XamlType xamlType = this._context.GetXamlType(typeName, false); if ((xamlType == null) || ((xamlType.UnderlyingType != null) && KS.Eq(xamlType.UnderlyingType.Name, typeName.Name + "Extension"))) { typeName.Name = name; xamlType = this._context.GetXamlType(typeName, true); } this._tokenXamlType = xamlType; this._tokenNamespace = typeName.Namespace; }
private void PreprocessForTypeArguments(List <XamlAttribute> attrList) { int index = -1; for (int i = 0; i < attrList.Count; i++) { XamlAttribute attribute = attrList[i]; if (KS.Eq(attribute.Name.Name, XamlLanguage.TypeArguments.Name)) { string xamlNS = this._parserContext.FindNamespaceByPrefix(attribute.Name.Prefix); if (this._parserContext.ResolveDirectiveProperty(xamlNS, attribute.Name.Name) != null) { index = i; this._typeArgumentAttribute = attribute; break; } } } if (index >= 0) { attrList.RemoveAt(index); } }
// ========================== internal ================================ internal bool CheckIsXmlNamespaceDefinition(out string definingPrefix, out string uri) { uri = string.Empty; definingPrefix = string.Empty; // case where: xmlns:pre="ValueUri" if (KS.Eq(Name.Prefix, KnownStrings.XmlNsPrefix)) { uri = Value; definingPrefix = !Name.IsDotted ? Name.Name : Name.OwnerName + "." + Name.Name; return(true); } // case where: xmlns="ValueUri" if (String.IsNullOrEmpty(Name.Prefix) && KS.Eq(Name.Name, KnownStrings.XmlNsPrefix)) { uri = Value; definingPrefix = string.Empty; return(true); } return(false); }
private void gantt1_AfterDrawHeader(object sender, KS.Gantt.GanttDrawEventArgs e) { if (parent == null) return; KS.Gantt.BoxFormatStyle bfstyle = new BoxFormatStyle(); bfstyle.BackgroundStyle.GlossBlendStyle = GradientBlendStyle.None; bfstyle.BackgroundStyle.Color = Color.Gray; bfstyle.BackgroundStyle.GlossColor = Color.Gray; bfstyle.BorderStyle.Color = Color.DarkGray; var baseplan = this.parent.InstHelperPLM.GetActiveBP(); bool doShowBasePlan = this.ShowBasePlan && parent.tabMain.SelectedTab.Name == "tabGantt"; // Рисование базового плана для групп if (doShowBasePlan && baseplan != null) for (int i = 0; i < gantt1.Groups.Count; i++) { GroupItem group = gantt1.Groups[i]; DrawBaseLine(group, baseplan, bfstyle, e.Gfx); } // Отрисовка задач for (int i = 0; i < gantt1.Tasks.Count; i++) { TaskItem task = gantt1.Tasks[i]; // Отрисовка фильтра по ответсвенным //TODO task.Visible = !Program.FilterByResponce.IsFiltered; var d = task.GetProperty("ResponsibleName"); if (Program.FilterByResponce.IsFiltered && d != null && d.ToString() == Program.FilterByResponce.FilterString) { task.FormatStyle.BorderStyle.Color = Color.Blue; task.FormatStyle.BorderStyle.LineWidth = 2; } else { if (task.IsOutLaw()) { task.FormatStyle.BorderStyle.Color = Color.Orange; task.FormatStyle.BorderStyle.LineWidth = 2; } else { task.FormatStyle.BorderStyle.Color = Color.Black; task.FormatStyle.BorderStyle.LineWidth = 1; } } // Рисование базового плана if (doShowBasePlan && baseplan != null) DrawBaseLine(task, baseplan, bfstyle, e.Gfx); task.FormatStyle.BackgroundStyle.Color = this.usualTaskColor; // Рисование мониторинга задач if (DoMonitor && baseplan != null) DrawTaskMonitored(task, baseplan); // Рисование критического пути if (ShowCriticalPath && task.IsCriticalPath) task.FormatStyle.BackgroundStyle.Color = Color.Purple; } }
void gantt1_BeforeDelete(object sender, KS.Gantt.GanttCancelEventArgs e) { string strMessage = ""; switch (ucGantt1.gantt1.ViewMode) { case Gantt.ViewModes.Tasks: strMessage = String.Format(Properties.Resources.Question_DeleteItems, ucGantt1.gantt1.SelectedItems.Count.ToString()); break; case Gantt.ViewModes.Resources: strMessage = String.Format(Properties.Resources.Question_DeleteItems, ucGantt1.gantt1.SelectedResources.Count.ToString()); break; } if (Program.QuestionMsgBox(strMessage) != DialogResult.Yes) e.Cancel = true; }
void gantt1_ItemDoubleClick(object sender, KS.Gantt.GanttItemMouseEventArgs e) { if (this.MyJob == "Project") { if (e.Item.ItemType == GanttItemType.TaskItem) { KS.Gantt.Dialogs.TaskEditDialog Dlg = new KS.Gantt.Dialogs.TaskEditDialog(); KS.Gantt.Gantt m_GanttControl = e.Item.GanttControl; Dlg.Edit(m_GanttControl, e.Item); Dlg.ShowDialog(this); if (Dlg.OkPressed) { var gt = (KS.Gantt.TaskItem)e.Item; InstHelperPLM.NewTask(gt); } Dlg.Dispose(); Dlg = null; } else { KS.Gantt.Dialogs.GroupEditDialog Dlg = new KS.Gantt.Dialogs.GroupEditDialog(); KS.Gantt.Gantt m_GanttControl = e.Item.GanttControl; Dlg.Edit(m_GanttControl, e.Item); Dlg.ShowDialog(this); if (Dlg.OkPressed) { var gt = (KS.Gantt.GroupItem)e.Item; InstHelperPLM.NewGroup(gt); } Dlg.Dispose(); Dlg = null; } } }
private void DrawBaseLine(GanttItem item, BasePlans.BasePlan baseplan, KS.Gantt.BoxFormatStyle bfstyle, Graphics Gfx) { // Поиск соответствующего задаче базового плана. var plmobj = this.parent.InstHelperPLM.DictTasksGetInfoObj(item.Key); var baseline2draw = baseplan.GetBaseLine4Task(plmobj); if (baseline2draw == null) return; Rectangle r = gantt1.RowBounds(item.RowIndex); int barbott = r.Top + gantt1.BarHeight + (r.Height - gantt1.BarHeight) / 2; int x1 = gantt1.Date2x(baseline2draw.Dates.DataBegTask); int x2 = gantt1.Date2x(baseline2draw.Dates.DataEndTask); Rectangle r2 = new Rectangle(x1, barbott, x2 - x1, gantt1.BarHeight / 4); // only paint if on screen if (r2.IntersectsWith(gantt1.ClientRectangle)) { bfstyle.DrawBox(Gfx, r2, Gantt.BarStyles.Rounded); } }