public static void Run() { // ExStart:RichTextCustomDataLabelOfChartPoint // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create a workbook from source Excel file Workbook workbook = new Workbook(dataDir + "sample.xlsx"); // Access first worksheet Worksheet worksheet = workbook.Worksheets[0]; // Access the first chart inside the sheet Chart chart = worksheet.Charts[0]; // Access the data label of first series first point DataLabels dlbls = chart.NSeries[0].Points[0].DataLabels; // Set data label text dlbls.Text = "Rich Text Label"; // Set the font setting of the first 10 characters FontSetting fntSetting = dlbls.Characters(0, 10); fntSetting.Font.Color = Color.Red; fntSetting.Font.IsBold = true; // Save the workbook workbook.Save(dataDir + "output_out.xlsx"); // ExEnd:RichTextCustomDataLabelOfChartPoint }
public static void Run() { //Output directory string outputDir = RunExamples.Get_OutputDirectory(); // ExStart:1 // Create workbook object Workbook workbook = new Workbook(); // Access first worksheet Worksheet worksheet = workbook.Worksheets[0]; // Create a textbox with some text TextBox textbox = worksheet.Shapes.AddTextBox(0, 0, 0, 0, 100, 700); textbox.Text = "Aspose File Format APIs"; textbox.Font.Size = 44; // Sets preset WordArt style to the text of the shape. FontSetting fntSetting = textbox.GetCharacters()[0] as FontSetting; fntSetting.SetWordArtStyle(PresetWordArtStyle.WordArtStyle3); // Save the workbook in xlsx format workbook.Save(outputDir + "outputSetPresetWordArtStyle.xlsx"); // ExEnd:1 Console.WriteLine("SetPresetWordArtStyle executed successfully."); }
public static void Run() { //Source directory string sourceDir = RunExamples.Get_SourceDirectory(); //Output directory string outputDir = RunExamples.Get_OutputDirectory(); // Create a workbook from source Excel file Workbook workbook = new Workbook(sourceDir + "sampleRichTextCustomDataLabel.xlsx"); // Access first worksheet Worksheet worksheet = workbook.Worksheets[0]; // Access the first chart inside the sheet Chart chart = worksheet.Charts[0]; // Access the data label of first series first point DataLabels dlbls = chart.NSeries[0].Points[0].DataLabels; // Set data label text dlbls.Text = "Rich Text Label"; // Set the font setting of the first 10 characters FontSetting fntSetting = dlbls.Characters(0, 10); fntSetting.Font.Color = Color.Red; fntSetting.Font.IsBold = true; // Save the workbook workbook.Save(outputDir + "outputRichTextCustomDataLabel.xlsx"); Console.WriteLine("RichTextCustomDataLabel executed successfully."); }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create workbook object Workbook wb = new Workbook(); // Access first worksheet Worksheet ws = wb.Worksheets[0]; // Create a textbox with some text TextBox tb = ws.Shapes.AddTextBox(0, 0, 0, 0, 100, 700); tb.Text = "Aspose File Format APIs"; tb.Font.Size = 44; // Sets preset WordArt style to the text of the shape. FontSetting fntSetting = tb.GetCharacters()[0] as FontSetting; fntSetting.SetWordArtStyle(PresetWordArtStyle.WordArtStyle3); // Save the workbook in xlsx format wb.Save(dataDir + "output_out_.xlsx"); // ExEnd:1 }
public static void Run() { // ExStart:1 //Source directory string sourceDir = RunExamples.Get_SourceDirectory(); //Output directory string outputDir = RunExamples.Get_OutputDirectory(); // Load your excel file inside a workbook obect Workbook wb = new Workbook(sourceDir + "sampleChangeTextBoxOrShapeCharacterSpacing.xlsx"); // Access your text box which is also a shape object from shapes collection Shape shape = wb.Worksheets[0].Shapes[0]; // Access the first font setting object via GetCharacters() method FontSetting fs = (FontSetting)shape.GetCharacters()[0]; //Set the character spacing to point 4 fs.TextOptions.Spacing = 4; // Save the workbook in xlsx format wb.Save(outputDir + "outputChangeTextBoxOrShapeCharacterSpacing.xlsx", SaveFormat.Xlsx); // ExEnd:1 Console.WriteLine("ChangeTextBoxOrShapeCharacterSpacing executed successfully.\r\n"); }
void SetFont() { var settings = SettingsProvider.Current.Settings.PersonalSettings; var result = new FontSetting(settings.FontColor, settings.FontName, settings.FontSize, settings.FontStyle); txtMessage.FontFamily = result.Family; txtMessage.FontSize = result.Size; txtMessage.Foreground = result.Foreground; txtMessage.FontWeight = result.Weight; txtMessage.FontStyle = result.Style; }
void AddMessage(InlineCollection inlines) { var items = Parsers.ParseText(Message); var fontsettings = new FontSetting(Color, FontName, FontSize, FontStyle); foreach (var item in items) { item.FontFamily = fontsettings.Family; item.FontSize = fontsettings.Size; item.Foreground = fontsettings.Foreground; item.FontStyle = fontsettings.Style; item.FontWeight = fontsettings.Weight; } inlines.AddRange(items); }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Load your excel file inside a workbook obect Workbook wb = new Workbook(dataDir + "character-spacing.xlsx"); // Access your text box which is also a shape object from shapes collection Shape shape = wb.Worksheets[0].Shapes[0]; // Access the first font setting object via GetCharacters() method FontSetting fs = (FontSetting)shape.GetCharacters()[0]; // Save the workbook in xlsx format wb.Save(dataDir + "ChangeTextBoxOrShareCharacterSpacing_out_.xlsx", SaveFormat.Xlsx); // ExEnd:1 }
//////////////////////////////////////////////////////////////////////// /// Func public InGameUISetting() { _fontSetting = new FontSetting(); _panelBackgroundSetting = new PanelBackgroundSetting(); _fontSetting._speakerNameFontSize = Constants.BASIC_FONT_SIZE; _fontSetting._speakerNameFontColor = new Color(0f, 0f, 0f, 1.0f); _fontSetting._dialogueFontSize = Constants.BASIC_FONT_SIZE; _fontSetting._dialogueFontColor = new Color(0f, 0f, 0f, 1.0f); _fontSetting._dialogueButtonFontSize = Constants.BASIC_FONT_SIZE; _fontSetting._dialogueButtonFontColor = new Color(0f, 0f, 0f, 1.0f); _fontSetting._branchButtonFontSize = Constants.BASIC_FONT_SIZE; _fontSetting._branchButtonFontColor = new Color(0f, 0f, 0f, 1.0f); _panelBackgroundSetting._speakerNamePanelColor = new Color(1.0f, 1.0f, 1.0f, 1.0f); _panelBackgroundSetting._dialoguePanelColor = new Color(1.0f, 1.0f, 1.0f, 1.0f); _panelBackgroundSetting._dialogueButtonColor = new Color(1.0f, 1.0f, 1.0f, 1.0f); _panelBackgroundSetting._branchButtonColor = new Color(1.0f, 1.0f, 1.0f, 1.0f); }
public void CellsPostCellCharactersExample() { string name = "Book1.xlsx"; string sheetName = "SHEET2"; string cellName = "G8"; List <FontSetting> options = new List <FontSetting>(); Font font = new Font(); font.Size = 10; FontSetting fs1 = new FontSetting(); fs1.Font = font; fs1.Length = 2; fs1.StartIndex = 0; options.Add(fs1); string folder = null; new Config().UpdateDataFile(null, "Book1.xlsx"); var response = instance.CellsPostCellCharacters(name, sheetName, cellName, options, folder); Console.WriteLine(response); }
public void SetFont(FontSetting fontSetting, Font font) { foreach (QueryScript queryScript in QueryScripts) { switch (fontSetting) { case FontSetting.QueryScriptFont: queryScript.QueryScriptWindow.SetQueryScriptFont(font); break; case FontSetting.ResultTableFont: queryScript.QueryScriptWindow.SetResultTableFont(font); break; case FontSetting.TextResultsFont: queryScript.QueryScriptWindow.SetTextResultsFont(font); break; } } FontConverter fontConverter = new FontConverter(); Settings[fontSetting.ToString()] = fontConverter.ConvertToString(font); }
public void CellsPostCellCharactersTest() { // TODO uncomment below to test the method and replace null with proper value string name = BOOK1; string sheetName = SHEET2; string cellName = "G8"; List <FontSetting> options = new List <FontSetting>(); Font font = new Font(); font.Size = 10; FontSetting fs1 = new FontSetting(); fs1.Font = font; fs1.Length = 2; fs1.StartIndex = 0; options.Add(fs1); string folder = TEMPFOLDER; UpdateDataFile(TEMPFOLDER, BOOK1); var response = instance.CellsPostCellCharacters(name, sheetName, cellName, options, folder); Assert.IsInstanceOf <SaaSposeResponse>(response, "response is SaaSposeResponse"); Assert.AreEqual(response.Status, "OK"); }
public SettingsModel(Sidebar sidebar) { DockEdgeItems = new DockEdge[2] { DockEdge.Left, DockEdge.Right }; DockEdge = Framework.Settings.Instance.DockEdge; Monitor[] _monitors = Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Framework.Settings.Instance.ScreenIndex < _monitors.Length) { ScreenIndex = Framework.Settings.Instance.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } UIScale = Framework.Settings.Instance.UIScale; XOffset = Framework.Settings.Instance.XOffset; YOffset = Framework.Settings.Instance.YOffset; PollingInterval = Framework.Settings.Instance.PollingInterval; UseAppBar = Framework.Settings.Instance.UseAppBar; AlwaysTop = Framework.Settings.Instance.AlwaysTop; HighDPISupport = Framework.Settings.Instance.HighDPISupport; ShowAltTab = Framework.Settings.Instance.ShowAltTab; ClickThrough = Framework.Settings.Instance.ClickThrough; ShowTrayIcon = Framework.Settings.Instance.ShowTrayIcon; AutoUpdate = Framework.Settings.Instance.AutoUpdate; RunAtStartup = Framework.Settings.Instance.RunAtStartup; SidebarWidth = Framework.Settings.Instance.SidebarWidth; AutoBGColor = Framework.Settings.Instance.AutoBGColor; BGColor = Framework.Settings.Instance.BGColor; BGOpacity = Framework.Settings.Instance.BGOpacity; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Framework.Settings.Instance.FontSetting; FontColor = Framework.Settings.Instance.FontColor; AlertFontColor = Framework.Settings.Instance.AlertFontColor; DateSettingItems = new DateSetting[4] { DateSetting.Disabled, DateSetting.Short, DateSetting.Normal, DateSetting.Long }; DateSetting = Framework.Settings.Instance.DateSetting; CollapseMenuBar = Framework.Settings.Instance.CollapseMenuBar; ShowClock = Framework.Settings.Instance.ShowClock; Clock24HR = Framework.Settings.Instance.Clock24HR; ObservableCollection <MonitorConfig> _config = new ObservableCollection <MonitorConfig>(Framework.Settings.Instance.MonitorConfig.Select(c => c.Clone()).OrderByDescending(c => c.Order)); if (sidebar.Ready) { foreach (MonitorConfig _record in _config) { _record.HardwareOC = new ObservableCollection <HardwareConfig>( from hw in sidebar.Model.MonitorManager.GetHardware(_record.Type) join config in _record.Hardware on hw.ID equals config.ID into merged from newhw in merged.DefaultIfEmpty(hw) orderby newhw.Order descending, newhw.Name ascending select newhw ); } } MonitorConfig = _config; if (Framework.Settings.Instance.Hotkeys != null) { ToggleKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Toggle); ShowKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Show); HideKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Hide); ReloadKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Reload); CloseKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Close); CycleEdgeKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleEdge); CycleScreenKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleScreen); } IsChanged = false; }
/// <summary> /// Get text with formating from Excel cell /// </summary> /// <param name="cell">Input Excel cell</param> /// <param name="doc">Parent document</param> /// <returns>Run that contains text with formating</returns> private ArrayList GetTextFromCell(Aspose.Cells.Cell cell, Document doc) { //Create new array list //We will store runs in this list ArrayList wordRuns = new ArrayList(); //Get Chracters objects from the cell FontSetting[] charactersList = cell.GetCharacters(); if (charactersList == null) charactersList = new FontSetting[0]; //Get sring value from the cell string cellValue = cell.StringValue; //If there is some formatig in the cell //charactersList will contains one or more Characters objects //And we should create collection of Runs that will represent this formating if (charactersList.Length > 0) { int startIndex = ((FontSetting)charactersList[0]).StartIndex; if (startIndex > 0) { //Create first run Run firstRun = new Run(doc); //Set text of first run. That will be substring that starts from 0 //And ens and the start position of first Characters object //Sometimes Aspose.Cell returns incorrect index so we should check it if (startIndex < cellValue.Length) firstRun.Text = cellValue.Substring(0, startIndex); else firstRun.Text = cellValue.Substring(0); //Formation of first run will be the same as formating of whole cell ImportFont(firstRun.Font, cell.GetDisplayStyle().Font); wordRuns.Add(firstRun); } //Loop through all Character objects foreach (FontSetting chars in charactersList) { Run run = new Run(doc); //We should check index to avoid errors if (chars.StartIndex < cellValue.Length) { if (cellValue.Length > (chars.StartIndex + chars.Length) && chars.Length > 0) run.Text = cellValue.Substring(chars.StartIndex, chars.Length); else run.Text = cellValue.Substring(chars.StartIndex); } //Convert Excel Font to Words Font ImportFont(run.Font, chars.Font); wordRuns.Add(run); } } //Othervice there will be only one run else { Run run = new Run(doc); run.Text = cellValue; //Convert Excel Font to Words Font ImportFont(run.Font, cell.GetDisplayStyle().Font); wordRuns.Add(run); } return wordRuns; }
public AppViewModel() { _logger = new Log("Server.Main"); _model = new ServerModel(); _model.PropertyChanged += _model_PropertyChanged; _model.LoadSetting(); foreach (var devCashier in _model.DeviceCashiers) { devCashier.Cashier.PropertyChanged += Cashier_PropertyChanged; devCashier.PropertyChanged += DevCashierOnPropertyChanged; } if (_model.Listener != null) { _model.Listener.PropertyChanged += Listener_PropertyChanged; _mainTask = _model.Start(); } _model.SoundQueue.PropertyChanged += SoundQueue_PropertyChanged; _model.SoundQueue.StartQueue(); var queueMain = _model.QueuePriorities.FirstOrDefault(q => q.Name == "Main"); if (queueMain != null) { queueMain.PropertyChanged += QueueMain_PropertyChanged; } _model.LoadStates(); //ЗАГРУЗКА НАСТРОЕК ТАБЛО HeaderBackgroundColor = new SolidColorBrush(Colors.DarkRed); HeaderFontColor = new SolidColorBrush(Colors.Black); ColorListRows = new SolidColorBrush(Colors.Azure); ColorListBackground = new SolidColorBrush(Colors.CadetBlue); ListFontColor = new SolidColorBrush(Colors.Black); CurrentFontCash = new FontSetting { FontHeader = null, FontRow = new Font(System.Drawing.FontFamily.GenericMonospace, 10), PaddingHeader = 0, PaddingRow = 0 }; CurrentFont8X2 = new FontSetting { FontHeader = new Font(System.Drawing.FontFamily.GenericMonospace, 10), FontRow = new Font(System.Drawing.FontFamily.GenericMonospace, 10), PaddingHeader = 0, PaddingRow = 0 }; CurrentFont4X4 = new FontSetting { FontHeader = new Font(System.Drawing.FontFamily.GenericMonospace, 10), FontRow = new Font(System.Drawing.FontFamily.GenericMonospace, 10), PaddingHeader = 0, PaddingRow = 0 }; var settingUi = LoadSettingUi(); ApplySetting(settingUi); //DEBUG------------- //TimerAutoTest.Elapsed += TimerAutoTest_Elapsed; //TimerAutoTest.Start(); }
public SettingsViewModel() { PanelColor = new PanelColorSetting() { Name = nameof(PanelOpacity) }; PrimaryColor = new PrimaryColorSetting() { Name = nameof(PrimaryColor) }; SecondaryColor = new ColorSetting() { Name = nameof(SecondaryColor) }; SecondaryColorL = new ColorSetting() { Name = nameof(SecondaryColorL) }; ForegroundColor = new ColorSetting() { Name = nameof(ForegroundColor) }; ForegroundColorL = new ColorSetting() { Name = nameof(ForegroundColorL) }; LyricForegroundColor = new ColorSetting() { Name = nameof(LyricForegroundColor) }; LyricHighlightColor = new ColorSetting() { Name = nameof(LyricHighlightColor) }; LyricShadowColor = new ShadowColorSetting() { Name = "LyricShadowEffect" }; TextShadowColor = new ShadowColorSetting() { Name = "TextShadowEffect" }; PrimaryFont = new FontSetting() { Name = nameof(PrimaryFont) }; LyricFont = new FontSetting() { Name = nameof(LyricFont) }; TextMediumFontSize = new DoubleSetting() { Name = nameof(TextMediumFontSize) }; TextSmallFontSize = new DoubleSetting() { Name = nameof(TextSmallFontSize) }; LyricMediumFontSize = new DoubleSetting() { Name = nameof(LyricMediumFontSize) }; LyricSmallFontSize = new DoubleSetting() { Name = nameof(LyricSmallFontSize) }; PanelOpacity = new OpacitySetting() { Name = nameof(PanelOpacity) }; MusicVolume = new VolumeSetting() { Name = nameof(MusicVolume) }; BackgroundCoverVisibility = new VisibilitySetting() { Name = nameof(BackgroundCoverVisibility) }; MiniBackgroundCoverVisibility = new VisibilitySetting() { Name = nameof(MiniBackgroundCoverVisibility) }; }
public void Add(string key, FontSetting value) { m_dictionary.Add(key, value); }
public SettingsModel(Sidebar sidebar) { DockEdgeItems = new DockItem[2] { new DockItem() { Text = Resources.SettingsDockLeft, Value = DockEdge.Left }, new DockItem() { Text = Resources.SettingsDockRight, Value = DockEdge.Right } }; DockEdge = Framework.Settings.Instance.DockEdge; Monitor[] _monitors = Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Framework.Settings.Instance.ScreenIndex < _monitors.Length) { ScreenIndex = Framework.Settings.Instance.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } CultureItems = Utilities.Culture.GetAll(); Culture = Framework.Settings.Instance.Culture; UIScale = Framework.Settings.Instance.UIScale; XOffset = Framework.Settings.Instance.XOffset; YOffset = Framework.Settings.Instance.YOffset; PollingInterval = Framework.Settings.Instance.PollingInterval; UseAppBar = Framework.Settings.Instance.UseAppBar; AlwaysTop = Framework.Settings.Instance.AlwaysTop; ToolbarMode = Framework.Settings.Instance.ToolbarMode; ClickThrough = Framework.Settings.Instance.ClickThrough; ShowTrayIcon = Framework.Settings.Instance.ShowTrayIcon; AutoUpdate = Framework.Settings.Instance.AutoUpdate; RunAtStartup = Framework.Settings.Instance.RunAtStartup; SidebarWidth = Framework.Settings.Instance.SidebarWidth; AutoBGColor = Framework.Settings.Instance.AutoBGColor; BGColor = Framework.Settings.Instance.BGColor; BGOpacity = Framework.Settings.Instance.BGOpacity; // Logger settings BacktraceHost = Framework.Settings.Instance.BacktraceHost; BacktraceToken = Framework.Settings.Instance.BacktraceToken; BacktraceClientSiteLimiting = Framework.Settings.Instance.BacktraceClientSiteLimiting; BacktraceDatabasePath = Framework.Settings.Instance.BacktraceDatabasePath; TextAlignItems = new TextAlignItem[2] { new TextAlignItem() { Text = Resources.SettingsTextAlignLeft, Value = TextAlign.Left }, new TextAlignItem() { Text = Resources.SettingsTextAlignRight, Value = TextAlign.Right } }; TextAlign = Framework.Settings.Instance.TextAlign; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Framework.Settings.Instance.FontSetting; FontColor = Framework.Settings.Instance.FontColor; AlertFontColor = Framework.Settings.Instance.AlertFontColor; AlertBlink = Framework.Settings.Instance.AlertBlink; DateSettingItems = new DateSetting[4] { DateSetting.Disabled, DateSetting.Short, DateSetting.Normal, DateSetting.Long }; DateSetting = Framework.Settings.Instance.DateSetting; CollapseMenuBar = Framework.Settings.Instance.CollapseMenuBar; InitiallyHidden = Framework.Settings.Instance.InitiallyHidden; ShowClock = Framework.Settings.Instance.ShowClock; Clock24HR = Framework.Settings.Instance.Clock24HR; ObservableCollection <MonitorConfig> _config = new ObservableCollection <MonitorConfig>(Framework.Settings.Instance.MonitorConfig.Select(c => c.Clone()).OrderByDescending(c => c.Order)); if (sidebar.Ready) { foreach (MonitorConfig _record in _config) { _record.HardwareOC = new ObservableCollection <HardwareConfig>( from hw in sidebar.Model.MonitorManager.GetHardware(_record.Type) join config in _record.Hardware on hw.ID equals config.ID into merged from newhw in merged.DefaultIfEmpty(hw).Select(newhw => { newhw.ActualName = hw.ActualName; if (string.IsNullOrEmpty(newhw.Name)) { newhw.Name = hw.ActualName; } return(newhw); }) orderby newhw.Order descending, newhw.Name ascending select newhw ); } } MonitorConfig = _config; if (Framework.Settings.Instance.Hotkeys != null) { ToggleKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Toggle); ShowKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Show); HideKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Hide); ReloadKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Reload); CloseKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Close); CycleEdgeKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleEdge); CycleScreenKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleScreen); ReserveSpaceKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.ReserveSpace); } IsChanged = false; _loggerChange = false; }
public SettingsModel(Sidebar sidebar) { DockEdgeItems = new DockEdge[2] { DockEdge.Left, DockEdge.Right }; DockEdge = Properties.Settings.Default.DockEdge; Monitor[] _monitors = Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Properties.Settings.Default.ScreenIndex < _monitors.Length) { ScreenIndex = Properties.Settings.Default.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } UIScale = Properties.Settings.Default.UIScale; XOffset = Properties.Settings.Default.XOffset; YOffset = Properties.Settings.Default.YOffset; PollingInterval = Properties.Settings.Default.PollingInterval; UseAppBar = Properties.Settings.Default.UseAppBar; AlwaysTop = Properties.Settings.Default.AlwaysTop; HighDPISupport = Properties.Settings.Default.HighDPISupport; ClickThrough = Properties.Settings.Default.ClickThrough; ShowTrayIcon = Properties.Settings.Default.ShowTrayIcon; CheckForUpdates = Properties.Settings.Default.CheckForUpdates; RunAtStartup = Startup.StartupTaskExists(); SidebarWidth = Properties.Settings.Default.SidebarWidth; BGColor = Properties.Settings.Default.BGColor; BGOpacity = Properties.Settings.Default.BGOpacity; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Properties.Settings.Default.FontSetting; FontColor = Properties.Settings.Default.FontColor; AlertFontColor = Properties.Settings.Default.AlertFontColor; DateSettingItems = new DateSetting[4] { DateSetting.Disabled, DateSetting.Short, DateSetting.Normal, DateSetting.Long }; DateSetting = Properties.Settings.Default.DateSetting; CollapseMenuBar = Properties.Settings.Default.CollapseMenuBar; ShowClock = Properties.Settings.Default.ShowClock; Clock24HR = Properties.Settings.Default.Clock24HR; if (sidebar.Ready) { foreach (MonitorConfig _record in Properties.Settings.Default.MonitorConfig) { _record.Hardware = ( from hw in sidebar.Model.MonitorManager.GetHardware(_record.Type) join config in _record.Hardware on hw.ID equals config.ID into c from config in c.DefaultIfEmpty(hw) select config ).ToArray(); } } MonitorConfig = Properties.Settings.Default.MonitorConfig.Select(c => c.Clone()).ToArray(); if (Properties.Settings.Default.Hotkeys != null) { ToggleKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Toggle); ShowKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Show); HideKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Hide); ReloadKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Reload); CloseKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Close); } IsChanged = false; }
private void SetLevelWiseLabelsFont(List<FontSetting> LevelFontSettingList, Font LevelFont, Color ForeColor) { FontSetting fSetting = null; if (LevelFontSettingList.Count == 0) { fSetting = new FontSetting(LevelFont, ForeColor, Color.Transparent); fSetting.FontSize = 12; //fSetting.ForeColor = Color.Green; LevelFontSettingList.Add(fSetting); fSetting = new FontSetting(LevelFont, ForeColor, Color.Transparent); fSetting.FontSize = 11; //fSetting.ForeColor = Color.Red; LevelFontSettingList.Add(fSetting); } }
private void GetInfo() { var currentKey = 0; var block = ""; FontSettings = new FontSetting(); ColorSettings = new ColorSetting(); CatchSettings = new CatchSkinSetting(); ManiaSettings = new MultipleKeysSettings(); foreach (var line in _data) { var val = line.Split(':'); if (line.Trim().StartsWith("[") && line.Trim().EndsWith("]")) { block = line.Trim().Trim('[', ']'); } if (val.Length > 1) { var v = val[1].Trim(); var k = val[0].Trim(); if (line.Trim().StartsWith("Name")) { Name = v; } if (line.Trim().StartsWith("Author")) { Author = v; } if (line.Trim().StartsWith("Version")) { Version = v; } if (line.Trim().StartsWith("AnimationFramerate")) { AnimationFrameRate = v.ToUInt32(); } if (line.Trim().StartsWith("AllowSliderBallTint")) { SliderSettings.AllowSliderBallTint = v.ToBool(); } if (line.Trim().StartsWith("ComboBurstRandom")) { ComboBurstSettings.ComboBurstRandom = v.ToBool(); } if (line.Trim().StartsWith("CursorCentre")) { CursorSettings.CursorCenter = v.ToBool(); } if (line.Trim().StartsWith("CursorExpand")) { CursorSettings.CursorExpand = v.ToBool(); } if (line.Trim().StartsWith("CursorRotate")) { CursorSettings.CursorRotate = v.ToBool(); } if (line.Trim().StartsWith("CursorTrailRotate")) { CursorSettings.CursorTrailRotate = v.ToBool(); } if (line.Trim().StartsWith("CustomComboBurstSounds")) { ComboBurstSettings.CustomComboBurstSound = v; } if (line.Trim().StartsWith("HitCircleOverlayAboveNumber")) { HitCircleOverlayAboveNumber = v.ToBool(); } if (line.Trim().StartsWith("LayeredHitSounds")) { LayeredHitSounds = v.ToBool(); } if (line.Trim().StartsWith("LayeredHitSounds")) { LayeredHitSounds = v.ToBool(); } if (line.Trim().StartsWith("SliderBallFlip")) { SliderSettings.SliderBallFlip = v.ToBool(); } if (line.Trim().StartsWith("SliderBallFrames")) { SliderSettings.SliderBallFrames = v.ToUInt32(); } if (line.Trim().StartsWith("SliderStyle")) { SliderSettings.SliderStyle = (SliderStyles)v.ToInt32(); } if (line.Trim().StartsWith("SpinnerFadePlayfield")) { SpinnerSettings.SpinnerFadePlayfield = v.ToBool(); } if (line.Trim().StartsWith("SpinnerFrequencyModulate")) { SpinnerSettings.SpinnerFrequencyModulate = v.ToBool(); } if (line.Trim().StartsWith("SpinnerNoBlink")) { SpinnerSettings.SpinnerNoBlink = v.ToBool(); } if (line.Trim().StartsWith("HyperDash")) { CatchSettings.HyperDash = v.ToRgbColor(); } if (line.Trim().StartsWith("HyperDashFruit")) { CatchSettings.HyperDashFruit = v.ToRgbColor(); } if (line.Trim().StartsWith("HyperDashAfterImage")) { CatchSettings.HyperDashAfterImage = v.ToRgbColor(); } if (line.Trim().StartsWith("Combo1")) { ColorSettings.ComboColors.setColor(ComboNumber.Last, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo2")) { ColorSettings.ComboColors.setColor(ComboNumber.First, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo3")) { ColorSettings.ComboColors.setColor(ComboNumber.Second, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo4")) { ColorSettings.ComboColors.setColor(ComboNumber.Third, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo5")) { ColorSettings.ComboColors.setColor(ComboNumber.Fourth, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo6")) { ColorSettings.ComboColors.setColor(ComboNumber.Fifth, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo7")) { ColorSettings.ComboColors.setColor(ComboNumber.Sixth, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("Combo8")) { ColorSettings.ComboColors.setColor(ComboNumber.Seventh, v.ToRgbColor() as ComboColor); } if (line.Trim().StartsWith("InputOverlayText")) { ColorSettings.InputOverlayText = v.ToRgbColor() as TextColor; } if (line.Trim().StartsWith("MenuGlow")) { ColorSettings.MenuGlow = v.ToRgbColor() as OverlayColor; } if (line.Trim().StartsWith("SliderBall")) { ColorSettings.SliderBall = v.ToRgbColor(); } if (line.Trim().StartsWith("SliderBorder")) { ColorSettings.SliderBorder = v.ToRgbColor(); } if (line.Trim().StartsWith("SliderTrackOverride")) { ColorSettings.SliderTrackOverride = v.ToRgbColor(); } if (line.Trim().StartsWith("SongSelectActiveText")) { ColorSettings.SongSelectActiveText = v.ToRgbColor() as TextColor; } if (line.Trim().StartsWith("SongSelectInactiveText")) { ColorSettings.SongSelectInactiveText = v.ToRgbColor() as TextColor; } if (line.Trim().StartsWith("SpinnerBackground")) { ColorSettings.SpinnerBackground = v.ToRgbColor() as OverlayColor; } if (line.Trim().StartsWith("StarBreakAdditive")) { ColorSettings.StarBreakAdditive = v.ToRgbColor() as OverlayColor; } if (line.Trim().StartsWith("HitCirclePrefix")) { FontSettings.HitCirclePrefix = v; } if (line.Trim().StartsWith("HitCircleOverlap")) { FontSettings.HitCircleOverlap = v.ToInt32(); } if (line.Trim().StartsWith("ScorePrefix")) { FontSettings.ScorePrefix = v; } if (line.Trim().StartsWith("ScoreOverlap")) { FontSettings.ScoreOverlap = v.ToInt32(); } if (line.Trim().StartsWith("ComboPrefix")) { FontSettings.ComboPrefix = v; } if (line.Trim().StartsWith("ComboOverlap")) { FontSettings.ComboOverlap = v.ToInt32(); } if (block == "Mania") { if (line.Trim().StartsWith("Keys:")) { currentKey = v.ToInt32(); } if (line.Trim().StartsWith("ColumnStart")) { ManiaSettings[currentKey].ColumnStart = v.ToInt32(); } if (line.Trim().StartsWith("ColumnRight")) { ManiaSettings[currentKey].ColumnRight = v.ToInt32(); } if (line.Trim().StartsWith("ColumnSpacing")) { ManiaSettings[currentKey].ColumnSpacing = v; } if (line.Trim().StartsWith("ColumnWidth")) { ManiaSettings[currentKey].ColumnWidth = v; } if (line.Trim().StartsWith("ColumnLineWidth")) { ManiaSettings[currentKey].ColumnLineWidth = v; } if (line.Trim().StartsWith("BarlineHeight")) { ManiaSettings[currentKey].BarlineHeight = v.ToDouble(); } if (line.Trim().StartsWith("LightingNWidth")) { ManiaSettings[currentKey].LightingNWidth = v; } if (line.Trim().StartsWith("LightingLWidth")) { ManiaSettings[currentKey].LightingLWidth = v; } if (line.Trim().StartsWith("WidthForNoteHeightScale")) { ManiaSettings[currentKey].WidthForNoteHeightScale = v.ToNullableDouble(); } if (line.Trim().StartsWith("HitPosition")) { ManiaSettings[currentKey].HitPosition = v.ToInt32(); } if (line.Trim().StartsWith("LightPosition")) { ManiaSettings[currentKey].LightPosition = v.ToInt32(); } if (line.Trim().StartsWith("ScorePosition")) { ManiaSettings[currentKey].ScorePosition = v.ToNullableInt32(); } if (line.Trim().StartsWith("ComboPosition")) { ManiaSettings[currentKey].ScorePosition = v.ToNullableInt32(); } if (line.Trim().StartsWith("JudgementLine")) { ManiaSettings[currentKey].JudgementLine = v.ToInt32(); } if (line.Trim().StartsWith("SpecialStyle")) { var suc = int.TryParse(v, out var style); if (suc) { ManiaSettings[currentKey].SpecialStyle = (SpecialStyles)style; } else { ManiaSettings[currentKey].SpecialStyle = SkinTools.StringToEnum <SpecialStyles>(v); } } if (line.Trim().StartsWith("ComboBurstStyle")) { var suc = int.TryParse(v, out var style); if (suc) { ManiaSettings[currentKey].ComboBurstStyle = (ComboBurstStyles)style; } else { ManiaSettings[currentKey].ComboBurstStyle = SkinTools.StringToEnum <ComboBurstStyles>(v); } } if (line.Trim().StartsWith("SplitStages")) { ManiaSettings[currentKey].SplitStages = v.ToNullableBool(); } if (line.Trim().StartsWith("StageSeparation")) { ManiaSettings[currentKey].StageSeparation = v.ToDouble(); } if (line.Trim().StartsWith("KeysUnderNotes")) { ManiaSettings[currentKey].KeysUnderNotes = v.ToBool(); } if (line.Trim().StartsWith("UpsideDown")) { ManiaSettings[currentKey].UpsideDown = v.ToBool(); } int currentColumn; if (line.Trim().StartsWith("KeyFlipWhenUpsideDown")) { if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].KeyFlipWhenUpsideDown.SetForColumn(currentColumn, v.ToBool()); } else if (k.Last() == 'D') { if (k[k.Length - 2].IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].KeyFlipWhenUpsideDownD .SetForColumn(currentColumn, v.ToBool()); } } else { ManiaSettings[currentKey].KeyFlipWhenUpsideDown.SetForAllColumns(v.ToBool()); } } if (line.Trim().StartsWith("NoteFlipWhenUpsideDown")) { if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].NoteFlipWhenUpsideDown .SetForColumn(currentColumn, v.ToBool()); } else if (k.Last() == 'H') { if (k[k.Length - 2].IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].NoteFlipWhenUpsideDownH .SetForColumn(currentColumn, v.ToBool()); } else { throw new ArgumentException(); } } else if (k.Last() == 'L') { if (k[k.Length - 2].IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].NoteFlipWhenUpsideDownL .SetForColumn(currentColumn, v.ToBool()); } else { throw new ArgumentException(); } } else if (k.Last() == 'T') { if (k[k.Length - 2].IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].NoteFlipWhenUpsideDownT .SetForColumn(currentColumn, v.ToBool()); } else { throw new ArgumentException(); } } } if (line.Trim().StartsWith("NoteBodyStyle")) { if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].NoteBodyStyle.SetForColumn(currentColumn, (HoldBodyStyle)v.ToInt32()); } else { ManiaSettings[currentKey].NoteBodyStyle.SetForAllColumns((HoldBodyStyle)v.ToInt32()); } } if (line.Trim().StartsWith("Colour")) { var x = k.Replace("Colour", ""); if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].Color.SetForColumn(currentColumn, v.ToRgbaColor()); } else if (k.StartsWith("Light") && x.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].ColorLight.SetForColumn(currentColumn, v.ToRgbColor()); } else if (k.EndsWith("Hold")) { ManiaSettings[currentKey].ColorHold = v.ToRgbaColor(); } else if (k.EndsWith("ColumnLine")) { ManiaSettings[currentKey].ColorColumnLine = v.ToRgbaColor(); } else if (k.EndsWith("JudgementLine")) { ManiaSettings[currentKey].ColorJudgementLine = v.ToRgbColor(); } else if (k.EndsWith("KeyWarning")) { ManiaSettings[currentKey].ColorKeyWarning = v.ToRgbColor(); } else if (k.EndsWith("Break")) { ManiaSettings[currentKey].ColorBreak = v.ToRgbaColor(); } else { throw new ArgumentException(); } } if (line.Trim().StartsWith("KeyImage")) { if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].SkinImages.KeyImage .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); //Debug.WriteLine("A Numbered Key Image detected.At line:\"" + line + "\" at column " + currentColumn.ToString()); } else if (k.Last() == 'D') { if (k[k.Length - 2].IsDigit()) { currentColumn = k[k.Length - 2] - '0'; //Debug.WriteLine("A Numbered Key Down Image detected.At line:\"" + line + "\" at column " + currentColumn.ToString()); ManiaSettings[currentKey].SkinImages.KeyImageD .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); } else { throw new ArgumentException(); } } //Debug.WriteLine("CurrentColumn returned to zero. CurrentColumn:"+currentColumn.ToString()); } if (line.Trim().StartsWith("NoteImage")) { //Debug.WriteLine("Note Image detected.At line:\"" + line + "\""); if (k.Last().IsDigit()) { currentColumn = k.Last() - '0'; ManiaSettings[currentKey].SkinImages.NoteImage .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); } else if (k.Last() == 'H') { if (k[k.Length - 2].IsDigit()) { currentColumn = k[k.Length - 2] - '0'; ManiaSettings[currentKey].SkinImages.NoteImageH .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); } else { throw new ArgumentException(); } } else if (k.Last() == 'L') { if (k[k.Length - 2].IsDigit()) { currentColumn = k[k.Length - 2] - '0'; ManiaSettings[currentKey].SkinImages.NoteImageL .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); } else { throw new ArgumentException(); } } else if (k.Last() == 'T') { if (k[k.Length - 2].IsDigit()) { currentColumn = k[k.Length - 2] - '0'; ManiaSettings[currentKey].SkinImages.NoteImageT .SetForColumn(currentColumn, new ManiaSkinImage(this, v)); } else { throw new ArgumentException(); } } } if (line.Trim().StartsWith("StageLeft")) { ManiaSettings[currentKey].SkinImages.StageLeft = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("StageRight")) { ManiaSettings[currentKey].SkinImages.StageRight = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("StageHint")) { ManiaSettings[currentKey].SkinImages.StageHint = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("StageLight")) { ManiaSettings[currentKey].SkinImages.StageLight = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("LightingN")) { ManiaSettings[currentKey].SkinImages.LightingN = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("LightingL")) { ManiaSettings[currentKey].SkinImages.LightingL = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("WarningArrow")) { ManiaSettings[currentKey].SkinImages.WarningArrow = new ManiaSkinImage(this, v); } if (line.Trim().StartsWith("Hit0")) { SkinObjects.ManiaHitBurstImages.Hit0.Clear(); SkinObjects.ManiaHitBurstImages.Hit0.Add(new ManiaSkinImage(this, v)); } if (line.Trim().StartsWith("Hit50")) { SkinObjects.ManiaHitBurstImages.Hit50.Clear(); SkinObjects.ManiaHitBurstImages.Hit50.Add(new ManiaSkinImage(this, v)); } if (line.Trim().StartsWith("Hit100")) { SkinObjects.ManiaHitBurstImages.Hit100.Clear(); SkinObjects.ManiaHitBurstImages.Hit100.Add(new ManiaSkinImage(this, v)); } if (line.Trim().StartsWith("Hit200")) { SkinObjects.ManiaHitBurstImages.Hit200.Clear(); SkinObjects.ManiaHitBurstImages.Hit200.Add(new ManiaSkinImage(this, v)); } if (line.Trim().StartsWith("Hit300")) { SkinObjects.ManiaHitBurstImages.Hit300.Clear(); SkinObjects.ManiaHitBurstImages.Hit300.Add(new ManiaSkinImage(this, v)); } if (line.Trim().StartsWith("Hit300g")) { SkinObjects.ManiaHitBurstImages.Hit300g.Clear(); SkinObjects.ManiaHitBurstImages.Hit300g.Add(new ManiaSkinImage(this, v)); } } } } }